From b7d4d600fc787a0abe15e9ce279e26707ba84309 Mon Sep 17 00:00:00 2001 From: Michael Hillcox Date: Fri, 26 Feb 2021 21:15:48 +0000 Subject: [PATCH] chore: large refactors to new mappings --- build.gradle | 104 +++++--- gradle.properties | 9 + gradle/wrapper/gradle-wrapper.jar | Bin 54706 -> 54708 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew.bat | 168 ++++++------ logs/debug.log | 0 logs/latest.log | 0 .../api/ActuallyAdditionsAPI.java | 4 +- .../api/booklet/IBookletChapter.java | 6 +- .../api/booklet/IBookletEntry.java | 10 +- .../api/booklet/IBookletPage.java | 20 +- .../api/internal/IMethodHandler.java | 4 +- .../api/laser/IConnectionPair.java | 6 +- .../actuallyadditions/api/lens/Lens.java | 4 +- .../api/lens/LensConversion.java | 4 +- .../api/recipe/ColorLensChangerByDyeMeta.java | 4 +- .../api/recipe/CompostRecipe.java | 12 +- .../api/recipe/IColorLensChanger.java | 4 +- .../api/recipe/LensConversionRecipe.java | 4 +- .../mod/ActuallyAdditions.java | 21 +- .../mod/ClientRegistryHandler.java | 7 +- .../mod/achievement/TheAchievements.java | 16 +- .../mod/blocks/BlockAtomicReconstructor.java | 42 +-- .../mod/blocks/BlockBatteryBox.java | 12 +- .../mod/blocks/BlockBioReactor.java | 8 +- .../mod/blocks/BlockBreaker.java | 26 +- .../mod/blocks/BlockCanolaPress.java | 12 +- .../mod/blocks/BlockCoalGenerator.java | 36 ++- .../mod/blocks/BlockCoffeeMachine.java | 24 +- .../mod/blocks/BlockColoredLamp.java | 49 ++-- .../mod/blocks/BlockCompost.java | 43 ++-- .../mod/blocks/BlockCrystal.java | 12 +- .../mod/blocks/BlockCrystalCluster.java | 34 +-- .../mod/blocks/BlockDirectionalBreaker.java | 22 +- .../mod/blocks/BlockDisplayStand.java | 24 +- .../mod/blocks/BlockDropper.java | 22 +- .../mod/blocks/BlockEmpowerer.java | 16 +- .../mod/blocks/BlockEnergizer.java | 12 +- .../mod/blocks/BlockFarmer.java | 18 +- .../mod/blocks/BlockFeeder.java | 8 +- .../mod/blocks/BlockFermentingBarrel.java | 12 +- .../mod/blocks/BlockFireworkBox.java | 8 +- .../mod/blocks/BlockFishingNet.java | 8 +- .../mod/blocks/BlockFluidCollector.java | 26 +- .../mod/blocks/BlockFurnaceDouble.java | 48 ++-- .../mod/blocks/BlockFurnaceSolar.java | 8 +- .../mod/blocks/BlockGiantChest.java | 58 +++-- .../mod/blocks/BlockGreenhouseGlass.java | 26 +- .../mod/blocks/BlockGrinder.java | 42 +-- .../mod/blocks/BlockInputter.java | 24 +- .../mod/blocks/BlockItemRepairer.java | 14 +- .../mod/blocks/BlockItemViewerHopping.java | 28 +- .../mod/blocks/BlockLampPowerer.java | 20 +- .../mod/blocks/BlockLaserRelay.java | 96 ++++--- .../blocks/BlockLavaFactoryController.java | 8 +- .../mod/blocks/BlockMiner.java | 24 +- .../mod/blocks/BlockMisc.java | 8 +- .../mod/blocks/BlockOilGenerator.java | 36 ++- .../mod/blocks/BlockPhantom.java | 71 +++--- .../mod/blocks/BlockPhantomBooster.java | 10 +- .../mod/blocks/BlockPlayerInterface.java | 12 +- .../mod/blocks/BlockRangedCollector.java | 12 +- .../mod/blocks/BlockSlabs.java | 70 +++-- .../mod/blocks/BlockSmileyCloud.java | 36 ++- .../mod/blocks/BlockTinyTorch.java | 42 +-- .../mod/blocks/BlockTreasureChest.java | 38 ++- .../mod/blocks/BlockWallAA.java | 28 +- .../mod/blocks/BlockWildPlant.java | 18 +- .../mod/blocks/BlockXPSolidifier.java | 18 +- .../mod/blocks/IHudDisplay.java | 8 +- .../mod/blocks/base/BlockBase.java | 31 +-- .../mod/blocks/base/BlockBushBase.java | 31 +-- .../mod/blocks/base/BlockContainerBase.java | 232 ++++++++--------- .../mod/blocks/base/BlockFluidFlowing.java | 7 - .../mod/blocks/base/BlockPlant.java | 49 ++-- .../mod/blocks/base/BlockStair.java | 5 +- .../mod/blocks/base/ItemBlockBase.java | 42 +-- .../metalists/TheColoredLampColors.java | 6 +- .../mod/blocks/metalists/TheMiscBlocks.java | 30 +-- .../mod/blocks/metalists/TheWildPlants.java | 21 +- .../mod/blocks/render/ActualCompostModel.java | 128 +++++----- .../mod/blocks/render/CompostModel.java | 188 +++++++------- .../mod/blocks/render/IHasModel.java | 7 - .../mod/blocks/render/RenderBatteryBox.java | 74 +++--- .../mod/blocks/render/RenderDisplayStand.java | 14 +- .../mod/blocks/render/RenderEmpowerer.java | 14 +- .../mod/blocks/render/RenderLaserRelay.java | 34 ++- .../render/RenderReconstructorLens.java | 14 +- .../mod/blocks/render/RenderSmileyCloud.java | 45 ++-- .../mod/blocks/render/Transformer.java | 54 ---- .../mod/booklet/button/BookmarkButton.java | 19 +- .../mod/booklet/button/EntryButton.java | 4 +- .../mod/booklet/chapter/BookletChapter.java | 6 +- .../booklet/chapter/BookletChapterTrials.java | 15 +- .../mod/booklet/entry/BookletEntry.java | 35 +-- .../mod/booklet/gui/GuiBooklet.java | 4 +- .../mod/booklet/gui/GuiEntry.java | 4 +- .../mod/booklet/gui/GuiMainPage.java | 4 +- .../mod/booklet/gui/GuiPage.java | 4 +- .../mod/booklet/misc/BookletUtils.java | 6 +- .../mod/booklet/misc/GuiAAAchievements.java | 6 +- .../mod/booklet/page/BookletPage.java | 24 +- .../mod/booklet/page/ItemDisplay.java | 6 +- .../mod/booklet/page/PageCoffeeMachine.java | 6 +- .../mod/booklet/page/PageCrafting.java | 6 +- .../mod/booklet/page/PageCrusherRecipe.java | 6 +- .../mod/booklet/page/PageEmpowerer.java | 6 +- .../mod/booklet/page/PageFurnace.java | 6 +- .../mod/booklet/page/PageLinkButton.java | 8 +- .../mod/booklet/page/PagePicture.java | 4 +- .../mod/booklet/page/PageReconstructor.java | 6 +- .../mod/booklet/page/PageTextOnly.java | 6 +- .../mod/booklet/page/PageTrials.java | 21 +- .../mod/creative/CreativeTab.java | 4 +- .../mod/data/PlayerData.java | 55 ++-- .../actuallyadditions/mod/data/WorldData.java | 44 ++-- .../mod/entity/EntityWorm.java | 33 ++- .../mod/entity/InitEntities.java | 4 +- .../mod/entity/RenderWorm.java | 4 +- .../mod/event/ClientEvents.java | 31 ++- .../mod/event/CommonEvents.java | 26 +- .../actuallyadditions/mod/gen/AAWorldGen.java | 8 +- .../mod/gen/WorldGenLushCaves.java | 16 +- .../VillageComponentCustomCropField.java | 4 +- .../component/VillageComponentJamHouse.java | 8 +- .../mod/inventory/ContainerBag.java | 80 +++--- .../mod/inventory/ContainerBioReactor.java | 6 +- .../mod/inventory/ContainerBreaker.java | 8 +- .../mod/inventory/ContainerCanolaPress.java | 8 +- .../mod/inventory/ContainerCoalGenerator.java | 8 +- .../mod/inventory/ContainerCoffeeMachine.java | 8 +- .../ContainerDirectionalBreaker.java | 8 +- .../mod/inventory/ContainerDrill.java | 12 +- .../mod/inventory/ContainerDropper.java | 14 +- .../mod/inventory/ContainerEnergizer.java | 16 +- .../mod/inventory/ContainerEnervator.java | 14 +- .../mod/inventory/ContainerFarmer.java | 8 +- .../mod/inventory/ContainerFeeder.java | 8 +- .../inventory/ContainerFermentingBarrel.java | 8 +- .../mod/inventory/ContainerFilter.java | 12 +- .../mod/inventory/ContainerFireworkBox.java | 6 +- .../inventory/ContainerFluidCollector.java | 8 +- .../mod/inventory/ContainerFurnaceDouble.java | 8 +- .../mod/inventory/ContainerGiantChest.java | 8 +- .../mod/inventory/ContainerGrinder.java | 56 ++-- .../mod/inventory/ContainerInputter.java | 10 +- .../ContainerLaserRelayItemWhitelist.java | 10 +- .../mod/inventory/ContainerMiner.java | 8 +- .../mod/inventory/ContainerOilGenerator.java | 8 +- .../mod/inventory/ContainerPhantomPlacer.java | 8 +- .../inventory/ContainerRangedCollector.java | 10 +- .../mod/inventory/ContainerRepairer.java | 8 +- .../mod/inventory/ContainerSmileyCloud.java | 8 +- .../mod/inventory/ContainerXPSolidifier.java | 8 +- .../mod/inventory/GuiFireworkBox.java | 4 +- .../mod/inventory/GuiHandler.java | 8 +- .../mod/inventory/gui/EnergyDisplay.java | 23 +- .../mod/inventory/gui/FilterSettingsGui.java | 59 +++-- .../mod/inventory/gui/FluidDisplay.java | 29 ++- .../mod/inventory/gui/GuiBag.java | 43 ++-- .../mod/inventory/gui/GuiBreaker.java | 6 +- .../mod/inventory/gui/GuiCanolaPress.java | 6 +- .../mod/inventory/gui/GuiCoalGenerator.java | 6 +- .../mod/inventory/gui/GuiCoffeeMachine.java | 6 +- .../inventory/gui/GuiDirectionalBreaker.java | 6 +- .../mod/inventory/gui/GuiDrill.java | 6 +- .../mod/inventory/gui/GuiDropper.java | 10 +- .../mod/inventory/gui/GuiEnergizer.java | 10 +- .../mod/inventory/gui/GuiEnervator.java | 10 +- .../mod/inventory/gui/GuiFarmer.java | 6 +- .../mod/inventory/gui/GuiFeeder.java | 6 +- .../inventory/gui/GuiFermentingBarrel.java | 6 +- .../mod/inventory/gui/GuiFilter.java | 6 +- .../mod/inventory/gui/GuiFluidCollector.java | 6 +- .../mod/inventory/gui/GuiFurnaceDouble.java | 6 +- .../mod/inventory/gui/GuiGiantChest.java | 6 +- .../mod/inventory/gui/GuiGrinder.java | 6 +- .../mod/inventory/gui/GuiInputter.java | 10 +- .../gui/GuiLaserRelayItemWhitelist.java | 6 +- .../mod/inventory/gui/GuiMiner.java | 6 +- .../mod/inventory/gui/GuiOilGenerator.java | 6 +- .../mod/inventory/gui/GuiPhantomPlacer.java | 6 +- .../mod/inventory/gui/GuiRangedCollector.java | 6 +- .../mod/inventory/gui/GuiRepairer.java | 6 +- .../mod/inventory/gui/GuiSmileyCloud.java | 24 +- .../mod/inventory/gui/GuiXPSolidifier.java | 9 +- .../mod/inventory/gui/TexturedButton.java | 13 +- .../mod/inventory/slot/SlotFilter.java | 8 +- .../mod/inventory/slot/SlotImmovable.java | 4 +- .../slot/SlotItemHandlerUnconditioned.java | 4 +- .../mod/items/ItemAllToolAA.java | 57 +++-- .../mod/items/ItemAxeAA.java | 4 +- .../actuallyadditions/mod/items/ItemBag.java | 22 +- .../mod/items/ItemBattery.java | 18 +- .../mod/items/ItemBooklet.java | 37 +-- .../mod/items/ItemChestToCrateUpgrade.java | 16 +- .../mod/items/ItemCoffee.java | 23 +- .../mod/items/ItemCrafterOnAStick.java | 6 +- .../mod/items/ItemCrystal.java | 6 +- .../mod/items/ItemCrystalShard.java | 8 +- .../mod/items/ItemDrill.java | 110 +++++--- .../mod/items/ItemDrillUpgrade.java | 18 +- .../actuallyadditions/mod/items/ItemDust.java | 6 +- .../mod/items/ItemEngineerGoggles.java | 10 +- .../mod/items/ItemFertilizer.java | 6 +- .../mod/items/ItemFillingWand.java | 59 +++-- .../mod/items/ItemFilter.java | 12 +- .../mod/items/ItemFoods.java | 12 +- .../mod/items/ItemGrowthRing.java | 12 +- .../mod/items/ItemHairyBall.java | 18 +- .../actuallyadditions/mod/items/ItemJams.java | 14 +- .../mod/items/ItemLaserWrench.java | 10 +- .../mod/items/ItemLeafBlower.java | 26 +- .../mod/items/ItemMagnetRing.java | 22 +- .../actuallyadditions/mod/items/ItemMisc.java | 8 +- .../mod/items/ItemPhantomConnector.java | 33 +-- .../mod/items/ItemPickaxeAA.java | 6 +- .../mod/items/ItemPlayerProbe.java | 33 ++- .../mod/items/ItemPotionRing.java | 42 +-- .../mod/items/ItemResonantRice.java | 6 +- .../mod/items/ItemShovelAA.java | 17 +- .../mod/items/ItemSolidifiedExperience.java | 12 +- .../mod/items/ItemSpawnerChanger.java | 32 ++- .../mod/items/ItemTeleStaff.java | 28 +- .../mod/items/ItemWaterBowl.java | 54 ++-- .../mod/items/ItemWaterRemovalRing.java | 6 +- .../mod/items/ItemWingsOfTheBats.java | 18 +- .../actuallyadditions/mod/items/ItemWorm.java | 28 +- .../mod/items/base/ItemEnergy.java | 46 ++-- .../mod/items/base/ItemFoodSeed.java | 4 +- .../mod/items/base/ItemSeed.java | 6 +- .../mod/items/lens/LensColor.java | 14 +- .../mod/items/lens/LensDeath.java | 4 +- .../mod/items/lens/LensDetonation.java | 6 +- .../mod/items/lens/LensDisenchanting.java | 4 +- .../mod/items/lens/LensDisruption.java | 14 +- .../mod/items/lens/LensMining.java | 18 +- .../mod/jei/RecipeWrapperWithButton.java | 11 +- .../ReconstructorRecipeWrapper.java | 16 +- .../mod/misc/apiimpl/ConnectionPair.java | 36 ++- .../apiimpl/LaserRelayConnectionHandler.java | 40 +-- .../mod/misc/apiimpl/MethodHandler.java | 50 ++-- .../apiimpl/farmer/CactusFarmerBehavior.java | 22 +- .../apiimpl/farmer/DefaultFarmerBehavior.java | 20 +- .../farmer/MelonPumpkinFarmerBehavior.java | 6 +- .../farmer/NetherWartFarmerBehavior.java | 4 +- .../apiimpl/farmer/ReedFarmerBehavior.java | 6 +- .../farmer/exu/EnderlillyFarmerBehavior.java | 68 ++--- .../farmer/exu/ExUPlantFarmerBehavior.java | 241 +++++++++--------- .../farmer/exu/RedOrchidFarmerBehavior.java | 65 ++--- .../mod/misc/special/RenderSpecial.java | 18 +- .../mod/network/IDataHandler.java | 4 +- .../mod/network/PacketClientToServer.java | 8 +- .../mod/network/PacketHandler.java | 58 ++--- .../mod/network/PacketHandlerHelper.java | 37 ++- .../mod/network/PacketServerToClient.java | 15 +- .../mod/network/gui/IButtonReactor.java | 4 +- .../mod/network/gui/INumberReactor.java | 4 +- .../mod/network/gui/IStringReactor.java | 4 +- .../mod/particle/ParticleBeam.java | 4 +- .../mod/particle/ParticleLaserItem.java | 16 +- .../mod/proxy/ClientProxy.java | 51 ++-- .../actuallyadditions/mod/proxy/IProxy.java | 4 +- .../mod/proxy/ServerProxy.java | 4 +- .../mod/recipe/ColorLensRotator.java | 4 +- .../mod/recipe/EnchBookConversion.java | 4 +- .../mod/tile/CustomEnergyStorage.java | 14 +- .../mod/tile/FilterSettings.java | 45 ++-- .../mod/tile/IEnergyDisplay.java | 6 +- .../tile/TileEntityAtomicReconstructor.java | 18 +- .../mod/tile/TileEntityBase.java | 64 +++-- .../mod/tile/TileEntityBioReactor.java | 16 +- .../mod/tile/TileEntityBreaker.java | 14 +- .../mod/tile/TileEntityCanolaPress.java | 15 +- .../mod/tile/TileEntityCoalGenerator.java | 17 +- .../mod/tile/TileEntityCoffeeMachine.java | 21 +- .../mod/tile/TileEntityCompost.java | 47 ++-- .../tile/TileEntityDirectionalBreaker.java | 12 +- .../mod/tile/TileEntityDisplayStand.java | 10 +- .../mod/tile/TileEntityDropper.java | 10 +- .../mod/tile/TileEntityEmpowerer.java | 37 ++- .../mod/tile/TileEntityEnergizer.java | 6 +- .../mod/tile/TileEntityEnervator.java | 6 +- .../mod/tile/TileEntityFarmer.java | 38 +-- .../mod/tile/TileEntityFeeder.java | 16 +- .../mod/tile/TileEntityFermentingBarrel.java | 19 +- .../mod/tile/TileEntityFireworkBox.java | 100 ++++---- .../mod/tile/TileEntityFishingNet.java | 14 +- .../mod/tile/TileEntityFluidCollector.java | 12 +- .../mod/tile/TileEntityFurnaceDouble.java | 32 ++- .../mod/tile/TileEntityFurnaceSolar.java | 10 +- .../mod/tile/TileEntityGiantChest.java | 12 +- .../mod/tile/TileEntityGrinder.java | 44 ++-- .../mod/tile/TileEntityHeatCollector.java | 14 +- .../mod/tile/TileEntityInputter.java | 32 +-- .../mod/tile/TileEntityInventoryBase.java | 28 +- .../mod/tile/TileEntityItemRepairer.java | 35 +-- .../mod/tile/TileEntityItemViewer.java | 35 ++- .../mod/tile/TileEntityItemViewerHopping.java | 4 +- .../mod/tile/TileEntityLaserRelay.java | 35 ++- .../mod/tile/TileEntityLaserRelayEnergy.java | 41 +-- .../mod/tile/TileEntityLaserRelayFluids.java | 39 +-- .../mod/tile/TileEntityLaserRelayItem.java | 30 +-- .../TileEntityLaserRelayItemWhitelist.java | 18 +- .../tile/TileEntityLavaFactoryController.java | 20 +- .../mod/tile/TileEntityLeafGenerator.java | 16 +- .../mod/tile/TileEntityMiner.java | 32 ++- .../mod/tile/TileEntityOilGenerator.java | 23 +- .../mod/tile/TileEntityPhantomPlacer.java | 14 +- .../tile/TileEntityPhantomRedstoneface.java | 4 +- .../mod/tile/TileEntityPhantomface.java | 31 ++- .../mod/tile/TileEntityPlayerInterface.java | 30 ++- .../mod/tile/TileEntityRangedCollector.java | 16 +- .../mod/tile/TileEntityShockSuppressor.java | 12 +- .../mod/tile/TileEntitySmileyCloud.java | 14 +- .../mod/tile/TileEntityXPSolidifier.java | 52 ++-- .../mod/update/UpdateChecker.java | 17 +- .../actuallyadditions/mod/util/AssetUtil.java | 82 +++--- .../mod/util/FluidStateMapper.java | 8 +- .../mod/util/IColorProvidingBlock.java | 4 +- .../mod/util/IColorProvidingItem.java | 4 +- .../actuallyadditions/mod/util/ItemUtil.java | 46 ++-- .../actuallyadditions/mod/util/StackUtil.java | 122 ++++++--- .../mod/util/StringUtil.java | 12 +- .../mod/util/VanillaPacketDispatcher.java | 13 +- .../actuallyadditions/mod/util/WorldUtil.java | 114 +++++---- .../mod/util/compat/CompatFastBench.java | 12 +- .../mod/util/compat/CompatUtil.java | 32 ++- 328 files changed, 3942 insertions(+), 3481 deletions(-) create mode 100644 gradle.properties create mode 100644 logs/debug.log create mode 100644 logs/latest.log delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/IHasModel.java delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/Transformer.java diff --git a/build.gradle b/build.gradle index abf56a77c..9048fab34 100644 --- a/build.gradle +++ b/build.gradle @@ -1,71 +1,115 @@ buildscript { repositories { + maven { url = 'https://files.minecraftforge.net/maven' } jcenter() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } + mavenCentral() } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true } } -apply plugin: 'net.minecraftforge.gradle.forge' +apply plugin: 'java' apply plugin: 'idea' +apply plugin: 'maven-publish' +apply plugin: 'net.minecraftforge.gradle' -version = "1.12.2-r152" +version = "$mod_version" group = "de.ellpeck.actuallyadditions" -archivesBaseName = "ActuallyAdditions" +archivesBaseName = "ActuallyAdditions-$game_version" if (System.getenv('BUILD_NUMBER') != null) { version += "." + System.getenv('BUILD_NUMBER') } +sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' + minecraft { - version = "1.12.2-14.23.5.2836" - runDir = "run" - mappings = "stable_39" - makeObfSourceJar = false - replaceIn "ActuallyAdditions.java" - replace "@VERSION@", version.toString() + mappings channel: 'snapshot', version: "${mcp_mappings}" + // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. + + accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + + runs { + client { + workingDirectory project.file('run') + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + property 'forge.logging.console.level', 'debug' + mods { + actuallyadditions { + source sourceSets.main + } + } + } + + server { + workingDirectory project.file('run') + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + property 'forge.logging.console.level', 'debug' + mods { + actuallyadditions { + source sourceSets.main + } + } + } + + data { + workingDirectory project.file('run') + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + property 'forge.logging.console.level', 'debug' + args '--mod', 'actuallyadditions', '--all', '--output', file('src/generated/resources/') + mods { + actuallyadditions { + source sourceSets.main + } + } + } + } } repositories { maven { - url "https://dvs1.progwml6.com/files/maven" + // JEI + name = "Progwml6 maven" + url = "https://dvs1.progwml6.com/files/maven/" } maven { - url "https://maven.tehnut.info" - } - maven { - url "https://dl.bintray.com/cyclopsmc/dev/" + url = "https://www.cursemaven.com" } } dependencies { - deobfCompile "mezz.jei:jei_1.12.2:+" - deobfCompile "mcp.mobius.waila:Hwyla:1.8+" - deobfCompile ("org.cyclops.commoncapabilities:CommonCapabilities:1.12.2-+") + minecraft "net.minecraftforge:forge:${game_version}-${forge_version}" + + compileOnly fg.deobf("mezz.jei:jei-${jei_version}:api") + runtimeOnly fg.deobf("mezz.jei:jei-${jei_version}") } +// not sure if this is still needed processResources { - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version + inputs.property('version', project.version) from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - expand 'version': project.version, 'mcversion': project.minecraft.version + include 'META-INF/mods.toml' + expand 'version': project.version } from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' + exclude 'META-INF/mods.toml' } } jar { + group = 'artifact' + manifest { + attributes(["Specification-Title" : "BuildingGadgets", + "Specification-Version" : "1", + "Implementation-Title" : project.archivesBaseName, + "Implementation-Version" : project.version, + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],) + } + from sourceSets.main.output } task deobfJar(type: Jar) { @@ -95,8 +139,6 @@ task sourcesJar(type: Jar) { classifier = 'sources' } -apply plugin: 'maven-publish' - artifacts { archives deobfJar, sourcesJar, apiJar, javadocJar } @@ -128,4 +170,4 @@ publishing { url "file://" + System.getenv("local_maven") } } -} \ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 000000000..e964ecf77 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,9 @@ +# Actually Additions +# TODO: check this version change is okay. +mod_version=1.1.52 +# Forge +game_version=1.16.5 +forge_version=36.0.43 +mcp_mappings=20201028-1.16.3 +# Other mods +jei_version=1.16.4:7.6.1.71 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a7d517fd6fd6234731c92dfdd3552bfc99c9a03a..7a3265ee94c0ab25cf079ac8ccdf87f41d455d42 100644 GIT binary patch delta 759 zcmYk4T}V@57{|~1X!ArX*HOmsI?)CJ`^kZHjL81i=d03(FYY) zx<4XXB1Lxw<*17;QfqVO=H}PDD6hN`B`Ecx+j{pp#RG@){C>~>dEaw5uYVxr<3LJB z^|qSMMVGzPRxdB*ueGhVF{wix^xFcdlH`!E7C4ZdDtX*#vTIbM ze0>&Af(@(}3&DMC2!_!bwv5+>MqD1%$iz@onF}{l@r7f(E`h!=8P9YwGC~?1OxrLG zp~LiY`v!duS!sFaIyvb_UZTQtU{8gj=kJ%ic2)3z z5p@+A7!E1$eOD>1lB;5oEvwp^EvVuR6V!1l-F1p}-#PVY8P`a03$(jS@M}UrY2DT_ zwJzCAN6MTL)nS#6o)W4#e2kUiL--8QIShtPutaKDCN4!htQG!dFF=GR?o6qa`(j;n>o7D` zOR{eh-9AOEb9`DQW7npBK7EJ`-AT;$&1m$uCrNtPdlNGnO}!E-y)TRJt6+XcrLumm z90HxQDmA^~XvU*iD=D9#kDKvx*2=|Raj|;zB0?eT)D9dqtVi=MruSKq!nUGLI#GA2v#U+ z{;By7g3PFWxQBct4RCYFsJUv0{e zAP6n3H}}Kt%Y`(r6{lgCw}_j#D`lc#ULje8=r^EBlrh7sON!dTg(GB1j;T~!TsTg{ zsWF#=_X`JTGi%4G7LU>wW7I*Fy&FY-9iE$XYIf@O*KOkPYMz7{QwG)-6*A{-hq5pf z(xKQKpPysqu-cr4N358kBpxP}aA+xs!J@Kwm|e!<=`s!9+2e?Z4;&o6b*RzuQ6a69 z**sJ`jrOKs6RD@~Gf>T1(HGRg6OqMPgd;Zy kUQBrRpl(fVioWLP6HaHN(6eRyKN6NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/logs/debug.log b/logs/debug.log new file mode 100644 index 000000000..e69de29bb diff --git a/logs/latest.log b/logs/latest.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java index 184dd51a3..c6a4d6feb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java @@ -34,7 +34,7 @@ import de.ellpeck.actuallyadditions.api.recipe.OilGenRecipe; import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot; import de.ellpeck.actuallyadditions.api.recipe.WeightedOre; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; @@ -217,7 +217,7 @@ public final class ActuallyAdditionsAPI { * @param output The itemstack to be output from the compost once conversion finishes * @param outputDisplay The state to display when there is output in the compost */ - public static void addCompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay) { + public static void addCompostRecipe(Ingredient input, BlockState inputDisplay, ItemStack output, BlockState outputDisplay) { COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java index 7e8ade57c..453d866eb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java @@ -12,16 +12,16 @@ package de.ellpeck.actuallyadditions.api.booklet; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public interface IBookletChapter { IBookletPage[] getAllPages(); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) String getLocalizedName(); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) String getLocalizedNameWithFormatting(); IBookletEntry getEntry(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java index 43b7683c9..f5b7a1c53 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java @@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.api.booklet; import java.util.List; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public interface IBookletEntry { @@ -21,19 +21,19 @@ public interface IBookletEntry { String getIdentifier(); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) String getLocalizedName(); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) String getLocalizedNameWithFormatting(); void addChapter(IBookletChapter chapter); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) List getChaptersForDisplay(String searchBarText); int getSortingPriority(); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) boolean visibleOnFrontPage(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletPage.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletPage.java index 9651ae51c..4a247cee2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletPage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletPage.java @@ -17,7 +17,7 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public interface IBookletPage { @@ -29,31 +29,31 @@ public interface IBookletPage { void setChapter(IBookletChapter chapter); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) String getInfoText(); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) void actionPerformed(GuiBookletBase gui, GuiButton button); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) void initGui(GuiBookletBase gui, int startX, int startY); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks); boolean shouldBeOnLeftSide(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java index b6dd6c2ad..b7fd6b135 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java @@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.potion.PotionEffect; @@ -40,7 +40,7 @@ public interface IMethodHandler { PotionEffect[] getEffectsFromStack(ItemStack stack); - boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile); + boolean invokeConversionLens(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile); boolean invokeReconstructor(IAtomicReconstructor tile); diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/laser/IConnectionPair.java b/src/main/java/de/ellpeck/actuallyadditions/api/laser/IConnectionPair.java index 6155cab35..5d1c9f6f0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/laser/IConnectionPair.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/laser/IConnectionPair.java @@ -10,14 +10,14 @@ package de.ellpeck.actuallyadditions.api.laser; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.math.BlockPos; public interface IConnectionPair { - void writeToNBT(NBTTagCompound compound); + void writeToNBT(CompoundNBT compound); - void readFromNBT(NBTTagCompound compound); + void readFromNBT(CompoundNBT compound); BlockPos[] getPositions(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java b/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java index b5ebb9c63..e779c9ba3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.api.lens; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -27,7 +27,7 @@ public abstract class Lens { * @param tile The tile the lens was invoked from * @return If the Reconstructor should stop continuing (return false if you want it to go through blocks) */ - public abstract boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile); + public abstract boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile); /** * Returns the color in an array of 3 float values that are r, g, b diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java b/src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java index 195af9e34..1d2e0a1aa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java @@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.api.lens; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.util.math.BlockPos; /** @@ -25,7 +25,7 @@ import net.minecraft.util.math.BlockPos; public class LensConversion extends Lens { @Override - public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { + public boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { return ActuallyAdditionsAPI.methodHandler.invokeConversionLens(hitState, hitBlock, tile); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java index 1368c2ce8..0f6bf1200 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.api.recipe; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; @@ -22,7 +22,7 @@ import net.minecraft.util.math.BlockPos; public class ColorLensChangerByDyeMeta implements IColorLensChanger { @Override - public ItemStack modifyItem(ItemStack stack, IBlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) { + public ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) { ItemStack newStack = stack.copy(); int meta = newStack.getItemDamage(); newStack.setItemDamage((meta + 1) % 16); diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CompostRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CompostRecipe.java index 5522e7318..af1fcf66d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CompostRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CompostRecipe.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.api.recipe; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; @@ -19,15 +19,15 @@ public class CompostRecipe { protected final Ingredient input; protected final ItemStack output; - protected final IBlockState inputDisplay; - protected final IBlockState outputDisplay; + protected final BlockState inputDisplay; + protected final BlockState outputDisplay; @Deprecated public CompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) { this(Ingredient.fromStacks(input), inputDisplay.getDefaultState(), output, outputDisplay.getDefaultState()); } - public CompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay) { + public CompostRecipe(Ingredient input, BlockState inputDisplay, ItemStack output, BlockState outputDisplay) { this.input = input; this.output = output; this.inputDisplay = inputDisplay; @@ -46,11 +46,11 @@ public class CompostRecipe { return this.output; } - public IBlockState getInputDisplay() { + public BlockState getInputDisplay() { return this.inputDisplay; } - public IBlockState getOutputDisplay() { + public BlockState getOutputDisplay() { return this.outputDisplay; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/IColorLensChanger.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/IColorLensChanger.java index 876ea10f3..c5c07539e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/IColorLensChanger.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/IColorLensChanger.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.api.recipe; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; @@ -35,6 +35,6 @@ public interface IColorLensChanger { * @param tile the Reconstructor doing the color conversion * @return the modified stack. Please make sure to return a modified COPY of the input stack. */ - ItemStack modifyItem(ItemStack stack, IBlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile); + ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java index c8f9b7ee4..4c1508bc1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java @@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.api.recipe; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.math.BlockPos; @@ -56,6 +56,6 @@ public class LensConversionRecipe { return this.type; } - public void transformHook(ItemStack stack, IBlockState state, BlockPos pos, IAtomicReconstructor tile) { + public void transformHook(ItemStack stack, BlockState state, BlockPos pos, IAtomicReconstructor tile) { } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java index 41f464005..a0692c623 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java @@ -10,9 +10,6 @@ package de.ellpeck.actuallyadditions.mod; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet; import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler; @@ -23,6 +20,7 @@ import de.ellpeck.actuallyadditions.mod.event.CommonEvents; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.gen.AAWorldGen; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; +import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.ItemCoffee; import de.ellpeck.actuallyadditions.mod.items.lens.LensMining; import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler; @@ -41,6 +39,8 @@ import de.ellpeck.actuallyadditions.mod.recipe.TreasureChestHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.update.UpdateChecker; import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil; +import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemStack; import net.minecraft.launchwrapper.Launch; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; @@ -52,12 +52,10 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.event.FMLServerStartedEvent; -import net.minecraftforge.fml.common.event.FMLServerStoppedEvent; +import net.minecraftforge.fml.common.event.*; import net.minecraftforge.fml.common.registry.GameRegistry; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; @Mod(modid = ActuallyAdditions.MODID, name = ActuallyAdditions.NAME, version = ActuallyAdditions.VERSION, guiFactory = ActuallyAdditions.GUIFACTORY, dependencies = ActuallyAdditions.DEPS) public class ActuallyAdditions { @@ -69,6 +67,13 @@ public class ActuallyAdditions { public static final String DEPS = "required:forge@[14.23.5.2836,);before:craftingtweaks;after:fastbench@[1.3.2,)"; public static final boolean DEOBF = (boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"); + public static final ItemGroup GROUP = new ItemGroup(MODID) { + @Override + public ItemStack createIcon() { + return new ItemStack(InitItems.itemBooklet); + } + }; + @Instance public static ActuallyAdditions INSTANCE; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ClientRegistryHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ClientRegistryHandler.java index 15401d56a..73e405e6b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ClientRegistryHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ClientRegistryHandler.java @@ -1,11 +1,7 @@ package de.ellpeck.actuallyadditions.mod; -import java.util.HashMap; -import java.util.Map; - import de.ellpeck.actuallyadditions.mod.blocks.render.ActualCompostModel; import de.ellpeck.actuallyadditions.mod.blocks.render.CompostModel; -import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.util.FluidStateMapper; import net.minecraft.block.Block; @@ -20,6 +16,9 @@ import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import java.util.HashMap; +import java.util.Map; + public class ClientRegistryHandler { public static final Map MODEL_LOCATIONS_FOR_REGISTERING = new HashMap<>(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/TheAchievements.java b/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/TheAchievements.java index 8e1f7c58d..8ccc025b1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/TheAchievements.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/achievement/TheAchievements.java @@ -18,8 +18,8 @@ import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.Util; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.stats.Achievement; @@ -96,11 +96,11 @@ public enum TheAchievements{ this(name, x, y, displayStack, hasToHaveBefore, type, false, 0, specialItemsToBeGotten); } - public void get(EntityPlayer player){ + public void get(PlayerEntity player){ this.get(player, 1); } - public void get(EntityPlayer player, int amount){ + public void get(PlayerEntity player, int amount){ if(this.progressToReach > 0){ this.updateStatus(player, amount); } @@ -109,10 +109,10 @@ public enum TheAchievements{ } } - private void updateStatus(EntityPlayer player, int amount){ - if(player instanceof EntityPlayerMP){ + private void updateStatus(PlayerEntity player, int amount){ + if(player instanceof ServerPlayerEntity){ - StatisticsManager manager = ((EntityPlayerMP)player).getStatFile(); + StatisticsManager manager = ((ServerPlayerEntity)player).getStatFile(); if(manager != null && !manager.hasAchievementUnlocked(this.chieve) && manager.canUnlockAchievement(this.chieve)){ JsonSerializableSet data = manager.getProgress(this.chieve); @@ -143,4 +143,4 @@ public enum TheAchievements{ } } } - */ \ No newline at end of file + */ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java index df91f13ad..b3b30ef06 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import java.util.List; - import de.ellpeck.actuallyadditions.api.lens.ILensItem; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; @@ -25,20 +23,20 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockDirectional; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; +import net.minecraft.block.state.BlockState; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.init.Items; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; @@ -46,8 +44,10 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import java.util.List; public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay { @@ -63,14 +63,16 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { ItemStack heldItem = player.getHeldItem(hand); - if (this.tryToggleRedstone(world, pos, player)) { return true; } + if (this.tryToggleRedstone(world, pos, player)) { + return true; + } if (!world.isRemote) { TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getTileEntity(pos); if (reconstructor != null) { @@ -105,8 +107,8 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud } @Override - @SideOnly(Side.CLIENT) - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { + @OnlyIn(Dist.CLIENT) + public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos()); if (tile instanceof TileEntityAtomicReconstructor) { ItemStack slot = ((TileEntityAtomicReconstructor) tile).inv.getStackInSlot(0); @@ -133,7 +135,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal(); world.setBlockState(pos, this.getStateFromMeta(rotation), 2); @@ -141,12 +143,12 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockDirectional.FACING).getIndex(); } @@ -156,12 +158,12 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING))); } @@ -205,12 +207,12 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud } @Override - public boolean hasComparatorInputOverride(IBlockState state) { + public boolean hasComparatorInputOverride(BlockState state) { return true; } @Override - public int getComparatorInputOverride(IBlockState blockState, World world, BlockPos pos) { + public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos) { TileEntity t = world.getTileEntity(pos); int i = 0; if (t instanceof TileEntityAtomicReconstructor) { @@ -218,4 +220,4 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud } return MathHelper.clamp(i / 20000, 0, 15); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java index acaf5134d..486c5bb7d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java @@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; @@ -39,7 +39,7 @@ public class BlockBatteryBox extends BlockContainerBase { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return BlockSlabs.AABB_BOTTOM_HALF; } @@ -49,7 +49,7 @@ public class BlockBatteryBox extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityBatteryBox) { TileEntityBatteryBox box = (TileEntityBatteryBox) tile; @@ -74,7 +74,7 @@ public class BlockBatteryBox extends BlockContainerBase { } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBioReactor.java index 5a8779601..5d2fcac3f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBioReactor.java @@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -43,7 +43,7 @@ public class BlockBioReactor extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { if (world.getTileEntity(pos) instanceof TileEntityBioReactor) { player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BIO_REACTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java index 3b9e33e1c..e0c0395d2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java @@ -19,14 +19,14 @@ import net.minecraft.block.BlockDirectional; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; @@ -47,12 +47,16 @@ public class BlockBreaker extends BlockContainerBase { @Override public TileEntity createNewTileEntity(World world, int par2) { - return this.isPlacer ? new TileEntityPlacer() : new TileEntityBreaker(); + return this.isPlacer + ? new TileEntityPlacer() + : new TileEntityBreaker(); } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { - if (this.tryToggleRedstone(world, pos, player)) { return true; } + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { + if (this.tryToggleRedstone(world, pos, player)) { + return true; + } if (!world.isRemote) { TileEntityBreaker breaker = (TileEntityBreaker) world.getTileEntity(pos); if (breaker != null) { @@ -69,7 +73,7 @@ public class BlockBreaker extends BlockContainerBase { } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal(); world.setBlockState(pos, this.getStateFromMeta(rotation), 2); @@ -77,12 +81,12 @@ public class BlockBreaker extends BlockContainerBase { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockDirectional.FACING).getIndex(); } @@ -92,12 +96,12 @@ public class BlockBreaker extends BlockContainerBase { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java index 87c6d5848..aed103c9e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java @@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -37,12 +37,12 @@ public class BlockCanolaPress extends BlockContainerBase { } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @@ -52,7 +52,7 @@ public class BlockCanolaPress extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing side, float par7, float par8, float par9) { if (!world.isRemote) { TileEntityCanolaPress press = (TileEntityCanolaPress) world.getTileEntity(pos); if (press != null) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java index 1936246a3..f4cdba1b7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import java.util.Random; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; @@ -20,21 +18,19 @@ import net.minecraft.block.BlockHorizontal; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.Mirror; -import net.minecraft.util.Rotation; +import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import java.util.Random; public class BlockCoalGenerator extends BlockContainerBase { @@ -48,12 +44,12 @@ public class BlockCoalGenerator extends BlockContainerBase { } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @@ -63,8 +59,8 @@ public class BlockCoalGenerator extends BlockContainerBase { } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) { + @OnlyIn(Dist.CLIENT) + public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityCoalGenerator) { if (((TileEntityCoalGenerator) tile).currentBurnTime > 0) { @@ -76,7 +72,7 @@ public class BlockCoalGenerator extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { TileEntityCoalGenerator press = (TileEntityCoalGenerator) world.getTileEntity(pos); if (press != null) { @@ -88,7 +84,7 @@ public class BlockCoalGenerator extends BlockContainerBase { } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2); super.onBlockPlacedBy(world, pos, state, player, stack); @@ -100,12 +96,12 @@ public class BlockCoalGenerator extends BlockContainerBase { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockHorizontal.FACING).getHorizontalIndex(); } @@ -115,12 +111,12 @@ public class BlockCoalGenerator extends BlockContainerBase { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java index c6248a39e..93edc7a26 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java @@ -18,14 +18,14 @@ import net.minecraft.block.BlockHorizontal; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.AxisAlignedBB; @@ -47,22 +47,22 @@ public class BlockCoffeeMachine extends BlockContainerBase { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return AABB; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing f6, float f7, float f8, float f9) { if (!world.isRemote) { TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine) world.getTileEntity(pos); if (machine != null) { @@ -86,7 +86,7 @@ public class BlockCoffeeMachine extends BlockContainerBase { } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { int rotation = MathHelper.floor(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; if (rotation == 0) { @@ -106,12 +106,12 @@ public class BlockCoffeeMachine extends BlockContainerBase { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockHorizontal.FACING).getHorizontalIndex(); } @@ -121,12 +121,12 @@ public class BlockCoffeeMachine extends BlockContainerBase { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java index 069ff7d28..89fe6ed20 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import java.util.Random; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase; import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase; @@ -23,22 +21,24 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.oredict.OreDictionary; +import java.util.Random; + public class BlockColoredLamp extends BlockBase { public static final TheColoredLampColors[] ALL_LAMP_TYPES = TheColoredLampColors.values(); @@ -54,21 +54,23 @@ public class BlockColoredLamp extends BlockBase { } @Override - public Item getItemDropped(IBlockState state, Random rand, int par3) { + public Item getItemDropped(BlockState state, Random rand, int par3) { return Item.getItemFromBlock(InitBlocks.blockColoredLamp); } @Override - public int damageDropped(IBlockState state) { + public int damageDropped(BlockState state) { return this.getMetaFromState(state); } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing side, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); //Turning On - if (hand == EnumHand.MAIN_HAND && stack.isEmpty()) { - world.setBlockState(pos, (this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn).getDefaultState().withProperty(TYPE, state.getValue(TYPE)), 2); + if (hand == Hand.MAIN_HAND && stack.isEmpty()) { + world.setBlockState(pos, (this.isOn + ? InitBlocks.blockColoredLamp + : InitBlocks.blockColoredLampOn).getDefaultState().withProperty(TYPE, state.getValue(TYPE)), 2); world.notifyLightSet(pos); return true; } @@ -98,7 +100,7 @@ public class BlockColoredLamp extends BlockBase { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void getSubBlocks(CreativeTabs tab, NonNullList list) { for (int j = 0; j < ALL_LAMP_TYPES.length; j++) { list.add(new ItemStack(this, 1, j)); @@ -106,8 +108,10 @@ public class BlockColoredLamp extends BlockBase { } @Override - public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { - return this.isOn ? 15 : 0; + public int getLightValue(BlockState state, IBlockAccess world, BlockPos pos) { + return this.isOn + ? 15 + : 0; } @Override @@ -128,12 +132,12 @@ public class BlockColoredLamp extends BlockBase { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(TYPE, TheColoredLampColors.values()[meta]); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(TYPE).ordinal(); } @@ -152,9 +156,16 @@ public class BlockColoredLamp extends BlockBase { @Override public String getItemStackDisplayName(ItemStack stack) { - if (stack.getItemDamage() >= ALL_LAMP_TYPES.length) { return StringUtil.BUGGED_ITEM_NAME; } - if (Util.isClient()) return super.getItemStackDisplayName(stack) + (((BlockColoredLamp) this.block).isOn ? " (" + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".onSuffix.desc") + ")" : ""); - else return super.getItemStackDisplayName(stack); + if (stack.getItemDamage() >= ALL_LAMP_TYPES.length) { + return StringUtil.BUGGED_ITEM_NAME; + } + if (Util.isClient()) { + return super.getItemStackDisplayName(stack) + (((BlockColoredLamp) this.block).isOn + ? " (" + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".onSuffix.desc") + ")" + : ""); + } else { + return super.getItemStackDisplayName(stack); + } } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java index 2094afb8e..961104e8d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java @@ -10,10 +10,6 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import java.util.List; - -import org.apache.commons.lang3.tuple.Pair; - import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost; @@ -25,17 +21,17 @@ import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; @@ -46,7 +42,10 @@ import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; +import org.apache.commons.lang3.tuple.Pair; + +import java.util.List; public class BlockCompost extends BlockContainerBase implements IHudDisplay { @@ -66,32 +65,32 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return AABB; } @Override @Deprecated - public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List collidingBoxes, Entity entityIn, boolean someBool) { - addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_LEGS); - addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST); - addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_NORTH); - addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_EAST); - addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_SOUTH); + public void addCollisionBoxToList(BlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List collidingBoxes, Entity entityIn, boolean someBool) { + this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_LEGS); + this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST); + this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_NORTH); + this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_EAST); + this.addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_SOUTH); } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing f6, float f7, float f8, float f9) { ItemStack stackPlayer = player.getHeldItem(hand); if (!world.isRemote) { TileEntity tile = world.getTileEntity(pos); @@ -158,8 +157,8 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay { } @Override - @SideOnly(Side.CLIENT) - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { + @OnlyIn(Dist.CLIENT) + public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos()); if (tile instanceof TileEntityCompost) { ItemStack slot = ((TileEntityCompost) tile).inv.getStackInSlot(0); @@ -177,11 +176,11 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay { @Override protected BlockStateContainer createBlockState() { - return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] { COMPOST_PROP }); + return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{COMPOST_PROP}); } @Override - public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { + public BlockState getExtendedState(BlockState state, IBlockAccess world, BlockPos pos) { TileEntity te = world.getTileEntity(pos); if (te instanceof TileEntityCompost && state instanceof IExtendedBlockState) { TileEntityCompost compost = (TileEntityCompost) te; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java index 63db25a41..d77296a65 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java @@ -19,14 +19,14 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraftforge.common.IRarity; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class BlockCrystal extends BlockBase { @@ -44,12 +44,12 @@ public class BlockCrystal extends BlockBase { } @Override - public int damageDropped(IBlockState state) { + public int damageDropped(BlockState state) { return this.getMetaFromState(state); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void getSubBlocks(CreativeTabs tab, NonNullList list) { for (int j = 0; j < ALL_CRYSTALS.length; j++) { list.add(new ItemStack(this, 1, j)); @@ -69,12 +69,12 @@ public class BlockCrystal extends BlockBase { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(TYPE, TheCrystals.values()[meta]); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(TYPE).ordinal(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java index 7579e7717..5c59c8294 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java @@ -24,11 +24,11 @@ import net.minecraft.block.BlockDirectional; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -40,7 +40,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlock, IColorProvidingItem { @@ -58,17 +58,17 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base) { + public BlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base) { return this.getStateFromMeta(side.ordinal()); } @@ -78,12 +78,12 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockDirectional.FACING).getIndex(); } @@ -93,17 +93,17 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING))); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IBlockColor getBlockColor() { return (state, world, pos, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor; } @@ -114,23 +114,23 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IItemColor getItemColor() { return (stack, tintIndex) -> BlockCrystalCluster.this.crystal.clusterColor; } @Override - public Item getItemDropped(IBlockState state, Random rand, int fortune) { + public Item getItemDropped(BlockState state, Random rand, int fortune) { return InitItems.itemCrystalShard; } @Override - public int damageDropped(IBlockState state) { + public int damageDropped(BlockState state) { return ArrayUtils.indexOf(WorldGenLushCaves.CRYSTAL_CLUSTERS, this); } @Override - public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { + public ItemStack getPickBlock(BlockState state, RayTraceResult target, World world, BlockPos pos, PlayerEntity player) { return new ItemStack(this); } @@ -140,7 +140,7 @@ public class BlockCrystalCluster extends BlockBase implements IColorProvidingBlo } @Override - public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) { + public boolean canSilkHarvest(World world, BlockPos pos, BlockState state, PlayerEntity player) { return true; } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java index 81f3ca8a4..08c4fe6fd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java @@ -18,14 +18,14 @@ import net.minecraft.block.BlockDirectional; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; @@ -47,8 +47,10 @@ public class BlockDirectionalBreaker extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { - if (this.tryToggleRedstone(world, pos, player)) { return true; } + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { + if (this.tryToggleRedstone(world, pos, player)) { + return true; + } if (!world.isRemote) { TileEntityDirectionalBreaker breaker = (TileEntityDirectionalBreaker) world.getTileEntity(pos); if (breaker != null) { @@ -65,7 +67,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase { } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal(); world.setBlockState(pos, this.getStateFromMeta(rotation), 2); @@ -73,12 +75,12 @@ public class BlockDirectionalBreaker extends BlockContainerBase { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockDirectional.FACING).getIndex(); } @@ -88,12 +90,12 @@ public class BlockDirectionalBreaker extends BlockContainerBase { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java index 4b4eaa83a..b383ae235 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java @@ -17,13 +17,13 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; @@ -46,12 +46,12 @@ public class BlockDisplayStand extends BlockContainerBase { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return BlockSlabs.AABB_BOTTOM_HALF; } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { ItemStack heldItem = player.getHeldItem(hand); if (!world.isRemote) { TileEntityDisplayStand stand = (TileEntityDisplayStand) world.getTileEntity(pos); @@ -62,7 +62,9 @@ public class BlockDisplayStand extends BlockContainerBase { ItemStack toPut = heldItem.copy(); toPut.setCount(1); stand.inv.setStackInSlot(0, toPut); - if (!player.capabilities.isCreativeMode) heldItem.shrink(1); + if (!player.capabilities.isCreativeMode) { + heldItem.shrink(1); + } return true; } else if (ItemUtil.canBeStacked(heldItem, display)) { int maxTransfer = Math.min(display.getCount(), heldItem.getMaxStackSize() - heldItem.getCount()); @@ -89,18 +91,20 @@ public class BlockDisplayStand extends BlockContainerBase { } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing face) { - if (face == EnumFacing.DOWN) return BlockFaceShape.SOLID; + public BlockFaceShape getBlockFaceShape(IBlockAccess world, BlockState state, BlockPos pos, EnumFacing face) { + if (face == EnumFacing.DOWN) { + return BlockFaceShape.SOLID; + } return BlockFaceShape.UNDEFINED; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java index f03a4f159..4f1582d42 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java @@ -18,14 +18,14 @@ import net.minecraft.block.BlockDirectional; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; @@ -47,8 +47,10 @@ public class BlockDropper extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { - if (this.tryToggleRedstone(world, pos, player)) { return true; } + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { + if (this.tryToggleRedstone(world, pos, player)) { + return true; + } if (!world.isRemote) { TileEntityDropper dropper = (TileEntityDropper) world.getTileEntity(pos); if (dropper != null) { @@ -65,7 +67,7 @@ public class BlockDropper extends BlockContainerBase { } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal(); world.setBlockState(pos, this.getStateFromMeta(rotation), 2); @@ -73,12 +75,12 @@ public class BlockDropper extends BlockContainerBase { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockDirectional.FACING).getIndex(); } @@ -88,12 +90,12 @@ public class BlockDropper extends BlockContainerBase { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEmpowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEmpowerer.java index 4d4c8dba2..d76e84c23 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEmpowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEmpowerer.java @@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; @@ -45,12 +45,12 @@ public class BlockEmpowerer extends BlockContainerBase { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return BlockSlabs.AABB_BOTTOM_HALF; } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { ItemStack heldItem = player.getHeldItem(hand); if (!world.isRemote) { TileEntityEmpowerer empowerer = (TileEntityEmpowerer) world.getTileEntity(pos); @@ -61,7 +61,9 @@ public class BlockEmpowerer extends BlockContainerBase { ItemStack toPut = heldItem.copy(); toPut.setCount(1); empowerer.inv.setStackInSlot(0, toPut); - if (!player.capabilities.isCreativeMode) heldItem.shrink(1); + if (!player.capabilities.isCreativeMode) { + heldItem.shrink(1); + } return true; } else if (ItemUtil.canBeStacked(heldItem, stackThere)) { int maxTransfer = Math.min(stackThere.getCount(), heldItem.getMaxStackSize() - heldItem.getCount()); @@ -88,7 +90,7 @@ public class BlockEmpowerer extends BlockContainerBase { } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java index 13464a703..86109c7cd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java @@ -17,13 +17,13 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -42,11 +42,13 @@ public class BlockEnergizer extends BlockContainerBase { @Override public TileEntity createNewTileEntity(World world, int par2) { - return this.isEnergizer ? new TileEntityEnergizer() : new TileEntityEnervator(); + return this.isEnergizer + ? new TileEntityEnergizer() + : new TileEntityEnervator(); } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { if (this.isEnergizer) { TileEntityEnergizer energizer = (TileEntityEnergizer) world.getTileEntity(pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java index 991d50970..c96edc705 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java @@ -18,14 +18,14 @@ import net.minecraft.block.BlockHorizontal; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; @@ -47,7 +47,7 @@ public class BlockFarmer extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { TileEntityFarmer farmer = (TileEntityFarmer) world.getTileEntity(pos); if (farmer != null) { @@ -64,19 +64,19 @@ public class BlockFarmer extends BlockContainerBase { } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2); super.onBlockPlacedBy(world, pos, state, player, stack); } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockHorizontal.FACING).getHorizontalIndex(); } @@ -86,12 +86,12 @@ public class BlockFarmer extends BlockContainerBase { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java index 525bdd781..922b29cc5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java @@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -42,7 +42,7 @@ public class BlockFeeder extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { TileEntityFeeder feeder = (TileEntityFeeder) world.getTileEntity(pos); if (feeder != null) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java index 925f3cd4e..c7bb449a1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java @@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -37,12 +37,12 @@ public class BlockFermentingBarrel extends BlockContainerBase { } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @@ -52,7 +52,7 @@ public class BlockFermentingBarrel extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { TileEntityFermentingBarrel press = (TileEntityFermentingBarrel) world.getTileEntity(pos); if (press != null) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java index 9c01f5ced..8c095d22a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java @@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -37,7 +37,7 @@ public class BlockFireworkBox extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (this.tryToggleRedstone(world, pos, player)) { return true; } else if (!world.isRemote) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java index a7ee0d164..63494c662 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFishingNet; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -36,7 +36,7 @@ public class BlockFishingNet extends BlockContainerBase { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return AABB; } @@ -46,12 +46,12 @@ public class BlockFishingNet extends BlockContainerBase { } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java index 45e343c0c..080d7a7f0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java @@ -19,14 +19,14 @@ import net.minecraft.block.BlockDirectional; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; @@ -47,12 +47,16 @@ public class BlockFluidCollector extends BlockContainerBase { @Override public TileEntity createNewTileEntity(World world, int par2) { - return this.isPlacer ? new TileEntityFluidPlacer() : new TileEntityFluidCollector(); + return this.isPlacer + ? new TileEntityFluidPlacer() + : new TileEntityFluidCollector(); } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { - if (this.tryToggleRedstone(world, pos, player)) { return true; } + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { + if (this.tryToggleRedstone(world, pos, player)) { + return true; + } if (!world.isRemote) { TileEntityFluidCollector collector = (TileEntityFluidCollector) world.getTileEntity(pos); if (collector != null) { @@ -71,7 +75,7 @@ public class BlockFluidCollector extends BlockContainerBase { } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal(); world.setBlockState(pos, this.getStateFromMeta(rotation), 2); @@ -79,12 +83,12 @@ public class BlockFluidCollector extends BlockContainerBase { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockDirectional.FACING).getIndex(); } @@ -94,12 +98,12 @@ public class BlockFluidCollector extends BlockContainerBase { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java index fcf5f7749..6d52eafe3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java @@ -10,9 +10,6 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import java.util.List; -import java.util.Random; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase; @@ -25,24 +22,23 @@ import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.Mirror; -import net.minecraft.util.Rotation; +import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import java.util.List; +import java.util.Random; public class BlockFurnaceDouble extends BlockContainerBase { @@ -63,8 +59,8 @@ public class BlockFurnaceDouble extends BlockContainerBase { } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) { + @OnlyIn(Dist.CLIENT) + public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) { if (state.getValue(IS_ON)) { for (int i = 0; i < 5; i++) { world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double) pos.getX() + 0.5F, (double) pos.getY() + 1.0F, (double) pos.getZ() + 0.5F, 0.0D, 0.0D, 0.0D); @@ -73,7 +69,7 @@ public class BlockFurnaceDouble extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble) world.getTileEntity(pos); if (furnace != null) { @@ -85,8 +81,10 @@ public class BlockFurnaceDouble extends BlockContainerBase { } @Override - public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { - return state.getValue(IS_ON) ? 12 : 0; + public int getLightValue(BlockState state, IBlockAccess world, BlockPos pos) { + return state.getValue(IS_ON) + ? 12 + : 0; } @Override @@ -95,23 +93,27 @@ public class BlockFurnaceDouble extends BlockContainerBase { } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2); super.onBlockPlacedBy(world, pos, state, player, stack); } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { boolean isOn = meta >= 4; - EnumFacing facing = EnumFacing.byHorizontalIndex(isOn ? meta - 4 : meta); + EnumFacing facing = EnumFacing.byHorizontalIndex(isOn + ? meta - 4 + : meta); return this.getDefaultState().withProperty(BlockHorizontal.FACING, facing).withProperty(IS_ON, isOn); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { int meta = state.getValue(BlockHorizontal.FACING).getHorizontalIndex(); - return state.getValue(IS_ON) ? meta + 4 : meta; + return state.getValue(IS_ON) + ? meta + 4 + : meta; } @Override @@ -120,12 +122,12 @@ public class BlockFurnaceDouble extends BlockContainerBase { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING))); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java index 1a2be9d5c..11bcc36f7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceSolar; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -36,7 +36,7 @@ public class BlockFurnaceSolar extends BlockContainerBase { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return AABB; } @@ -46,12 +46,12 @@ public class BlockFurnaceSolar extends BlockContainerBase { } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java index 76b8205c7..e6a20a913 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase; @@ -27,17 +25,17 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextFormatting; @@ -45,6 +43,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.items.IItemHandlerModifiable; +import java.util.List; + public class BlockGiantChest extends BlockContainerBase { public final int type; @@ -63,27 +63,27 @@ public class BlockGiantChest extends BlockContainerBase { @Override public TileEntity createNewTileEntity(World world, int par2) { switch (this.type) { - case 1: - return new TileEntityGiantChestMedium(); - case 2: - return new TileEntityGiantChestLarge(); - default: - return new TileEntityGiantChest(); + case 1: + return new TileEntityGiantChestMedium(); + case 2: + return new TileEntityGiantChestLarge(); + default: + return new TileEntityGiantChest(); } } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { TileEntityGiantChest chest = (TileEntityGiantChest) world.getTileEntity(pos); if (chest != null) { @@ -101,17 +101,17 @@ public class BlockGiantChest extends BlockContainerBase { } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase entity, ItemStack stack) { if (stack.getTagCompound() != null) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityGiantChest) { - NBTTagList list = stack.getTagCompound().getTagList("Items", 10); + ListNBT list = stack.getTagCompound().getList("Items", 10); IItemHandlerModifiable inv = ((TileEntityGiantChest) tile).inv; - for (int i = 0; i < list.tagCount(); i++) { - NBTTagCompound compound = list.getCompoundTagAt(i); + for (int i = 0; i < list.size(); i++) { + CompoundNBT compound = list.getCompound(i); if (compound != null && compound.hasKey("id")) { - inv.setStackInSlot(i, new ItemStack(list.getCompoundTagAt(i))); + inv.setStackInSlot(i, new ItemStack(list.getCompound(i))); } } } @@ -121,18 +121,18 @@ public class BlockGiantChest extends BlockContainerBase { } @Override - public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { + public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) { super.getDrops(drops, world, pos, state, fortune); TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityGiantChest) { ItemStackHandlerAA slots = ((TileEntityGiantChest) tile).inv; int place = ItemUtil.getPlaceAt(slots.getItems(), new ItemStack(InitItems.itemCrateKeeper), false); if (place >= 0) { - NBTTagList list = new NBTTagList(); + ListNBT list = new ListNBT(); for (int i = 0; i < slots.getSlots(); i++) { //Destroy the keeper if (i != place) { - NBTTagCompound compound = new NBTTagCompound(); + CompoundNBT compound = new CompoundNBT(); if (StackUtil.isValid(slots.getStackInSlot(i))) { slots.getStackInSlot(i).writeToNBT(compound); } @@ -140,11 +140,11 @@ public class BlockGiantChest extends BlockContainerBase { } } - if (list.tagCount() > 0) { + if (list.size() > 0) { ItemStack stackInQuestion = drops.get(0); if (StackUtil.isValid(stackInQuestion)) { if (stackInQuestion.getTagCompound() == null) { - stackInQuestion.setTagCompound(new NBTTagCompound()); + stackInQuestion.setTagCompound(new CompoundNBT()); } stackInQuestion.getTagCompound().setTag("Items", list); } @@ -172,7 +172,9 @@ public class BlockGiantChest extends BlockContainerBase { @Override public void addInformation(ItemStack stack, World playerIn, List tooltip, ITooltipFlag advanced) { - int type = this.block instanceof BlockGiantChest ? ((BlockGiantChest) this.block).type : -1; + int type = this.block instanceof BlockGiantChest + ? ((BlockGiantChest) this.block).type + : -1; if (type == 2) { tooltip.add(TextFormatting.ITALIC + StringUtil.localize("container." + ActuallyAdditions.MODID + ".giantChestLarge.desc")); } else if (type == 0) { @@ -181,7 +183,7 @@ public class BlockGiantChest extends BlockContainerBase { } @Override - public NBTTagCompound getNBTShareTag(ItemStack stack) { + public CompoundNBT getNBTShareTag(ItemStack stack) { return null; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java index c1b6abfa4..99eb56fa3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java @@ -19,7 +19,7 @@ import net.minecraft.block.Block; import net.minecraft.block.IGrowable; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; @@ -28,7 +28,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class BlockGreenhouseGlass extends BlockBase { @@ -42,25 +42,25 @@ public class BlockGreenhouseGlass extends BlockBase { } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public int getLightOpacity(IBlockState state) { + public int getLightOpacity(BlockState state) { return 0; } @Override @Deprecated - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { - IBlockState otherState = world.getBlockState(pos.offset(side)); + @OnlyIn(Dist.CLIENT) + public boolean shouldSideBeRendered(BlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { + BlockState otherState = world.getBlockState(pos.offset(side)); Block block = otherState.getBlock(); return state != otherState || block != this && super.shouldSideBeRendered(state, world, pos, side); @@ -78,13 +78,13 @@ public class BlockGreenhouseGlass extends BlockBase { } @Override - public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { + public void updateTick(World world, BlockPos pos, BlockState state, Random rand) { if (world.isRemote) return; if (world.canBlockSeeSky(pos) && world.isDaytime()) { - Triple trip = firstBlock(world, pos); + Triple trip = firstBlock(world, pos); boolean once = false; if (trip != null) for (int i = 0; i < 3; i++) { - IBlockState growState = i == 0 ? trip.getMiddle() : world.getBlockState(trip.getLeft()); + BlockState growState = i == 0 ? trip.getMiddle() : world.getBlockState(trip.getLeft()); if (growState.getBlock() == trip.getRight() && trip.getRight().canGrow(world, trip.getLeft(), growState, false)) { trip.getRight().grow(world, rand, trip.getLeft(), growState); once = true; @@ -94,12 +94,12 @@ public class BlockGreenhouseGlass extends BlockBase { } } - public Triple firstBlock(World world, BlockPos glassPos) { + public Triple firstBlock(World world, BlockPos glassPos) { BlockPos.MutableBlockPos mut = new BlockPos.MutableBlockPos(glassPos); while (true) { mut.setPos(mut.getX(), mut.getY() - 1, mut.getZ()); if (mut.getY() < 0) return null; - IBlockState state = world.getBlockState(mut); + BlockState state = world.getBlockState(mut); if (state.isOpaqueCube() || state.getBlock() instanceof IGrowable || state.getBlock() == this) { if (state.getBlock() instanceof IGrowable) return Triple.of(mut.toImmutable(), state, (IGrowable) state.getBlock()); else return null; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java index 86877e50c..32598c77b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import java.util.Random; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; @@ -20,19 +18,21 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinderDouble; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import java.util.Random; public class BlockGrinder extends BlockContainerBase { @@ -50,12 +50,14 @@ public class BlockGrinder extends BlockContainerBase { @Override public TileEntity createNewTileEntity(World world, int par2) { - return this.isDouble ? new TileEntityGrinderDouble() : new TileEntityGrinder(); + return this.isDouble + ? new TileEntityGrinderDouble() + : new TileEntityGrinder(); } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) { + @OnlyIn(Dist.CLIENT) + public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) { if (state.getValue(BlockFurnaceDouble.IS_ON)) { for (int i = 0; i < 5; i++) { double xRand = rand.nextDouble() / 0.75D - 0.5D; @@ -67,11 +69,13 @@ public class BlockGrinder extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { TileEntityGrinder grinder = (TileEntityGrinder) world.getTileEntity(pos); if (grinder != null) { - player.openGui(ActuallyAdditions.INSTANCE, this.isDouble ? GuiHandler.GuiTypes.GRINDER_DOUBLE.ordinal() : GuiHandler.GuiTypes.GRINDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); + player.openGui(ActuallyAdditions.INSTANCE, this.isDouble + ? GuiHandler.GuiTypes.GRINDER_DOUBLE.ordinal() + : GuiHandler.GuiTypes.GRINDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); } return true; } @@ -79,12 +83,14 @@ public class BlockGrinder extends BlockContainerBase { } @Override - public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { - return this.getMetaFromState(state) == 1 ? 12 : 0; + public int getLightValue(BlockState state, IBlockAccess world, BlockPos pos) { + return this.getMetaFromState(state) == 1 + ? 12 + : 0; } @Override - public int damageDropped(IBlockState state) { + public int damageDropped(BlockState state) { return 0; } @@ -94,14 +100,16 @@ public class BlockGrinder extends BlockContainerBase { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { boolean isOn = meta == 1; return this.getDefaultState().withProperty(BlockFurnaceDouble.IS_ON, isOn); } @Override - public int getMetaFromState(IBlockState state) { - return state.getValue(BlockFurnaceDouble.IS_ON) ? 1 : 0; + public int getMetaFromState(BlockState state) { + return state.getValue(BlockFurnaceDouble.IS_ON) + ? 1 + : 0; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java index 835db5e1f..32ec60ffd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import java.util.Random; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase; @@ -23,16 +21,18 @@ import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import java.util.Random; + public class BlockInputter extends BlockContainerBase { public static final int NAME_FLAVOR_AMOUNTS = 15; @@ -51,15 +51,19 @@ public class BlockInputter extends BlockContainerBase { @Override public TileEntity createNewTileEntity(World world, int par2) { - return this.isAdvanced ? new TileEntityInputterAdvanced() : new TileEntityInputter(); + return this.isAdvanced + ? new TileEntityInputterAdvanced() + : new TileEntityInputter(); } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { TileEntityInputter inputter = (TileEntityInputter) world.getTileEntity(pos); if (inputter != null) { - player.openGui(ActuallyAdditions.INSTANCE, this.isAdvanced ? GuiHandler.GuiTypes.INPUTTER_ADVANCED.ordinal() : GuiHandler.GuiTypes.INPUTTER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); + player.openGui(ActuallyAdditions.INSTANCE, this.isAdvanced + ? GuiHandler.GuiTypes.INPUTTER_ADVANCED.ordinal() + : GuiHandler.GuiTypes.INPUTTER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); } return true; } @@ -109,7 +113,9 @@ public class BlockInputter extends BlockContainerBase { } return StringUtil.localize(this.getTranslationKey() + ".name") + " (" + StringUtil.localize("tile." + ActuallyAdditions.MODID + ".block_inputter.add." + this.toPick + ".name") + ")"; - } else return super.getItemStackDisplayName(stack); + } else { + return super.getItemStackDisplayName(stack); + } } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemRepairer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemRepairer.java index 23201504f..07149b021 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemRepairer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemRepairer.java @@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -44,7 +44,7 @@ public class BlockItemRepairer extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { TileEntityItemRepairer repairer = (TileEntityItemRepairer) world.getTileEntity(pos); if (repairer != null) { @@ -56,8 +56,10 @@ public class BlockItemRepairer extends BlockContainerBase { } @Override - public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { - return this.getMetaFromState(state) == 1 ? 12 : 0; + public int getLightValue(BlockState state, IBlockAccess world, BlockPos pos) { + return this.getMetaFromState(state) == 1 + ? 12 + : 0; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java index fbd86a2f1..6373194d7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java @@ -15,7 +15,7 @@ import java.util.List; import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewerHopping; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.tileentity.TileEntity; @@ -28,7 +28,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; //Most of this is just copied from BlockHopper, no credit taken. Or clue what it is. public class BlockItemViewerHopping extends BlockItemViewer { @@ -46,13 +46,13 @@ public class BlockItemViewerHopping extends BlockItemViewer { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return FULL_BLOCK_AABB; } @Override @Deprecated - public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List collidingBoxes, Entity entityIn, boolean someBool) { + public void addCollisionBoxToList(BlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List collidingBoxes, Entity entityIn, boolean someBool) { addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB); addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB); addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB); @@ -66,29 +66,29 @@ public class BlockItemViewerHopping extends BlockItemViewer { } @Override - public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { + public BlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { EnumFacing opp = facing.getOpposite(); return this.getDefaultState().withProperty(FACING, opp == EnumFacing.UP ? EnumFacing.DOWN : opp); } @Override //was isFullyOpaque, not sure if correct change. - public boolean isNormalCube(IBlockState state) { + public boolean isNormalCube(BlockState state) { return true; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { + @OnlyIn(Dist.CLIENT) + public boolean shouldSideBeRendered(BlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { return true; } @@ -98,12 +98,12 @@ public class BlockItemViewerHopping extends BlockItemViewer { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(FACING).getIndex(); } @@ -113,12 +113,12 @@ public class BlockItemViewerHopping extends BlockItemViewer { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(FACING, rot.rotate(state.getValue(FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(FACING))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java index 188b736c9..a1a795c0e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java @@ -20,7 +20,7 @@ import net.minecraft.block.BlockDirectional; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -41,17 +41,17 @@ public class BlockLampPowerer extends BlockBase { } @Override - public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) { + public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) { this.updateLamp(worldIn, pos); } @Override - public void onBlockAdded(World world, BlockPos pos, IBlockState state) { + public void onBlockAdded(World world, BlockPos pos, BlockState state) { this.updateLamp(world, pos); } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { int rotation = EnumFacing.getDirectionFromEntityLiving(pos, player).ordinal(); world.setBlockState(pos, this.getStateFromMeta(rotation), 2); @@ -60,14 +60,14 @@ public class BlockLampPowerer extends BlockBase { private void updateLamp(World world, BlockPos pos) { if (!world.isRemote) { - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state)); this.updateLampsAtPos(world, coords, world.getRedstonePowerFromNeighbors(pos) > 0, new ArrayList()); } } private void updateLampsAtPos(World world, BlockPos pos, boolean powered, List updatedAlready) { - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); Block block = state.getBlock(); if (block instanceof BlockColoredLamp) { boolean isOn = ((BlockColoredLamp) block).isOn; @@ -101,12 +101,12 @@ public class BlockLampPowerer extends BlockBase { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockDirectional.FACING).getIndex(); } @@ -116,12 +116,12 @@ public class BlockLampPowerer extends BlockBase { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java index 847de97a2..c52de9cf8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java @@ -19,13 +19,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles; import de.ellpeck.actuallyadditions.mod.items.ItemLaserRelayUpgrade; import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyAdvanced; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyExtreme; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayFluids; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItem; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist; +import de.ellpeck.actuallyadditions.mod.tile.*; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.block.BlockDirectional; @@ -33,16 +27,16 @@ import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.AxisAlignedBB; @@ -56,7 +50,7 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay { @@ -87,13 +81,13 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay { @SubscribeEvent public void onBlockRightClick(PlayerInteractEvent.RightClickBlock event) { - EntityPlayer player = event.getEntityPlayer(); + PlayerEntity player = event.getEntityPlayer(); World world = event.getWorld(); ItemStack stack = event.getItemStack(); BlockPos pos = event.getPos(); if (player != null && world != null && StackUtil.isValid(stack) && pos != null) { - IBlockState state = event.getWorld().getBlockState(pos); + BlockState state = event.getWorld().getBlockState(pos); if (state != null && state.getBlock() instanceof BlockLaserRelay) { if (player.isSneaking()) { event.setUseBlock(Event.Result.ALLOW); @@ -103,35 +97,35 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { switch (this.getMetaFromState(state)) { - case 1: - return AABB_UP; - case 2: - return AABB_NORTH; - case 3: - return AABB_SOUTH; - case 4: - return AABB_WEST; - case 5: - return AABB_EAST; - default: - return AABB_DOWN; + case 1: + return AABB_UP; + case 2: + return AABB_NORTH; + case 3: + return AABB_SOUTH; + case 4: + return AABB_WEST; + case 5: + return AABB_EAST; + default: + return AABB_DOWN; } } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base) { + public BlockState getStateForPlacement(World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, int meta, EntityLivingBase base) { return this.getStateFromMeta(side.ordinal()); } @@ -141,12 +135,12 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.byIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockDirectional.FACING).getIndex(); } @@ -156,17 +150,17 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING))); } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { ItemStack stack = player.getHeldItem(hand); TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityLaserRelay) { @@ -234,24 +228,24 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay { @Override public TileEntity createNewTileEntity(World world, int i) { switch (this.type) { - case ITEM: - return new TileEntityLaserRelayItem(); - case ITEM_WHITELIST: - return new TileEntityLaserRelayItemWhitelist(); - case ENERGY_ADVANCED: - return new TileEntityLaserRelayEnergyAdvanced(); - case ENERGY_EXTREME: - return new TileEntityLaserRelayEnergyExtreme(); - case FLUIDS: - return new TileEntityLaserRelayFluids(); - default: - return new TileEntityLaserRelayEnergy(); + case ITEM: + return new TileEntityLaserRelayItem(); + case ITEM_WHITELIST: + return new TileEntityLaserRelayItemWhitelist(); + case ENERGY_ADVANCED: + return new TileEntityLaserRelayEnergyAdvanced(); + case ENERGY_EXTREME: + return new TileEntityLaserRelayEnergyExtreme(); + case FLUIDS: + return new TileEntityLaserRelayFluids(); + default: + return new TileEntityLaserRelayEnergy(); } } @Override - @SideOnly(Side.CLIENT) - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { + @OnlyIn(Dist.CLIENT) + public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { if (posHit != null && posHit.getBlockPos() != null && minecraft.world != null) { boolean wearing = ItemEngineerGoggles.isWearing(player); if (wearing || StackUtil.isValid(stack)) { @@ -279,14 +273,14 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay { } @Override - public void breakBlock(World world, BlockPos pos, IBlockState state) { + public void breakBlock(World world, BlockPos pos, BlockState state) { super.breakBlock(world, pos, state); ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pos, world); } @Override - public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, EnumFacing face) { return BlockFaceShape.UNDEFINED; } @@ -298,4 +292,4 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay { ITEM, ITEM_WHITELIST } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java index 9f845eddf..e4f00d81c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java @@ -18,14 +18,14 @@ import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay { @@ -48,8 +48,8 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IH } @Override - @SideOnly(Side.CLIENT) - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { + @OnlyIn(Dist.CLIENT) + public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController) minecraft.world.getTileEntity(posHit.getBlockPos()); if (factory != null) { int state = factory.isMultiblock(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java index eeddbd8e3..7482d9a71 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java @@ -17,20 +17,20 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class BlockMiner extends BlockContainerBase implements IHudDisplay { @@ -43,12 +43,12 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay { } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityMiner) { @@ -69,13 +69,17 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay { } @Override - @SideOnly(Side.CLIENT) - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { + @OnlyIn(Dist.CLIENT) + public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos()); if (tile instanceof TileEntityMiner) { TileEntityMiner miner = (TileEntityMiner) tile; - String info = miner.checkY == 0 ? "Done Mining!" : miner.checkY == -1 ? "Calculating positions..." : "Mining at " + (miner.getPos().getX() + miner.checkX) + ", " + miner.checkY + ", " + (miner.getPos().getZ() + miner.checkZ) + "."; + String info = miner.checkY == 0 + ? "Done Mining!" + : miner.checkY == -1 + ? "Calculating positions..." + : "Mining at " + (miner.getPos().getX() + miner.checkX) + ", " + miner.checkY + ", " + (miner.getPos().getZ() + miner.checkZ) + "."; minecraft.fontRenderer.drawStringWithShadow(info, resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 - 20, StringUtil.DECIMAL_COLOR_WHITE); } } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java index 6d5173b11..e30438e66 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java @@ -19,7 +19,7 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -38,7 +38,7 @@ public class BlockMisc extends BlockBase { } @Override - public int damageDropped(IBlockState state) { + public int damageDropped(BlockState state) { return this.getMetaFromState(state); } @@ -67,12 +67,12 @@ public class BlockMisc extends BlockBase { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(TYPE, TheMiscBlocks.values()[meta]); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(TYPE).ordinal(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java index 627c78098..3ca1dac2d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import java.util.Random; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; @@ -20,21 +18,19 @@ import net.minecraft.block.BlockHorizontal; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.Mirror; -import net.minecraft.util.Rotation; +import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import java.util.Random; public class BlockOilGenerator extends BlockContainerBase { @@ -48,12 +44,12 @@ public class BlockOilGenerator extends BlockContainerBase { } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @@ -63,8 +59,8 @@ public class BlockOilGenerator extends BlockContainerBase { } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) { + @OnlyIn(Dist.CLIENT) + public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityOilGenerator) { if (((TileEntityOilGenerator) tile).currentBurnTime > 0) { @@ -76,7 +72,7 @@ public class BlockOilGenerator extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { TileEntityOilGenerator generator = (TileEntityOilGenerator) world.getTileEntity(pos); if (generator != null) { @@ -90,7 +86,7 @@ public class BlockOilGenerator extends BlockContainerBase { } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2); super.onBlockPlacedBy(world, pos, state, player, stack); @@ -102,12 +98,12 @@ public class BlockOilGenerator extends BlockContainerBase { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockHorizontal.FACING).getHorizontalIndex(); } @@ -117,12 +113,12 @@ public class BlockOilGenerator extends BlockContainerBase { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java index ac75396c7..c88b566fa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java @@ -13,26 +13,21 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.api.tile.IPhantomTile; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBreaker; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomEnergyface; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomItemface; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomLiquiface; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomRedstoneface; +import de.ellpeck.actuallyadditions.mod.tile.*; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; @@ -41,7 +36,7 @@ import net.minecraft.util.text.TextFormatting; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class BlockPhantom extends BlockContainerBase implements IHudDisplay { @@ -57,24 +52,28 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { } @Override - public boolean canProvidePower(IBlockState state) { + public boolean canProvidePower(BlockState state) { return this.type == Type.REDSTONEFACE; } @Override - public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { + public int getWeakPower(BlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { if (this.type == Type.REDSTONEFACE) { TileEntity tile = world.getTileEntity(pos); - if (tile instanceof TileEntityPhantomRedstoneface) { return ((TileEntityPhantomRedstoneface) tile).providesWeak[side.ordinal()]; } + if (tile instanceof TileEntityPhantomRedstoneface) { + return ((TileEntityPhantomRedstoneface) tile).providesWeak[side.ordinal()]; + } } return 0; } @Override - public int getStrongPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { + public int getStrongPower(BlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { if (this.type == Type.REDSTONEFACE) { TileEntity tile = world.getTileEntity(pos); - if (tile instanceof TileEntityPhantomRedstoneface) { return ((TileEntityPhantomRedstoneface) tile).providesStrong[side.ordinal()]; } + if (tile instanceof TileEntityPhantomRedstoneface) { + return ((TileEntityPhantomRedstoneface) tile).providesStrong[side.ordinal()]; + } } return 0; } @@ -87,24 +86,26 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { @Override public TileEntity createNewTileEntity(World world, int par2) { switch (this.type) { - case PLACER: - return new TileEntityPhantomPlacer(); - case BREAKER: - return new TileEntityPhantomBreaker(); - case LIQUIFACE: - return new TileEntityPhantomLiquiface(); - case ENERGYFACE: - return new TileEntityPhantomEnergyface(); - case REDSTONEFACE: - return new TileEntityPhantomRedstoneface(); - default: - return new TileEntityPhantomItemface(); + case PLACER: + return new TileEntityPhantomPlacer(); + case BREAKER: + return new TileEntityPhantomBreaker(); + case LIQUIFACE: + return new TileEntityPhantomLiquiface(); + case ENERGYFACE: + return new TileEntityPhantomEnergyface(); + case REDSTONEFACE: + return new TileEntityPhantomRedstoneface(); + default: + return new TileEntityPhantomItemface(); } } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { - if (this.tryToggleRedstone(world, pos, player)) { return true; } + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing side, float hitX, float hitY, float hitZ) { + if (this.tryToggleRedstone(world, pos, player)) { + return true; + } if (!world.isRemote) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof IPhantomTile && ((IPhantomTile) tile).getGuiID() != -1) { @@ -120,8 +121,8 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { } @Override - @SideOnly(Side.CLIENT) - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { + @OnlyIn(Dist.CLIENT) + public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos()); if (tile != null) { if (tile instanceof IPhantomTile) { @@ -129,10 +130,12 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { minecraft.fontRenderer.drawStringWithShadow(TextFormatting.GOLD + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".blockPhantomRange.desc") + ": " + phantom.getRange(), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 - 40, StringUtil.DECIMAL_COLOR_WHITE); if (phantom.hasBoundPosition()) { int distance = MathHelper.ceil(new Vec3d(posHit.getBlockPos()).distanceTo(new Vec3d(phantom.getBoundPosition()))); - IBlockState state = minecraft.world.getBlockState(phantom.getBoundPosition()); + BlockState state = minecraft.world.getBlockState(phantom.getBoundPosition()); Block block = state.getBlock(); Item item = Item.getItemFromBlock(block); - String name = item == null ? "Something Unrecognizable" : item.getItemStackDisplayName(new ItemStack(block, 1, block.getMetaFromState(state))); + String name = item == null + ? "Something Unrecognizable" + : item.getItemStackDisplayName(new ItemStack(block, 1, block.getMetaFromState(state))); StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localizeFormatted("tooltip." + ActuallyAdditions.MODID + ".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 - 30, 200, StringUtil.DECIMAL_COLOR_WHITE, true); if (phantom.isBoundThingInRange()) { @@ -155,4 +158,4 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { ENERGYFACE, REDSTONEFACE } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java index e025e96b6..3f91d538c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBooster; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -36,17 +36,17 @@ public class BlockPhantomBooster extends BlockContainerBase { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return AABB; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @@ -59,4 +59,4 @@ public class BlockPhantomBooster extends BlockContainerBase { public TileEntity createNewTileEntity(World world, int i) { return new TileEntityPhantomBooster(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java index a39029e2c..e70f63d9b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java @@ -15,11 +15,11 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlayerInterface; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -28,7 +28,7 @@ import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class BlockPlayerInterface extends BlockContainerBase implements IHudDisplay { @@ -51,7 +51,7 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityPlayerInterface) { TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile; @@ -67,8 +67,8 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp } @Override - @SideOnly(Side.CLIENT) - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { + @OnlyIn(Dist.CLIENT) + public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos()); if (tile != null) { if (tile instanceof TileEntityPlayerInterface) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java index b2731cc15..66280ce71 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java @@ -16,13 +16,13 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -42,8 +42,10 @@ public class BlockRangedCollector extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { - if (this.tryToggleRedstone(world, pos, player)) { return true; } + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { + if (this.tryToggleRedstone(world, pos, player)) { + return true; + } if (!world.isRemote) { TileEntityRangedCollector breaker = (TileEntityRangedCollector) world.getTileEntity(pos); if (breaker != null) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java index cae57665b..83fc723dc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java @@ -17,34 +17,34 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.block.SoundType; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class BlockSlabs extends BlockBase { public static final AxisAlignedBB AABB_BOTTOM_HALF = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D); private static final AxisAlignedBB AABB_TOP_HALF = new AxisAlignedBB(0.0D, 0.5D, 0.0D, 1.0D, 1.0D, 1.0D); - private final IBlockState fullBlockState; + private final BlockState fullBlockState; public BlockSlabs(String name, Block fullBlock) { this(name, fullBlock.getDefaultState()); } - public BlockSlabs(String name, IBlockState fullBlockState) { + public BlockSlabs(String name, BlockState fullBlockState) { super(fullBlockState.getMaterial(), name); this.setHardness(1.5F); this.setResistance(10.0F); @@ -52,25 +52,31 @@ public class BlockSlabs extends BlockBase { } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { - if (facing.ordinal() == 1) { return this.getStateFromMeta(meta); } - if (facing.ordinal() == 0 || hitY >= 0.5F) { return this.getStateFromMeta(meta + 1); } + public BlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { + if (facing.ordinal() == 1) { + return this.getStateFromMeta(meta); + } + if (facing.ordinal() == 0 || hitY >= 0.5F) { + return this.getStateFromMeta(meta + 1); + } return this.getStateFromMeta(meta); } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { - return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP ? AABB_TOP_HALF : AABB_BOTTOM_HALF; + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { + return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP + ? AABB_TOP_HALF + : AABB_BOTTOM_HALF; } @Override @@ -84,13 +90,17 @@ public class BlockSlabs extends BlockBase { } @Override - public IBlockState getStateFromMeta(int meta) { - return this.getDefaultState().withProperty(BlockSlab.HALF, meta == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP); + public BlockState getStateFromMeta(int meta) { + return this.getDefaultState().withProperty(BlockSlab.HALF, meta == 0 + ? BlockSlab.EnumBlockHalf.BOTTOM + : BlockSlab.EnumBlockHalf.TOP); } @Override - public int getMetaFromState(IBlockState state) { - return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM ? 0 : 1; + public int getMetaFromState(BlockState state) { + return state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM + ? 0 + : 1; } @Override @@ -107,15 +117,15 @@ public class BlockSlabs extends BlockBase { } @Override - public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); if (StackUtil.isValid(stack) && player.canPlayerEdit(pos.offset(facing), facing, stack)) { - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); if (state.getBlock() == this.block) { BlockSlabs theBlock = (BlockSlabs) this.block; if (facing == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || facing == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP) { - IBlockState newState = theBlock.fullBlockState; + BlockState newState = theBlock.fullBlockState; AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos); if (bound != Block.NULL_AABB && world.checkNoEntityCollision(bound.offset(pos)) && world.setBlockState(pos, newState, 11)) { @@ -128,30 +138,34 @@ public class BlockSlabs extends BlockBase { } } - return this.tryPlace(player, stack, hand, world, pos.offset(facing)) ? EnumActionResult.SUCCESS : super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); + return this.tryPlace(player, stack, hand, world, pos.offset(facing)) + ? EnumActionResult.SUCCESS + : super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); } else { return EnumActionResult.FAIL; } } @Override - @SideOnly(Side.CLIENT) - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) { - IBlockState state = worldIn.getBlockState(pos); + @OnlyIn(Dist.CLIENT) + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, PlayerEntity player, ItemStack stack) { + BlockState state = worldIn.getBlockState(pos); if (state.getBlock() == this.block) { - if (side == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || side == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP) { return true; } + if (side == EnumFacing.UP && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM || side == EnumFacing.DOWN && state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP) { + return true; + } } return worldIn.getBlockState(pos.offset(side)).getBlock() == this.block || super.canPlaceBlockOnSide(worldIn, pos, side, player, stack); } - private boolean tryPlace(EntityPlayer player, ItemStack stack, EnumHand hand, World world, BlockPos pos) { - IBlockState iblockstate = world.getBlockState(pos); + private boolean tryPlace(PlayerEntity player, ItemStack stack, Hand hand, World world, BlockPos pos) { + BlockState iblockstate = world.getBlockState(pos); if (iblockstate.getBlock() == this.block) { BlockSlabs theBlock = (BlockSlabs) this.block; - IBlockState newState = theBlock.fullBlockState; + BlockState newState = theBlock.fullBlockState; AxisAlignedBB bound = newState.getCollisionBoundingBox(world, pos); if (bound != Block.NULL_AABB && world.checkNoEntityCollision(bound.offset(pos)) && world.setBlockState(pos, newState, 11)) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java index fceb06cf8..60ba3cbe1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import java.util.Random; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; @@ -20,21 +18,19 @@ import net.minecraft.block.BlockHorizontal; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.Mirror; -import net.minecraft.util.Rotation; +import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import java.util.Random; public class BlockSmileyCloud extends BlockContainerBase { @@ -47,18 +43,18 @@ public class BlockSmileyCloud extends BlockContainerBase { } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) { + @OnlyIn(Dist.CLIENT) + public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) { if (world.rand.nextInt(30) == 0) { for (int i = 0; i < 2; i++) { double d = world.rand.nextGaussian() * 0.02D; @@ -70,7 +66,7 @@ public class BlockSmileyCloud extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing f6, float f7, float f8, float f9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing f6, float f7, float f8, float f9) { if (!world.isRemote) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntitySmileyCloud) { @@ -93,19 +89,19 @@ public class BlockSmileyCloud extends BlockContainerBase { } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2); super.onBlockPlacedBy(world, pos, state, player, stack); } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockHorizontal.FACING).getHorizontalIndex(); } @@ -115,12 +111,12 @@ public class BlockSmileyCloud extends BlockContainerBase { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java index 8e073169b..9cb661cc4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java @@ -21,7 +21,7 @@ import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; @@ -33,7 +33,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; //Copied from BlockTorch. //I have no idea what all of this means. @@ -58,7 +58,7 @@ public class BlockTinyTorch extends BlockBase { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { switch (state.getValue(BlockTorch.FACING)) { case EAST: return TORCH_EAST_AABB; @@ -75,32 +75,32 @@ public class BlockTinyTorch extends BlockBase { @Nullable @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { + public AxisAlignedBB getCollisionBoundingBox(BlockState blockState, IBlockAccess worldIn, BlockPos pos) { return NULL_AABB; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isNormalCube(IBlockState state) { + public boolean isNormalCube(BlockState state) { return false; } @Override - public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing facing) { + public BlockFaceShape getBlockFaceShape(IBlockAccess world, BlockState state, BlockPos pos, EnumFacing facing) { return BlockFaceShape.UNDEFINED; } private boolean canPlaceOn(World worldIn, BlockPos pos) { - IBlockState state = worldIn.getBlockState(pos); + BlockState state = worldIn.getBlockState(pos); return state.isSideSolid(worldIn, pos, EnumFacing.UP) || state.getBlock().canPlaceTorchOnTop(state, worldIn, pos); } @@ -120,7 +120,7 @@ public class BlockTinyTorch extends BlockBase { } @Override - public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { + public BlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { if (this.canPlaceAt(worldIn, pos, facing)) { return this.getDefaultState().withProperty(BlockTorch.FACING, facing); } else { @@ -133,16 +133,16 @@ public class BlockTinyTorch extends BlockBase { } @Override - public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { + public void onBlockAdded(World worldIn, BlockPos pos, BlockState state) { this.checkForDrop(worldIn, pos, state); } @Override - public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) { + public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) { this.onNeighborChangeInternal(worldIn, pos, state); } - protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state) { + protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, BlockState state) { if (!this.checkForDrop(worldIn, pos, state)) { return true; } else { @@ -167,7 +167,7 @@ public class BlockTinyTorch extends BlockBase { } } - protected boolean checkForDrop(World worldIn, BlockPos pos, IBlockState state) { + protected boolean checkForDrop(World worldIn, BlockPos pos, BlockState state) { if (state.getBlock() == this && this.canPlaceAt(worldIn, pos, state.getValue(BlockTorch.FACING))) { return true; } else { @@ -181,8 +181,8 @@ public class BlockTinyTorch extends BlockBase { } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { + @OnlyIn(Dist.CLIENT) + public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { if (rand.nextBoolean()) { EnumFacing enumfacing = stateIn.getValue(BlockTorch.FACING); double d0 = pos.getX() + 0.5D; @@ -201,8 +201,8 @@ public class BlockTinyTorch extends BlockBase { } @Override - public IBlockState getStateFromMeta(int meta) { - IBlockState iblockstate = this.getDefaultState(); + public BlockState getStateFromMeta(int meta) { + BlockState iblockstate = this.getDefaultState(); switch (meta) { case 1: @@ -231,7 +231,7 @@ public class BlockTinyTorch extends BlockBase { } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { int i = 0; switch (state.getValue(BlockTorch.FACING)) { @@ -257,12 +257,12 @@ public class BlockTinyTorch extends BlockBase { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockTorch.FACING, rot.rotate(state.getValue(BlockTorch.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirrorIn) { + public BlockState withMirror(BlockState state, Mirror mirrorIn) { return state.withRotation(mirrorIn.toRotation(state.getValue(BlockTorch.FACING))); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java index c215183f9..2c27021cd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import java.util.Random; - import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase; @@ -19,27 +17,23 @@ import net.minecraft.block.BlockHorizontal; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.Mirror; -import net.minecraft.util.Rotation; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.WeightedRandom; +import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import java.util.Random; public class BlockTreasureChest extends BlockBase { @@ -53,8 +47,8 @@ public class BlockTreasureChest extends BlockBase { } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) { + @OnlyIn(Dist.CLIENT) + public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) { for (int i = 0; i < 2; i++) { for (float f = 0; f <= 3; f += 0.5) { float particleX = rand.nextFloat(); @@ -65,12 +59,12 @@ public class BlockTreasureChest extends BlockBase { } @Override - public Item getItemDropped(IBlockState state, Random rand, int par3) { + public Item getItemDropped(BlockState state, Random rand, int par3) { return Items.AIR; } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { world.playSound(null, pos, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.2F, world.rand.nextFloat() * 0.1F + 0.9F); this.dropItems(world, pos); @@ -82,14 +76,14 @@ public class BlockTreasureChest extends BlockBase { } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2); super.onBlockPlacedBy(world, pos, state, player, stack); } @Override - public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) { + public boolean canSilkHarvest(World world, BlockPos pos, BlockState state, PlayerEntity player) { return false; } @@ -117,12 +111,12 @@ public class BlockTreasureChest extends BlockBase { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockHorizontal.FACING).getHorizontalIndex(); } @@ -132,12 +126,12 @@ public class BlockTreasureChest extends BlockBase { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java index 9d1b1af2a..c7f883265 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java @@ -16,7 +16,7 @@ import net.minecraft.block.BlockFenceGate; import net.minecraft.block.BlockWall; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -26,7 +26,7 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class BlockWallAA extends BlockBase { @@ -42,7 +42,7 @@ public class BlockWallAA extends BlockBase { this.setDefaultState(this.blockState.getBaseState().withProperty(BlockWall.UP, false).withProperty(BlockWall.NORTH, false).withProperty(BlockWall.EAST, false).withProperty(BlockWall.SOUTH, false).withProperty(BlockWall.WEST, false)); } - private static int yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(IBlockState state) { + private static int yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(BlockState state) { int i = 0; if (state.getValue(BlockWall.NORTH)) { @@ -65,7 +65,7 @@ public class BlockWallAA extends BlockBase { } @Override - public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { + public BlockState getActualState(BlockState state, IBlockAccess worldIn, BlockPos pos) { boolean flag = this.canConnectTo(worldIn, pos.north()); boolean flag1 = this.canConnectTo(worldIn, pos.east()); boolean flag2 = this.canConnectTo(worldIn, pos.south()); @@ -75,7 +75,7 @@ public class BlockWallAA extends BlockBase { } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @@ -85,48 +85,48 @@ public class BlockWallAA extends BlockBase { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) @Deprecated - public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { + public boolean shouldSideBeRendered(BlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side); } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { state = this.getActualState(state, source, pos); return AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(state)]; } @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { + public AxisAlignedBB getCollisionBoundingBox(BlockState blockState, IBlockAccess worldIn, BlockPos pos) { blockState = this.getActualState(blockState, worldIn, pos); return CLIP_AABB_BY_INDEX[yesThisIsCopyPastedFromBlockWallAndIHaveNoIdeaWhatThisMethodDoes(blockState)]; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void getSubBlocks(CreativeTabs tab, NonNullList list) { list.add(new ItemStack(this, 1, 0)); } public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) { - IBlockState state = worldIn.getBlockState(pos); + BlockState state = worldIn.getBlockState(pos); Block block = state.getBlock(); return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || state.getMaterial().isOpaque() && state.isFullCube() && state.getMaterial() != Material.GOURD); } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState(); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return 0; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java index 05acfc1dd..d033991d2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java @@ -22,9 +22,9 @@ import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; @@ -45,15 +45,15 @@ public class BlockWildPlant extends BlockBushBase { } @Override - public boolean canBlockStay(World world, BlockPos pos, IBlockState state) { + public boolean canBlockStay(World world, BlockPos pos, BlockState state) { BlockPos offset = pos.down(); - IBlockState offsetState = world.getBlockState(offset); + BlockState offsetState = world.getBlockState(offset); Block offsetBlock = offsetState.getBlock(); return state.getValue(TYPE) == TheWildPlants.RICE ? offsetState.getMaterial() == Material.WATER : offsetBlock.canSustainPlant(offsetState, world, offset, EnumFacing.UP, this); } @Override - public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { + public ItemStack getPickBlock(BlockState state, RayTraceResult target, World world, BlockPos pos, PlayerEntity player) { BlockPlant normal = (BlockPlant) state.getValue(TYPE).getNormalVersion(); return new ItemStack(normal.seedItem); } @@ -66,13 +66,13 @@ public class BlockWildPlant extends BlockBushBase { } @Override - public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { + public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) { Block normal = state.getValue(TYPE).getNormalVersion(); normal.getDrops(drops, world, pos, normal.getDefaultState().withProperty(BlockCrops.AGE, 7), fortune); } @Override - public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) { + public boolean canSilkHarvest(World world, BlockPos pos, BlockState state, PlayerEntity player) { return false; } @@ -94,12 +94,12 @@ public class BlockWildPlant extends BlockBushBase { } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(TYPE, TheWildPlants.values()[meta]); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(TYPE).ordinal(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java index a92040a78..4e835cb97 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java @@ -18,14 +18,14 @@ import net.minecraft.block.BlockHorizontal; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; @@ -47,7 +47,7 @@ public class BlockXPSolidifier extends BlockContainerBase { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing par6, float par7, float par8, float par9) { if (!world.isRemote) { TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier) world.getTileEntity(pos); if (solidifier != null) { @@ -64,19 +64,19 @@ public class BlockXPSolidifier extends BlockContainerBase { } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2); super.onBlockPlacedBy(world, pos, state, player, stack); } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.byHorizontalIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(BlockHorizontal.FACING).getHorizontalIndex(); } @@ -86,12 +86,12 @@ public class BlockXPSolidifier extends BlockContainerBase { } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirror) { + public BlockState withMirror(BlockState state, Mirror mirror) { return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java index f6c9e50c1..f1e2863cf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java @@ -12,15 +12,15 @@ package de.ellpeck.actuallyadditions.mod.blocks; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.math.RayTraceResult; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public interface IHudDisplay { - @SideOnly(Side.CLIENT) - void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution); + @OnlyIn(Dist.CLIENT) + void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java index 188487c12..cb6a970cd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java @@ -11,27 +11,16 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel; -import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.IRarity; +import net.minecraft.item.Item; -public class BlockBase extends Block implements ItemBlockBase.ICustomRarity, IHasModel { +public class BlockBase extends Block { private final String name; - public BlockBase(Material material, String name) { - super(material); + public BlockBase(Properties properties, String name) { + super(properties); this.name = name; - - this.register(); - } - - private void register() { - ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative()); } protected String getBaseName() { @@ -39,20 +28,10 @@ public class BlockBase extends Block implements ItemBlockBase.ICustomRarity, IHa } protected ItemBlockBase getItemBlock() { - return new ItemBlockBase(this); + return new ItemBlockBase(this, new Item.Properties().group(ActuallyAdditions.GROUP)); } public boolean shouldAddCreative() { return true; } - - @Override - public void registerRendering() { - ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory"); - } - - @Override - public IRarity getRarity(ItemStack stack) { - return EnumRarity.COMMON; - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java index 76baf232e..c817ecc44 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java @@ -11,26 +11,17 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel; -import de.ellpeck.actuallyadditions.mod.util.ItemUtil; -import net.minecraft.block.BlockBush; +import net.minecraft.block.BushBlock; import net.minecraft.block.SoundType; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; +import net.minecraft.item.Item; -public class BlockBushBase extends BlockBush implements ItemBlockBase.ICustomRarity, IHasModel { +public class BlockBushBase extends BushBlock { private final String name; - public BlockBushBase(String name) { + public BlockBushBase(Properties properties, String name) { + super(properties.sound(SoundType.PLANT)); this.name = name; - this.setSoundType(SoundType.PLANT); - - this.register(); - } - - private void register() { - ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative()); } protected String getBaseName() { @@ -38,20 +29,10 @@ public class BlockBushBase extends BlockBush implements ItemBlockBase.ICustomRar } protected ItemBlockBase getItemBlock() { - return new ItemBlockBase(this); + return new ItemBlockBase(this, new Item.Properties().group(ActuallyAdditions.GROUP)); } public boolean shouldAddCreative() { return true; } - - @Override - public void registerRendering() { - ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory"); - } - - @Override - public EnumRarity getRarity(ItemStack stack) { - return EnumRarity.COMMON; - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java index 61e6680ad..e8a435d2a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java @@ -10,50 +10,42 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import javax.annotation.Nullable; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel; import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; +import net.minecraft.block.BlockState; +import net.minecraft.block.ContainerBlock; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.FluidState; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagInt; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumBlockRenderType; -import net.minecraft.util.EnumHand; -import net.minecraft.util.NonNullList; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.IBlockAccess; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidTank; +import net.minecraft.world.server.ServerWorld; import net.minecraftforge.fluids.FluidUtil; +import net.minecraftforge.fluids.capability.templates.FluidTank; -public abstract class BlockContainerBase extends BlockContainer implements ItemBlockBase.ICustomRarity, IHasModel { +import javax.annotation.Nullable; +import java.util.Random; + +public abstract class BlockContainerBase extends ContainerBlock { private final String name; - public BlockContainerBase(Material material, String name) { - super(material); + public BlockContainerBase(Properties properties, String name) { + super(properties); this.name = name; this.register(); @@ -68,23 +60,13 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB } protected ItemBlockBase getItemBlock() { - return new ItemBlockBase(this); + return new ItemBlockBase(this, new Item.Properties().group(ActuallyAdditions.GROUP)); } public boolean shouldAddCreative() { return true; } - @Override - public void registerRendering() { - ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory"); - } - - @Override - public EnumRarity getRarity(ItemStack stack) { - return EnumRarity.COMMON; - } - private void dropInventory(World world, BlockPos position) { if (!world.isRemote) { TileEntity aTile = world.getTileEntity(position); @@ -101,20 +83,20 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB private void dropSlotFromInventory(int i, TileEntityInventoryBase tile, World world, BlockPos pos) { ItemStack stack = tile.inv.getStackInSlot(i); - if (StackUtil.isValid(stack)) { - float dX = world.rand.nextFloat() * 0.8F + 0.1F; - float dY = world.rand.nextFloat() * 0.8F + 0.1F; - float dZ = world.rand.nextFloat() * 0.8F + 0.1F; - EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, stack.copy()); - float factor = 0.05F; - entityItem.motionX = world.rand.nextGaussian() * factor; - entityItem.motionY = world.rand.nextGaussian() * factor + 0.2F; - entityItem.motionZ = world.rand.nextGaussian() * factor; - world.spawnEntity(entityItem); + if (stack.isEmpty()) { + return; } + + float dX = world.rand.nextFloat() * 0.8F + 0.1F; + float dY = world.rand.nextFloat() * 0.8F + 0.1F; + float dZ = world.rand.nextFloat() * 0.8F + 0.1F; + ItemEntity entityItem = new ItemEntity(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, stack.copy()); + float factor = 0.05F; + entityItem.addVelocity(world.rand.nextGaussian() * factor, world.rand.nextGaussian() * factor + 0.2F, world.rand.nextGaussian() * factor); + world.addEntity(entityItem); } - public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player) { + public boolean tryToggleRedstone(World world, BlockPos pos, PlayerEntity player) { ItemStack stack = player.getHeldItemMainhand(); if (StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator) { TileEntity tile = world.getTileEntity(pos); @@ -132,7 +114,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB } @Override - public void updateTick(World world, BlockPos pos, IBlockState state, Random random) { + public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rand) { if (!world.isRemote) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityBase) { @@ -157,13 +139,13 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB } @Override - public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) { + public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) { this.neighborsChangedCustom(worldIn, pos); } @Override - public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) { - super.onNeighborChange(world, pos, neighbor); + public void onNeighborChange(BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbor) { + super.onNeighborChange(state, world, pos, neighbor); if (world instanceof World) { this.neighborsChangedCustom((World) world, pos); } @@ -178,7 +160,8 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB boolean wasPowered = base.isRedstonePowered; if (powered && !wasPowered) { if (base.respondsToPulses()) { - world.scheduleUpdate(pos, this, this.tickRate(world)); + // TODO: [port] eval what this does? :D + // world.scheduleUpdate(pos, this, this.tickRate(world)); } base.setRedstonePowered(true); } else if (!powered && wasPowered) { @@ -188,114 +171,115 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB } } - protected boolean tryUseItemOnTank(EntityPlayer player, EnumHand hand, FluidTank tank) { + protected boolean tryUseItemOnTank(PlayerEntity player, Hand hand, FluidTank tank) { ItemStack heldItem = player.getHeldItem(hand); return StackUtil.isValid(heldItem) && FluidUtil.interactWithFluidHandler(player, hand, tank); } @Override - public void onBlockAdded(World world, BlockPos pos, IBlockState state) { - this.updateRedstoneState(world, pos); + public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { + this.updateRedstoneState(worldIn, pos); } @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) { - if (stack.hasTagCompound()) { + public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + if (stack.hasTag()) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityBase) { TileEntityBase base = (TileEntityBase) tile; - NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Data"); - if (compound != null) { - base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK); - } + CompoundNBT compound = stack.getOrCreateTag().getCompound("Data"); + base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK); } } } @Override - public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) { - if (!player.capabilities.isCreativeMode) { + public void onBlockHarvested(World world, BlockPos pos, BlockState state, PlayerEntity player) { + if (!player.isCreative()) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) { - player.sendMessage(new TextComponentTranslation("info." + ActuallyAdditions.MODID + ".machineBroke").setStyle(new Style().setColor(TextFormatting.RED))); + player.sendStatusMessage(new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".machineBroke").mergeStyle(TextFormatting.RED), false); } } } @Override - public boolean hasComparatorInputOverride(IBlockState state) { + public boolean hasComparatorInputOverride(BlockState state) { return true; } @Override - public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) { + public int getComparatorInputOverride(BlockState state, World world, BlockPos pos) { TileEntity tile = world.getTileEntity(pos); - if (tile instanceof TileEntityBase) { return ((TileEntityBase) tile).getComparatorStrength(); } + if (tile instanceof TileEntityBase) { + return ((TileEntityBase) tile).getComparatorStrength(); + } return 0; } + // TODO: [port]: come back and fix this + + // @Override + // public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) { + // TileEntity tile = world.getTileEntity(pos); + // if (tile instanceof TileEntityBase) { + // TileEntityBase base = (TileEntityBase) tile; + // if (!base.stopFromDropping) { + // CompoundNBT data = new CompoundNBT(); + // base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK); + // + // //Remove unnecessarily saved default values to avoid unstackability + // List keysToRemove = new ArrayList<>(); + // for (String key : data.getKeySet()) { + // NBTBase tag = data.getTag(key); + // //Remove only ints because they are the most common ones + // //Add else if below here to remove more types + // if (tag instanceof NBTTagInt) { + // if (((NBTTagInt) tag).getInt() == 0) { + // keysToRemove.add(key); + // } + // } + // } + // for (String key : keysToRemove) { + // data.removeTag(key); + // } + // + // ItemStack stack = new ItemStack(this.getItemDropped(state, tile.getWorld().rand, fortune), 1, this.damageDropped(state)); + // if (!data.isEmpty()) { + // stack.setTagCompound(new CompoundNBT()); + // stack.getTagCompound().setTag("Data", data); + // } + // + // drops.add(stack); + // } + // } else { + // super.getDrops(drops, world, pos, state, fortune); + // } + // } + + @Override - public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { - TileEntity tile = world.getTileEntity(pos); - if (tile instanceof TileEntityBase) { - TileEntityBase base = (TileEntityBase) tile; - if (!base.stopFromDropping) { - NBTTagCompound data = new NBTTagCompound(); - base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK); + public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid) { + return willHarvest || super.removedByPlayer(state, world, pos, player, false, fluid); + } - //Remove unnecessarily saved default values to avoid unstackability - List keysToRemove = new ArrayList<>(); - for (String key : data.getKeySet()) { - NBTBase tag = data.getTag(key); - //Remove only ints because they are the most common ones - //Add else if below here to remove more types - if (tag instanceof NBTTagInt) { - if (((NBTTagInt) tag).getInt() == 0) { - keysToRemove.add(key); - } - } - } - for (String key : keysToRemove) { - data.removeTag(key); - } + // TODO: [port]: eval - ItemStack stack = new ItemStack(this.getItemDropped(state, tile.getWorld().rand, fortune), 1, this.damageDropped(state)); - if (!data.isEmpty()) { - stack.setTagCompound(new NBTTagCompound()); - stack.getTagCompound().setTag("Data", data); - } + // @Override + // public EnumBlockRenderType getRenderType(BlockState state) { + // return EnumBlockRenderType.MODEL; + // } - drops.add(stack); + + @Override + public void onReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) { + if (state != newState) { + if (this.shouldDropInventory(world, pos)) { + this.dropInventory(world, pos); } - } else { - super.getDrops(drops, world, pos, state, fortune); } - } - - @Override - public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { - return willHarvest || super.removedByPlayer(state, world, pos, player, false); - } - - @Override - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) { - super.harvestBlock(worldIn, player, pos, state, te, stack); - worldIn.setBlockToAir(pos); - } - - @Override - public EnumBlockRenderType getRenderType(IBlockState state) { - return EnumBlockRenderType.MODEL; - } - - @Override - public void breakBlock(World world, BlockPos pos, IBlockState state) { - if (this.shouldDropInventory(world, pos)) { - this.dropInventory(world, pos); - } - - super.breakBlock(world, pos, state); + super.onReplaced(state, world, pos, newState, isMoving); } public boolean shouldDropInventory(World world, BlockPos pos) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java index bb60986d5..cace428b2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java @@ -12,8 +12,6 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import net.minecraft.block.material.Material; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -57,9 +55,4 @@ public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBas public boolean displaceIfPossible(World world, BlockPos pos) { return !world.getBlockState(pos).getMaterial().isLiquid() && super.displaceIfPossible(world, pos); } - - @Override - public EnumRarity getRarity(ItemStack stack) { - return EnumRarity.EPIC; - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java index d87bac936..ed1b6de80 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java @@ -1,29 +1,26 @@ /* -* This file ("BlockPlant.java") is part of the Actually Additions mod for Minecraft. -* It is created and owned by Ellpeck and distributed -* under the Actually Additions License to be found at -* http://ellpeck.de/actaddlicense -* View the source code at https://github.com/Ellpeck/ActuallyAdditions -* -* © 2015-2017 Ellpeck -*/ + * This file ("BlockPlant.java") is part of the Actually Additions mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015-2017 Ellpeck + */ package de.ellpeck.actuallyadditions.mod.blocks.base; -import java.util.Random; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.BlockCrops; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; @@ -31,6 +28,8 @@ import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.items.ItemHandlerHelper; +import java.util.Random; + public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarity, IHasModel { private final String name; @@ -85,12 +84,14 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit } @Override - public int damageDropped(IBlockState state) { - return this.getMetaFromState(state) >= 7 ? this.returnMeta : 0; + public int damageDropped(BlockState state) { + return this.getMetaFromState(state) >= 7 + ? this.returnMeta + : 0; } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (this.getMetaFromState(state) >= 7) { if (!world.isRemote) { @@ -122,8 +123,10 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit } @Override - public int quantityDropped(IBlockState state, int fortune, Random random) { - return this.getMetaFromState(state) >= 7 ? random.nextInt(this.addDropAmount) + this.minDropAmount : super.quantityDropped(state, fortune, random); + public int quantityDropped(BlockState state, int fortune, Random random) { + return this.getMetaFromState(state) >= 7 + ? random.nextInt(this.addDropAmount) + this.minDropAmount + : super.quantityDropped(state, fortune, random); } @Override @@ -132,8 +135,10 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit } @Override - public Item getItemDropped(IBlockState state, Random rand, int par3) { - return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed(); + public Item getItemDropped(BlockState state, Random rand, int par3) { + return this.getMetaFromState(state) >= 7 + ? this.getCrop() + : this.getSeed(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java index a6e551508..bd9242774 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java @@ -11,11 +11,10 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockStairs; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -27,7 +26,7 @@ public class BlockStair extends BlockStairs implements ItemBlockBase.ICustomRari this(block.getDefaultState(), name); } - public BlockStair(IBlockState state, String name) { + public BlockStair(BlockState state, String name) { super(state); this.name = name; this.setLightOpacity(0); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java index 61a5adb59..197a2961e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/ItemBlockBase.java @@ -10,42 +10,12 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; -import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.block.Block; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.IRarity; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; -public class ItemBlockBase extends ItemBlock { - - public ItemBlockBase(Block block) { - super(block); - this.setHasSubtypes(false); - this.setMaxDamage(0); +public class ItemBlockBase extends BlockItem { + public ItemBlockBase(Block block, Item.Properties properties) { + super(block, properties); } - - @Override - public String getTranslationKey(ItemStack stack) { - return this.getTranslationKey(); - } - - @Override - public int getMetadata(int damage) { - return damage; - } - - @Override - public IRarity getForgeRarity(ItemStack stack) { - if (this.block instanceof ICustomRarity) { - return ((ICustomRarity) this.block).getRarity(stack); - } else { - return Util.FALLBACK_RARITY; - } - } - - public interface ICustomRarity { - - IRarity getRarity(ItemStack stack); - - } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java index f5b770254..47436c799 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java @@ -45,7 +45,9 @@ public enum TheColoredLampColors implements IStringSerializable { for (int i = 0; i < values().length; i++) { String aName = values()[i].oreName; if (aName != null) { - if (aName.equalsIgnoreCase(actualName)) { return values()[i]; } + if (aName.equalsIgnoreCase(actualName)) { + return values()[i]; + } } } } @@ -53,7 +55,7 @@ public enum TheColoredLampColors implements IStringSerializable { } @Override - public String getName() { + public String getString() { return this.regName; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java index a2fa35316..43d241d6c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java @@ -10,32 +10,32 @@ package de.ellpeck.actuallyadditions.mod.blocks.metalists; -import net.minecraft.item.EnumRarity; +import net.minecraft.item.Rarity; import net.minecraft.util.IStringSerializable; public enum TheMiscBlocks implements IStringSerializable { - QUARTZ_PILLAR("black_quartz_pillar", EnumRarity.RARE), - QUARTZ_CHISELED("black_quartz_chiseled", EnumRarity.RARE), - QUARTZ("black_quartz", EnumRarity.RARE), - ORE_QUARTZ("ore_black_quartz", EnumRarity.EPIC), - WOOD_CASING("wood_casing", EnumRarity.COMMON), - CHARCOAL_BLOCK("charcoal", EnumRarity.COMMON), - ENDERPEARL_BLOCK("enderpearl", EnumRarity.RARE), - LAVA_FACTORY_CASE("lava_factory_case", EnumRarity.UNCOMMON), - ENDER_CASING("ender_casing", EnumRarity.EPIC), - IRON_CASING("iron_casing", EnumRarity.RARE); + QUARTZ_PILLAR("black_quartz_pillar", Rarity.RARE), + QUARTZ_CHISELED("black_quartz_chiseled", Rarity.RARE), + QUARTZ("black_quartz", Rarity.RARE), + ORE_QUARTZ("ore_black_quartz", Rarity.EPIC), + WOOD_CASING("wood_casing", Rarity.COMMON), + CHARCOAL_BLOCK("charcoal", Rarity.COMMON), + ENDERPEARL_BLOCK("enderpearl", Rarity.RARE), + LAVA_FACTORY_CASE("lava_factory_case", Rarity.UNCOMMON), + ENDER_CASING("ender_casing", Rarity.EPIC), + IRON_CASING("iron_casing", Rarity.RARE); public final String name; - public final EnumRarity rarity; + public final Rarity rarity; - TheMiscBlocks(String name, EnumRarity rarity) { + TheMiscBlocks(String name, Rarity rarity) { this.name = name; this.rarity = rarity; } @Override - public String getName() { + public String getString() { return this.name; } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java index 808b7af20..8d9580790 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java @@ -11,39 +11,38 @@ package de.ellpeck.actuallyadditions.mod.blocks.metalists; import com.google.common.base.Preconditions; - import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import net.minecraft.block.Block; -import net.minecraft.item.EnumRarity; +import net.minecraft.item.Rarity; import net.minecraft.util.IStringSerializable; public enum TheWildPlants implements IStringSerializable { - CANOLA("canola", EnumRarity.RARE, InitBlocks.blockCanola), - FLAX("flax", EnumRarity.RARE, InitBlocks.blockFlax), - RICE("rice", EnumRarity.RARE, InitBlocks.blockRice), - COFFEE("coffee", EnumRarity.RARE, InitBlocks.blockCoffee); + CANOLA("canola", Rarity.RARE, InitBlocks.blockCanola), + FLAX("flax", Rarity.RARE, InitBlocks.blockFlax), + RICE("rice", Rarity.RARE, InitBlocks.blockRice), + COFFEE("coffee", Rarity.RARE, InitBlocks.blockCoffee); final String name; - final EnumRarity rarity; + final Rarity rarity; final Block normal; - TheWildPlants(String name, EnumRarity rarity, Block normal) { + TheWildPlants(String name, Rarity rarity, Block normal) { this.name = name; this.rarity = rarity; this.normal = Preconditions.checkNotNull(normal, "TheWildPlants was loaded before block init!"); } @Override - public String getName() { + public String getString() { return this.name; } - public EnumRarity getRarity() { + public Rarity getRarity() { return this.rarity; } public Block getNormalVersion() { return this.normal; } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/ActualCompostModel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/ActualCompostModel.java index 0efcca4e5..931738b02 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/ActualCompostModel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/ActualCompostModel.java @@ -1,63 +1,65 @@ -package de.ellpeck.actuallyadditions.mod.blocks.render; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.tuple.Pair; - -import de.ellpeck.actuallyadditions.mod.blocks.BlockCompost; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.property.IExtendedBlockState; - -public class ActualCompostModel implements IBakedModel { - - public static final Map, IBakedModel> MODELS = new HashMap<>(); - - @SuppressWarnings("unchecked") - @Override - public List getQuads(IBlockState state, EnumFacing side, long rand) { - if (state instanceof IExtendedBlockState) { - Pair data = ((IExtendedBlockState) state).getValue(BlockCompost.COMPOST_PROP); - if (data == null || data.getRight() <= 0) return CompostModel.compostBase.getQuads(state, side, rand); - IBakedModel model = MODELS.get(data); - if (model == null) { - model = new CompostModel(data.getLeft(), data.getRight()); - MODELS.put(data, model); - } - return model.getQuads(state, side, rand); - } - return CompostModel.compostBase.getQuads(state, side, rand); - } - - @Override - public boolean isAmbientOcclusion() { - return CompostModel.compostBase.isAmbientOcclusion(); - } - - @Override - public boolean isGui3d() { - return false; - } - - @Override - public boolean isBuiltInRenderer() { - return false; - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return CompostModel.compostBase.getParticleTexture(); - } - - @Override - public ItemOverrideList getOverrides() { - return ItemOverrideList.NONE; - } - -} +// TODO: [port] removed, not required? +//package de.ellpeck.actuallyadditions.mod.blocks.render; +// +//import java.util.HashMap; +//import java.util.List; +//import java.util.Map; +// +//import net.minecraft.client.renderer.model.IBakedModel; +//import org.apache.commons.lang3.tuple.Pair; +// +//import de.ellpeck.actuallyadditions.mod.blocks.BlockCompost; +//import net.minecraft.block.state.BlockState; +//import net.minecraft.client.renderer.block.model.BakedQuad; +//import net.minecraft.client.renderer.block.model.IBakedModel; +//import net.minecraft.client.renderer.block.model.ItemOverrideList; +//import net.minecraft.client.renderer.texture.TextureAtlasSprite; +//import net.minecraft.util.EnumFacing; +//import net.minecraftforge.common.property.IExtendedBlockState; +// +//public class ActualCompostModel implements IBakedModel { +// +// public static final Map, IBakedModel> MODELS = new HashMap<>(); +// +// @SuppressWarnings("unchecked") +// @Override +// public List getQuads(BlockState state, EnumFacing side, long rand) { +// if (state instanceof IExtendedBlockState) { +// Pair data = ((IExtendedBlockState) state).getValue(BlockCompost.COMPOST_PROP); +// if (data == null || data.getRight() <= 0) return CompostModel.compostBase.getQuads(state, side, rand); +// IBakedModel model = MODELS.get(data); +// if (model == null) { +// model = new CompostModel(data.getLeft(), data.getRight()); +// MODELS.put(data, model); +// } +// return model.getQuads(state, side, rand); +// } +// return CompostModel.compostBase.getQuads(state, side, rand); +// } +// +// @Override +// public boolean isAmbientOcclusion() { +// return CompostModel.compostBase.isAmbientOcclusion(); +// } +// +// @Override +// public boolean isGui3d() { +// return false; +// } +// +// @Override +// public boolean isBuiltInRenderer() { +// return false; +// } +// +// @Override +// public TextureAtlasSprite getParticleTexture() { +// return CompostModel.compostBase.getParticleTexture(); +// } +// +// @Override +// public ItemOverrideList getOverrides() { +// return ItemOverrideList.NONE; +// } +// +//} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/CompostModel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/CompostModel.java index 196650f9d..8bf0c1cb7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/CompostModel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/CompostModel.java @@ -1,94 +1,96 @@ -package de.ellpeck.actuallyadditions.mod.blocks.render; +// TODO: [port] removed, not required? -import java.util.EnumMap; -import java.util.List; - -import javax.annotation.Nullable; -import javax.vecmath.Vector3f; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.model.TRSRTransformation; - -public class CompostModel implements IBakedModel { - public static IBakedModel compostBase; - private final IBakedModel display; - private final ImmutableList general; - private final ImmutableMap> faces; - - public CompostModel(IBlockState flowerState, float height) { - this.display = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(flowerState); - - TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, -.218F, 0), null, new Vector3f(0.75F, height / 1.81F, 0.75F), null)); - - ImmutableList.Builder builder; - EnumMap> faces = new EnumMap<>(EnumFacing.class); - - for (EnumFacing face : EnumFacing.values()) { - builder = ImmutableList.builder(); - if (!this.display.isBuiltInRenderer()) { - for (BakedQuad quad : this.display.getQuads(flowerState, face, 0)) { - Transformer transformer = new Transformer(transform, quad.getFormat()); - quad.pipe(transformer); - builder.add(transformer.build()); - } - builder.addAll(compostBase.getQuads(null, face, 0)); - } - faces.put(face, builder.build()); - } - - if (!this.display.isBuiltInRenderer()) { - builder = ImmutableList.builder(); - for (BakedQuad quad : this.display.getQuads(flowerState, null, 0)) { - Transformer transformer = new Transformer(transform, quad.getFormat()); - quad.pipe(transformer); - builder.add(transformer.build()); - } - builder.addAll(compostBase.getQuads(null, null, 0)); - this.general = builder.build(); - } else this.general = ImmutableList.of(); - - this.faces = Maps.immutableEnumMap(faces); - } - - @Override - public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { - if (side == null) return this.general; - return this.faces.get(side); - } - - @Override - public boolean isAmbientOcclusion() { - return compostBase.isAmbientOcclusion() && this.display.isAmbientOcclusion(); - } - - @Override - public boolean isGui3d() { - return false; - } - - @Override - public boolean isBuiltInRenderer() { - return false; - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return compostBase.getParticleTexture(); - } - - @Override - public ItemOverrideList getOverrides() { - return ItemOverrideList.NONE; - } - -} +//package de.ellpeck.actuallyadditions.mod.blocks.render; +// +//import java.util.EnumMap; +//import java.util.List; +// +//import javax.annotation.Nullable; +//import javax.vecmath.Vector3f; +// +//import com.google.common.collect.ImmutableList; +//import com.google.common.collect.ImmutableMap; +//import com.google.common.collect.Maps; +// +//import net.minecraft.block.state.BlockState; +//import net.minecraft.client.Minecraft; +//import net.minecraft.client.renderer.block.model.BakedQuad; +//import net.minecraft.client.renderer.block.model.IBakedModel; +//import net.minecraft.client.renderer.block.model.ItemOverrideList; +//import net.minecraft.client.renderer.texture.TextureAtlasSprite; +//import net.minecraft.util.EnumFacing; +//import net.minecraftforge.common.model.TRSRTransformation; +// +//public class CompostModel implements IBakedModel { +// public static IBakedModel compostBase; +// private final IBakedModel display; +// private final ImmutableList general; +// private final ImmutableMap> faces; +// +// public CompostModel(BlockState flowerState, float height) { +// this.display = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState(flowerState); +// +// TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, -.218F, 0), null, new Vector3f(0.75F, height / 1.81F, 0.75F), null)); +// +// ImmutableList.Builder builder; +// EnumMap> faces = new EnumMap<>(EnumFacing.class); +// +// for (EnumFacing face : EnumFacing.values()) { +// builder = ImmutableList.builder(); +// if (!this.display.isBuiltInRenderer()) { +// for (BakedQuad quad : this.display.getQuads(flowerState, face, 0)) { +// Transformer transformer = new Transformer(transform, quad.getFormat()); +// quad.pipe(transformer); +// builder.add(transformer.build()); +// } +// builder.addAll(compostBase.getQuads(null, face, 0)); +// } +// faces.put(face, builder.build()); +// } +// +// if (!this.display.isBuiltInRenderer()) { +// builder = ImmutableList.builder(); +// for (BakedQuad quad : this.display.getQuads(flowerState, null, 0)) { +// Transformer transformer = new Transformer(transform, quad.getFormat()); +// quad.pipe(transformer); +// builder.add(transformer.build()); +// } +// builder.addAll(compostBase.getQuads(null, null, 0)); +// this.general = builder.build(); +// } else this.general = ImmutableList.of(); +// +// this.faces = Maps.immutableEnumMap(faces); +// } +// +// @Override +// public List getQuads(@Nullable BlockState state, @Nullable EnumFacing side, long rand) { +// if (side == null) return this.general; +// return this.faces.get(side); +// } +// +// @Override +// public boolean isAmbientOcclusion() { +// return compostBase.isAmbientOcclusion() && this.display.isAmbientOcclusion(); +// } +// +// @Override +// public boolean isGui3d() { +// return false; +// } +// +// @Override +// public boolean isBuiltInRenderer() { +// return false; +// } +// +// @Override +// public TextureAtlasSprite getParticleTexture() { +// return compostBase.getParticleTexture(); +// } +// +// @Override +// public ItemOverrideList getOverrides() { +// return ItemOverrideList.NONE; +// } +// +//} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/IHasModel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/IHasModel.java deleted file mode 100644 index 115b8ab14..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/IHasModel.java +++ /dev/null @@ -1,7 +0,0 @@ -package de.ellpeck.actuallyadditions.mod.blocks.render; - -public interface IHasModel { - - public void registerRendering(); - -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderBatteryBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderBatteryBox.java index aea1a7760..02d25f5a1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderBatteryBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderBatteryBox.java @@ -10,8 +10,8 @@ package de.ellpeck.actuallyadditions.mod.blocks.render; -import java.text.NumberFormat; - +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.systems.RenderSystem; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.ItemBattery; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox; @@ -19,38 +19,42 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemBlock; +import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; +import net.minecraft.util.Util; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.energy.CapabilityEnergy; -import net.minecraftforge.energy.IEnergyStorage; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -@SideOnly(Side.CLIENT) -public class RenderBatteryBox extends TileEntitySpecialRenderer { +import java.text.NumberFormat; +@OnlyIn(Dist.CLIENT) +public class RenderBatteryBox extends TileEntityRenderer { + public RenderBatteryBox(TileEntityRendererDispatcher rendererDispatcherIn) { + super(rendererDispatcherIn); + } + + // TODO: [port] migrate to matric (see cleanstart) @Override - public void render(TileEntityBatteryBox tile, double x, double y, double z, float par5, int par6, float f) { - if (!(tile instanceof TileEntityBatteryBox)) { return; } - + public void render(TileEntityBatteryBox tile, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { ItemStack stack = tile.inv.getStackInSlot(0); if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemBattery) { - GlStateManager.pushMatrix(); - GlStateManager.translate((float) x + 0.5F, (float) y + 1F, (float) z + 0.5F); + RenderSystem.pushMatrix(); + RenderSystem.translatef(0.5F, 1F, 0.5F); - GlStateManager.pushMatrix(); + RenderSystem.pushMatrix(); - GlStateManager.scale(0.0075F, 0.0075F, 0.0075F); - GlStateManager.rotate(180F, 1F, 0F, 0F); - GlStateManager.translate(0F, 0F, -50F); + RenderSystem.scalef(0.0075F, 0.0075F, 0.0075F); + RenderSystem.rotatef(180F, 1F, 0F, 0F); + RenderSystem.translatef(0F, 0F, -50F); - if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) { - IEnergyStorage cap = stack.getCapability(CapabilityEnergy.ENERGY, null); + stack.getCapability(CapabilityEnergy.ENERGY).ifPresent(cap -> { NumberFormat format = NumberFormat.getInstance(); - FontRenderer font = Minecraft.getMinecraft().fontRenderer; + FontRenderer font = Minecraft.getInstance().fontRenderer; String s = format.format(cap.getEnergyStored()) + "/" + format.format(cap.getMaxEnergyStored()); float lengthS = -font.getStringWidth(s) / 2F; @@ -58,29 +62,31 @@ public class RenderBatteryBox extends TileEntitySpecialRenderer { @Override public void render(TileEntityDisplayStand tile, double x, double y, double z, float par5, int par6, float f) { - if (!(tile instanceof TileEntityDisplayStand)) { return; } + if (!(tile instanceof TileEntityDisplayStand)) { + return; + } ItemStack stack = tile.inv.getStackInSlot(0); if (StackUtil.isValid(stack)) { @@ -38,7 +40,9 @@ public class RenderDisplayStand extends TileEntitySpecialRenderer { @Override public void render(TileEntityEmpowerer tile, double x, double y, double z, float par5, int par6, float f) { - if (!(tile instanceof TileEntityEmpowerer)) { return; } + if (!(tile instanceof TileEntityEmpowerer)) { + return; + } ItemStack stack = tile.inv.getStackInSlot(0); if (StackUtil.isValid(stack)) { @@ -42,7 +44,9 @@ public class RenderEmpowerer extends TileEntitySpecialRenderer { - private static final float[] COLOR = new float[] { 1F, 0F, 0F }; - private static final float[] COLOR_ITEM = new float[] { 0F, 124F / 255F, 16F / 255F }; - private static final float[] COLOR_FLUIDS = new float[] { 0F, 97F / 255F, 198F / 255F }; - private static final float[] COLOR_INFRARED = new float[] { 209F / 255F, 179F / 255F, 239F / 255F }; + private static final float[] COLOR = new float[]{1F, 0F, 0F}; + private static final float[] COLOR_ITEM = new float[]{0F, 124F / 255F, 16F / 255F}; + private static final float[] COLOR_FLUIDS = new float[]{0F, 97F / 255F, 198F / 255F}; + private static final float[] COLOR_INFRARED = new float[]{209F / 255F, 179F / 255F, 239F / 255F}; @Override public void render(TileEntityLaserRelay tile, double x, double y, double z, float par5, int par6, float f) { @@ -45,7 +45,7 @@ public class RenderLaserRelay extends TileEntitySpecialRenderer { @Override public void render(TileEntityAtomicReconstructor tile, double x, double y, double z, float par5, int par6, float f) { - if (tile == null) return; + if (tile == null) { + return; + } ItemStack stack = tile.inv.getStackInSlot(0); @@ -35,7 +37,7 @@ public class RenderReconstructorLens extends TileEntitySpecialRenderer { @Override @@ -42,26 +42,27 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer= 3) { - Vector4f vec = new Vector4f(data); - vec.setW(1.0f); - this.transformation.transform(vec); - data = new float[4]; - vec.get(data); - } else if (usage == VertexFormatElement.EnumUsage.NORMAL && data.length >= 3) { - Vector3f vec = new Vector3f(data); - this.normalTransformation.transform(vec); - vec.normalize(); - data = new float[4]; - vec.get(data); - } - super.put(element, data); - } - - public UnpackedBakedQuad build() { - return ((UnpackedBakedQuad.Builder) this.parent).build(); - } -} \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java index a58cb643b..238f7dcc6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java @@ -10,9 +10,6 @@ package de.ellpeck.actuallyadditions.mod.booklet.button; -import java.util.ArrayList; -import java.util.List; - import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; @@ -29,10 +26,12 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +import java.util.ArrayList; +import java.util.List; + +@OnlyIn(Dist.CLIENT) public class BookmarkButton extends GuiButton { private final GuiBooklet booklet; @@ -49,7 +48,7 @@ public class BookmarkButton extends GuiButton { this.assignedPage = null; } else if (!(this.booklet instanceof GuiPage) || ((GuiPage) this.booklet).pages[0] != this.assignedPage) { GuiPage gui = BookletUtils.createPageGui(this.booklet.previousScreen, this.booklet, this.assignedPage); - Minecraft.getMinecraft().displayGuiScreen(gui); + Minecraft.getInstance().displayGuiScreen(gui); } } else { if (this.booklet instanceof GuiPage) { @@ -73,7 +72,9 @@ public class BookmarkButton extends GuiButton { GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.blendFunc(770, 771); int renderHeight = 25; - this.drawTexturedModalRect(this.x, this.y, 224 + (this.assignedPage == null ? 0 : 16), 14 - renderHeight + k * renderHeight, this.width, renderHeight); + this.drawTexturedModalRect(this.x, this.y, 224 + (this.assignedPage == null + ? 0 + : 16), 14 - renderHeight + k * renderHeight, this.width, renderHeight); this.mouseDragged(minecraft, x, y); if (this.assignedPage != null) { @@ -107,7 +108,7 @@ public class BookmarkButton extends GuiButton { } } - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/EntryButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/EntryButton.java index d3595ccf5..2253e62f4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/EntryButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/EntryButton.java @@ -19,9 +19,9 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class EntryButton extends GuiButton { private final GuiBookletBase gui; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java index 23ce0eb15..fa2fb0eab 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java @@ -19,7 +19,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class BookletChapter implements IBookletChapter { @@ -55,13 +55,13 @@ public class BookletChapter implements IBookletChapter { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getLocalizedName() { return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.getIdentifier() + ".name"); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getLocalizedNameWithFormatting() { return this.color + this.getLocalizedName(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterTrials.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterTrials.java index 6a6db75c2..74c4028b4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterTrials.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapterTrials.java @@ -16,11 +16,10 @@ import de.ellpeck.actuallyadditions.mod.booklet.page.PageTrials; import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class BookletChapterTrials extends BookletChapter { @@ -29,18 +28,20 @@ public class BookletChapterTrials extends BookletChapter { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getLocalizedName() { return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trials." + this.getIdentifier() + ".name"); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getLocalizedNameWithFormatting() { - EntityPlayer player = Minecraft.getMinecraft().player; + PlayerEntity player = Minecraft.getInstance().player; PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); boolean completed = data.completedTrials.contains(this.getIdentifier()); - return (completed ? TextFormatting.DARK_GREEN : TextFormatting.DARK_RED) + TextFormatting.ITALIC.toString() + this.getLocalizedName(); + return (completed + ? TextFormatting.DARK_GREEN + : TextFormatting.DARK_RED) + TextFormatting.ITALIC.toString() + this.getLocalizedName(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java index a24e1261e..9467e37f4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java @@ -10,10 +10,6 @@ package de.ellpeck.actuallyadditions.mod.booklet.entry; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; @@ -26,8 +22,11 @@ import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; public class BookletEntry implements IBookletEntry { @@ -48,18 +47,22 @@ public class BookletEntry implements IBookletEntry { this.color = TextFormatting.RESET; } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) private static boolean fitsFilter(IBookletPage page, String searchBarText) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); List items = new ArrayList<>(); page.getItemStacksForPage(items); if (!items.isEmpty()) { for (ItemStack stack : items) { if (StackUtil.isValid(stack)) { - List tooltip = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL); + List tooltip = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips + ? ITooltipFlag.TooltipFlags.ADVANCED + : ITooltipFlag.TooltipFlags.NORMAL); for (String strg : tooltip) { - if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) { return true; } + if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) { + return true; + } } } } @@ -71,7 +74,9 @@ public class BookletEntry implements IBookletEntry { for (FluidStack stack : fluids) { if (stack != null) { String strg = stack.getLocalizedName(); - if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) { return true; } + if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) { + return true; + } } } } @@ -90,13 +95,13 @@ public class BookletEntry implements IBookletEntry { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getLocalizedName() { return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".indexEntry." + this.getIdentifier() + ".name"); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getLocalizedNameWithFormatting() { return this.color + this.getLocalizedName(); } @@ -107,7 +112,7 @@ public class BookletEntry implements IBookletEntry { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public List getChaptersForDisplay(String searchBarText) { if (searchBarText != null && !searchBarText.isEmpty()) { String search = searchBarText.toLowerCase(Locale.ROOT); @@ -138,7 +143,7 @@ public class BookletEntry implements IBookletEntry { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public boolean visibleOnFrontPage() { return true; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java index bdfc6ee57..34128ecd1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java @@ -37,9 +37,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public abstract class GuiBooklet extends GuiBookletBase { public static final int BUTTONS_PER_PAGE = 12; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java index 95f8c058c..6723b7e19 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java @@ -24,9 +24,9 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiEntry extends GuiBooklet { //The page in the entry. Say you have 2 more chapters than fit on one double page, then those 2 would be displayed on entryPage 1 instead. diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java index e6f687e88..2c0f7380b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java @@ -32,10 +32,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; //TODO Fix achievement button -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiMainPage extends GuiBooklet { private static final String[] QUOTES = new String[] { "Actually Additions, to me, is quite magical in a way.@Saphrym", "Actually quite cool. Lots of nice little additions.@Direwolf20", "Mod Dev quite rude and arrogant@Bubb1e0seven", "A whimsical breath of fresh air in a stuffy tech-mod world.@mezz", "User-friendly :3@TheMeeep", "A lot of stuff, some of it really good.@Narubion", "I like the bookmarks.@Vazkii", "It's got some stuff I guess.@Ellpeck", "Actually Additions should be included in every new modpack that includes any form of tech.@YasminEndusa", "A mod that basically lets you do what ever the heck you want.@Ristelle", "TINY TORCHES!! BABY TORCHES!! Somebody actually finally did it!!@Soaryn", "Balanced mod wich makes things different - in a good way.@garantiertnicht", "The mod everyone needs, but not everyone knows@Brewpl", "The in-game documentation is the best I’ve seen. I especially love the JEI integration. Even a derp like me can figure it out.@dannydjdk", "The second best mod I've ever used.@mmaas44", "The Fermenting Barrel is one of my favorite textures.@amadornes", "Smiley Clouds is the reason for fascism in 2016.@raoulvdberge", "The worms are an awesome idea!@greenking", "Can I use that mod in my pack?@Ibraheem", "Hello, love the mod.@SuntannedDuck2", "Quick! Have all the fun before they nerf it!@JuddMan03", "I have a feeling Actually Additions is also like Extra Utilities with Random things smashed together why is it...@lesslighter", "Leaf eater... munchdew... hummm@EiOs", "There is no such thing as canola seeds.@AlBoVa", "This mod is cancer, BRUTAL EXPENSIVE POWER usage..Just, cancer.@KoJo", "Spaghetti is spaghetti, and noodles are noodles.@robsonld04", "The Actually Additions name is actually true. It's actually great!@asiekierka", "Such a great mod@jsdeveloper", "That mod is kind of funny.@Anonymous", "Actually Additions is a lot of fun.@Anonymous", "Is Actually Additions still fugly?@Anonymous", "I like it, but it's so small.@Anonymous", "It has a couple of blocks I like, but overall it's just a mess.@Anonymous", "Direwolf's 1.10 playthrough is just him shilling Actually Additions@Anonymous", "We thought about sending the author a bunch of pizzas to his adress@Anonymous", "It's op as heck.@billofbong0", "Actually AdditionsってマイクラMODすごく良いのに日本人で遊んでる人あんまいないっぽい@stay_uk", "Actually Additions is OP. Not like my favorite combination of mods, Project E + Magic Crops + Draconic Evolution.@Anonymous", "To be perfectly honest, I never actually realized how much content Actually Additions has before.@Ellpeck", "I don't blame you, I actually downgraded to Actually Additions.@PvtSeaCow", "It is lonely because there is no device to fly items with the laser in the 1.7.10 version.@Google Translate", "始めまして。日本人です。このMODは本当に素晴らしい!ただ、1.7.10ヴァージョンだと、レーザーでアイテムを飛ばす装置がないので寂しいです。@Anonymous", "Some verses found in older translations, such as the KJV were actually additions made by later copyists.@Pat_Joel", "I can't place filters into Laser Relays, but the mod is very cool.@LP_Jakob", "Am I good enough to be an Actually Additions tool?@deanwhufc" }; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java index 6d04a301f..d7e38adaa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java @@ -31,9 +31,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiPage extends GuiBooklet { public final IBookletPage[] pages = new IBookletPage[2]; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/BookletUtils.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/BookletUtils.java index 4f63ddfd8..8cfc211e9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/BookletUtils.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/BookletUtils.java @@ -24,7 +24,7 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public final class BookletUtils { @@ -41,7 +41,7 @@ public final class BookletUtils { return null; } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static GuiPage createBookletGuiFromPage(GuiScreen previousScreen, IBookletPage page) { GuiMainPage mainPage = new GuiMainPage(previousScreen); @@ -51,7 +51,7 @@ public final class BookletUtils { return createPageGui(previousScreen, entry, page); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static GuiPage createPageGui(GuiScreen previousScreen, GuiBookletBase parentPage, IBookletPage page) { IBookletChapter chapter = page.getChapter(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/GuiAAAchievements.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/GuiAAAchievements.java index 85ccae067..f1d3b9b15 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/GuiAAAchievements.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/misc/GuiAAAchievements.java @@ -19,7 +19,7 @@ import net.minecraft.client.gui.achievement.GuiAchievements; import net.minecraft.stats.StatisticsManager; import net.minecraftforge.fml.relauncher.ReflectionHelper; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; import org.lwjgl.input.Keyboard; import java.io.IOException; @@ -27,7 +27,7 @@ import java.io.IOException; /** * (Partially excerpted from Botania by Vazkii with permission, thanks!) * -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiAAAchievements extends GuiAchievements{ public GuiAAAchievements(GuiScreen screen, StatisticsManager statistics){ @@ -62,4 +62,4 @@ public class GuiAAAchievements extends GuiAchievements{ } } } - */ \ No newline at end of file + */ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPage.java index 79a663369..186399c62 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPage.java @@ -28,7 +28,7 @@ import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class BookletPage implements IBookletPage { @@ -70,7 +70,7 @@ public class BookletPage implements IBookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getInfoText() { if (this.hasNoText) { return null; } @@ -88,55 +88,55 @@ public class BookletPage implements IBookletPage { return base; } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) protected String getLocalizationKey() { return "booklet." + ActuallyAdditions.MODID + ".chapter." + this.chapter.getIdentifier() + ".text." + this.localizationKey; } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton) { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state) { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void actionPerformed(GuiBookletBase gui, GuiButton button) { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void initGui(GuiBookletBase gui, int startX, int startY) { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { } @@ -198,4 +198,4 @@ public class BookletPage implements IBookletPage { public int getSortingPriority() { return this.priority; } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java index e43f9a044..67a8004c8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java @@ -27,7 +27,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class ItemDisplay { @@ -47,12 +47,12 @@ public class ItemDisplay { this.page = shouldTryTransfer ? BookletUtils.findFirstPageForStack(stack) : null; } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void drawPre() { AssetUtil.renderStackToGui(this.stack, this.x, this.y, this.scale); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void drawPost(int mouseX, int mouseY) { if (this.isHovered(mouseX, mouseY)) { Minecraft mc = this.gui.mc; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java index b4e120eef..0eac54559 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java @@ -21,7 +21,7 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class PageCoffeeMachine extends BookletPage { @@ -41,7 +41,7 @@ public class PageCoffeeMachine extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); @@ -57,7 +57,7 @@ public class PageCoffeeMachine extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void initGui(GuiBookletBase gui, int startX, int startY) { super.initGui(gui, startX, startY); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java index 0df0910f1..18b8b3d18 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java @@ -28,7 +28,7 @@ import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; @@ -62,7 +62,7 @@ public class PageCrafting extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); @@ -75,7 +75,7 @@ public class PageCrafting extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) { super.updateScreen(gui, startX, startY, pageTimer); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java index 44153a1cc..870100d48 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java @@ -21,7 +21,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class PageCrusherRecipe extends BookletPage { @@ -37,7 +37,7 @@ public class PageCrusherRecipe extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); @@ -52,7 +52,7 @@ public class PageCrusherRecipe extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void initGui(GuiBookletBase gui, int startX, int startY) { super.initGui(gui, startX, startY); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java index b0ad58294..18bb2b0d7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java @@ -20,7 +20,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class PageEmpowerer extends BookletPage { @@ -46,7 +46,7 @@ public class PageEmpowerer extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); @@ -60,7 +60,7 @@ public class PageEmpowerer extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void initGui(GuiBookletBase gui, int startX, int startY) { super.initGui(gui, startX, startY); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java index 862905caa..acd44e742 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java @@ -22,7 +22,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class PageFurnace extends BookletPage { @@ -50,7 +50,7 @@ public class PageFurnace extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); @@ -63,7 +63,7 @@ public class PageFurnace extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void initGui(GuiBookletBase gui, int startX, int startY) { super.initGui(gui, startX, startY); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageLinkButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageLinkButton.java index 7b5ab3d8c..e1f51e85b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageLinkButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageLinkButton.java @@ -18,7 +18,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.gui.GuiButton; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class PageLinkButton extends BookletPage { @@ -36,7 +36,7 @@ public class PageLinkButton extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void initGui(GuiBookletBase gui, int startX, int startY) { super.initGui(gui, startX, startY); @@ -44,14 +44,14 @@ public class PageLinkButton extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void actionPerformed(GuiBookletBase gui, GuiButton button) { if (button.id == this.buttonId) { if (Desktop.isDesktopSupported()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java index c4c1e16f9..f39e5abcf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java @@ -16,7 +16,7 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class PagePicture extends BookletPage { @@ -40,7 +40,7 @@ public class PagePicture extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java index 46770d7b0..eaca54553 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java @@ -21,7 +21,7 @@ import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class PageReconstructor extends BookletPage { @@ -38,7 +38,7 @@ public class PageReconstructor extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); @@ -54,7 +54,7 @@ public class PageReconstructor extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void initGui(GuiBookletBase gui, int startX, int startY) { super.initGui(gui, startX, startY); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java index 226a98354..9dd3010ed 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java @@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.booklet.page; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class PageTextOnly extends BookletPage { @@ -24,7 +24,7 @@ public class PageTextOnly extends BookletPage { super(localizationKey); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void renderTextToPage(GuiBookletBase gui, BookletPage page, int x, int y) { String text = page.getInfoText(); if (text != null && !text.isEmpty()) { @@ -33,7 +33,7 @@ public class PageTextOnly extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); renderTextToPage(gui, this, startX + 6, startY + 5); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTrials.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTrials.java index 4ea7c338b..cc1c7f60b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTrials.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTrials.java @@ -18,15 +18,14 @@ import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class PageTrials extends BookletPage { private final int buttonId; - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) private GuiButton button; public PageTrials(int localizationKey, boolean button, boolean text) { @@ -45,7 +44,7 @@ public class PageTrials extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void initGui(GuiBookletBase gui, int startX, int startY) { super.initGui(gui, startX, startY); @@ -57,23 +56,23 @@ public class PageTrials extends BookletPage { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) protected String getLocalizationKey() { return "booklet." + ActuallyAdditions.MODID + ".trials." + this.chapter.getIdentifier() + ".text." + this.localizationKey; } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void actionPerformed(GuiBookletBase gui, GuiButton button) { if (this.buttonId >= 0 && button.id == this.buttonId) { - EntityPlayer player = Minecraft.getMinecraft().player; + PlayerEntity player = Minecraft.getInstance().player; PlayerSave data = PlayerData.getDataFromPlayer(player); String id = this.chapter.getIdentifier(); @@ -91,10 +90,10 @@ public class PageTrials extends BookletPage { } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) private void updateButton() { if (this.buttonId >= 0 && this.button != null) { - EntityPlayer player = Minecraft.getMinecraft().player; + PlayerEntity player = Minecraft.getInstance().player; PlayerSave data = PlayerData.getDataFromPlayer(player); boolean completed = data.completedTrials.contains(this.chapter.getIdentifier()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java index 324dcec70..632accc37 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java @@ -24,7 +24,7 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class CreativeTab extends CreativeTabs { @@ -52,7 +52,7 @@ public class CreativeTab extends CreativeTabs { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void displayAllRelevantItems(NonNullList list) { this.list = list; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java index 9163566a8..f6f62398c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java @@ -10,31 +10,32 @@ package de.ellpeck.actuallyadditions.mod.data; +import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; +import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; +import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; +import net.minecraft.nbt.NBTTagString; +import net.minecraftforge.fml.relauncher.OnlyIn; + import java.util.ArrayList; import java.util.List; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; -import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; -import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagString; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - public final class PlayerData { - public static PlayerSave getDataFromPlayer(EntityPlayer player) { + public static PlayerSave getDataFromPlayer(PlayerEntity player) { WorldData worldData = WorldData.get(player.getEntityWorld()); ConcurrentHashMap data = worldData.playerSaveData; UUID id = player.getUniqueID(); if (data.containsKey(id)) { PlayerSave save = data.get(id); - if (save != null && save.id != null && save.id.equals(id)) { return save; } + if (save != null && save.id != null && save.id.equals(id)) { + return save; + } } //Add Data if none is existant @@ -57,24 +58,24 @@ public final class PlayerData { public IBookletPage[] bookmarks = new IBookletPage[12]; public List completedTrials = new ArrayList<>(); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public GuiBooklet lastOpenBooklet; public PlayerSave(UUID id) { this.id = id; } - public void readFromNBT(NBTTagCompound compound, boolean savingToFile) { + public void readFromNBT(CompoundNBT compound, boolean savingToFile) { this.bookGottenAlready = compound.getBoolean("BookGotten"); this.didBookTutorial = compound.getBoolean("DidTutorial"); this.hasBatWings = compound.getBoolean("HasBatWings"); this.batWingsFlyTime = compound.getInteger("BatWingsFlyTime"); - NBTTagList bookmarks = compound.getTagList("Bookmarks", 8); + ListNBT bookmarks = compound.getList("Bookmarks", 8); this.loadBookmarks(bookmarks); - NBTTagList trials = compound.getTagList("Trials", 8); + ListNBT trials = compound.getList("Trials", 8); this.loadTrials(trials); if (!savingToFile) { @@ -82,7 +83,7 @@ public final class PlayerData { } } - public void writeToNBT(NBTTagCompound compound, boolean savingToFile) { + public void writeToNBT(CompoundNBT compound, boolean savingToFile) { compound.setBoolean("BookGotten", this.bookGottenAlready); compound.setBoolean("DidTutorial", this.didBookTutorial); @@ -97,16 +98,18 @@ public final class PlayerData { } } - public NBTTagList saveBookmarks() { - NBTTagList bookmarks = new NBTTagList(); + public ListNBT saveBookmarks() { + ListNBT bookmarks = new ListNBT(); for (IBookletPage bookmark : this.bookmarks) { - bookmarks.appendTag(new NBTTagString(bookmark == null ? "" : bookmark.getIdentifier())); + bookmarks.appendTag(new NBTTagString(bookmark == null + ? "" + : bookmark.getIdentifier())); } return bookmarks; } - public void loadBookmarks(NBTTagList bookmarks) { - for (int i = 0; i < bookmarks.tagCount(); i++) { + public void loadBookmarks(ListNBT bookmarks) { + for (int i = 0; i < bookmarks.size(); i++) { String strg = bookmarks.getStringTagAt(i); if (strg != null && !strg.isEmpty()) { IBookletPage page = BookletUtils.getBookletPageById(strg); @@ -117,18 +120,18 @@ public final class PlayerData { } } - public NBTTagList saveTrials() { - NBTTagList trials = new NBTTagList(); + public ListNBT saveTrials() { + ListNBT trials = new ListNBT(); for (String trial : this.completedTrials) { trials.appendTag(new NBTTagString(trial)); } return trials; } - public void loadTrials(NBTTagList trials) { + public void loadTrials(ListNBT trials) { this.completedTrials.clear(); - for (int i = 0; i < trials.tagCount(); i++) { + for (int i = 0; i < trials.size(); i++) { String strg = trials.getStringTagAt(i); if (strg != null && !strg.isEmpty()) { this.completedTrials.add(strg); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java index a9544df07..58cdd8fd4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java @@ -10,19 +10,19 @@ package de.ellpeck.actuallyadditions.mod.data; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - import de.ellpeck.actuallyadditions.api.laser.Network; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler; import io.netty.util.internal.ConcurrentSet; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.world.World; import net.minecraft.world.storage.WorldSavedData; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + public class WorldData extends WorldSavedData { public static final String DATA_TAG = ActuallyAdditions.MODID + "data"; @@ -36,8 +36,12 @@ public class WorldData extends WorldSavedData { public static WorldData get(World world, boolean forceLoad) { WorldData w = getInternal(world, forceLoad); - if (w == null) ActuallyAdditions.LOGGER.error("An impossible bug has occured."); - return w == null ? new WorldData(DATA_TAG) : w; + if (w == null) { + ActuallyAdditions.LOGGER.error("An impossible bug has occured."); + } + return w == null + ? new WorldData(DATA_TAG) + : w; } private static WorldData getInternal(World world, boolean forceLoad) { @@ -75,21 +79,21 @@ public class WorldData extends WorldSavedData { } @Override - public void readFromNBT(NBTTagCompound compound) { + public void readFromNBT(CompoundNBT compound) { this.laserRelayNetworks.clear(); - NBTTagList networkList = compound.getTagList("Networks", 10); - for (int i = 0; i < networkList.tagCount(); i++) { - Network network = LaserRelayConnectionHandler.readNetworkFromNBT(networkList.getCompoundTagAt(i)); + ListNBT networkList = compound.getList("Networks", 10); + for (int i = 0; i < networkList.size(); i++) { + Network network = LaserRelayConnectionHandler.readNetworkFromNBT(networkList.getCompound(i)); this.laserRelayNetworks.add(network); } this.playerSaveData.clear(); - NBTTagList playerList = compound.getTagList("PlayerData", 10); - for (int i = 0; i < playerList.tagCount(); i++) { - NBTTagCompound player = playerList.getCompoundTagAt(i); + ListNBT playerList = compound.getList("PlayerData", 10); + for (int i = 0; i < playerList.size(); i++) { + CompoundNBT player = playerList.getCompound(i); UUID id = player.getUniqueId("UUID"); - NBTTagCompound data = player.getCompoundTag("Data"); + CompoundNBT data = player.getCompoundTag("Data"); PlayerSave save = new PlayerSave(id); save.readFromNBT(data, true); @@ -98,21 +102,21 @@ public class WorldData extends WorldSavedData { } @Override - public NBTTagCompound writeToNBT(NBTTagCompound compound) { + public CompoundNBT writeToNBT(CompoundNBT compound) { //Laser World Data - NBTTagList networkList = new NBTTagList(); + ListNBT networkList = new ListNBT(); for (Network network : this.laserRelayNetworks) { networkList.appendTag(LaserRelayConnectionHandler.writeNetworkToNBT(network)); } compound.setTag("Networks", networkList); //Player Data - NBTTagList playerList = new NBTTagList(); + ListNBT playerList = new ListNBT(); for (PlayerSave save : this.playerSaveData.values()) { - NBTTagCompound player = new NBTTagCompound(); + CompoundNBT player = new CompoundNBT(); player.setUniqueId("UUID", save.id); - NBTTagCompound data = new NBTTagCompound(); + CompoundNBT data = new CompoundNBT(); save.writeToNBT(data, true); player.setTag("Data", data); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java index 46adc1bdc..96315b1ee 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java @@ -12,15 +12,10 @@ package de.ellpeck.actuallyadditions.mod.entity; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.DefaultFarmerBehavior; -import net.minecraft.block.Block; -import net.minecraft.block.BlockBush; -import net.minecraft.block.BlockDirt; -import net.minecraft.block.BlockFarmland; -import net.minecraft.block.BlockGrass; -import net.minecraft.block.IGrowable; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.*; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.Entity; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -35,12 +30,12 @@ public class EntityWorm extends Entity { this.setEntityBoundingBox(new AxisAlignedBB(0, 0, 0, 0, 0, 0)); } - public static boolean canWormify(World world, BlockPos pos, IBlockState state) { + public static boolean canWormify(World world, BlockPos pos, BlockState state) { Block block = state.getBlock(); boolean rightBlock = block instanceof BlockFarmland || block instanceof BlockDirt || block instanceof BlockGrass; if (rightBlock) { BlockPos posUp = pos.up(); - IBlockState stateUp = world.getBlockState(posUp); + BlockState stateUp = world.getBlockState(posUp); Block blockUp = stateUp.getBlock(); return blockUp instanceof IPlantable || blockUp instanceof BlockBush || blockUp.isReplaceable(world, posUp); } else { @@ -54,12 +49,12 @@ public class EntityWorm extends Entity { } @Override - protected void readEntityFromNBT(NBTTagCompound compound) { + protected void readEntityFromNBT(CompoundNBT compound) { this.timer = compound.getInteger("Timer"); } @Override - protected void writeEntityToNBT(NBTTagCompound compound) { + protected void writeEntityToNBT(CompoundNBT compound) { compound.setInteger("Timer", this.timer); } @@ -77,7 +72,7 @@ public class EntityWorm extends Entity { for (int x = -1; x <= 1; x++) { for (int z = -1; z <= 1; z++) { BlockPos pos = new BlockPos(this.posX + x, this.posY, this.posZ + z); - IBlockState state = this.world.getBlockState(pos); + BlockState state = this.world.getBlockState(pos); Block block = state.getBlock(); boolean isMiddlePose = x == 0 && z == 0; @@ -87,24 +82,28 @@ public class EntityWorm extends Entity { if (!isFarmland || state.getValue(BlockFarmland.MOISTURE) < 7) { if (isMiddlePose || this.world.rand.nextFloat() >= 0.45F) { - if (!isFarmland) DefaultFarmerBehavior.useHoeAt(this.world, pos); + if (!isFarmland) { + DefaultFarmerBehavior.useHoeAt(this.world, pos); + } state = this.world.getBlockState(pos); isFarmland = state.getBlock() instanceof BlockFarmland; - if (isFarmland) this.world.setBlockState(pos, state.withProperty(BlockFarmland.MOISTURE, 7), 2); + if (isFarmland) { + this.world.setBlockState(pos, state.withProperty(BlockFarmland.MOISTURE, 7), 2); + } } } if (isFarmland && this.world.rand.nextFloat() >= 0.95F) { BlockPos plant = pos.up(); if (!this.world.isAirBlock(plant)) { - IBlockState plantState = this.world.getBlockState(plant); + BlockState plantState = this.world.getBlockState(plant); Block plantBlock = plantState.getBlock(); if ((plantBlock instanceof IGrowable || plantBlock instanceof IPlantable) && !(plantBlock instanceof BlockGrass)) { plantBlock.updateTick(this.world, plant, plantState, this.world.rand); - IBlockState newState = this.world.getBlockState(plant); + BlockState newState = this.world.getBlockState(plant); if (newState != plantState) { this.world.playEvent(2005, plant, 0); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/InitEntities.java b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/InitEntities.java index 643cf3402..075d2c81e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/InitEntities.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/InitEntities.java @@ -15,7 +15,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public final class InitEntities { @@ -25,7 +25,7 @@ public final class InitEntities { EntityRegistry.registerModEntity(new ResourceLocation(ActuallyAdditions.MODID, "worm"), EntityWorm.class, ActuallyAdditions.MODID + ".worm", 0, ActuallyAdditions.INSTANCE, 64, 1, false); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void initClient() { RenderingRegistry.registerEntityRenderingHandler(EntityWorm.class, RenderWorm::new); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/RenderWorm.java b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/RenderWorm.java index 761e11775..440d0d8f2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/RenderWorm.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/RenderWorm.java @@ -20,9 +20,9 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class RenderWorm extends Render { private static ItemStack stack = ItemStack.EMPTY; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java index 50c8864ab..663bd6821 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.event; -import java.util.Locale; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay; import de.ellpeck.actuallyadditions.mod.config.ConfigValues; @@ -29,11 +27,11 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.RayTraceResult; @@ -44,11 +42,12 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.oredict.OreDictionary; -@SideOnly(Side.CLIENT) +import java.util.Locale; + +@OnlyIn(Dist.CLIENT) public class ClientEvents { private static final String ADVANCED_INFO_TEXT_PRE = TextFormatting.DARK_GRAY + " "; @@ -63,7 +62,7 @@ public class ClientEvents { @SubscribeEvent public void onClientTick(ClientTickEvent event) { if (event.phase == Phase.END) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); if (mc.world == null) { WorldData.clear(); @@ -125,7 +124,9 @@ public class ClientEvents { int meta = event.getItemStack().getItemDamage(); int max = event.getItemStack().getMaxDamage(); event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".meta.desc") + ":"); - event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + meta + (max > 0 ? "/" + max : "")); + event.getToolTip().add(ADVANCED_INFO_TEXT_PRE + meta + (max > 0 + ? "/" + max + : "")); //Unlocalized Name String metaName = event.getItemStack().getItem().getTranslationKey(event.getItemStack()); @@ -135,7 +136,7 @@ public class ClientEvents { } //NBT - NBTTagCompound compound = event.getItemStack().getTagCompound(); + CompoundNBT compound = event.getItemStack().getTagCompound(); if (compound != null && !compound.isEmpty()) { event.getToolTip().add(ADVANCED_INFO_HEADER_PRE + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".nbt.desc") + ":"); if (GuiScreen.isShiftKeyDown()) { @@ -169,9 +170,9 @@ public class ClientEvents { @SubscribeEvent public void onGameOverlay(RenderGameOverlayEvent.Post event) { - if (event.getType() == RenderGameOverlayEvent.ElementType.ALL && Minecraft.getMinecraft().currentScreen == null) { - Minecraft minecraft = Minecraft.getMinecraft(); - EntityPlayer player = minecraft.player; + if (event.getType() == RenderGameOverlayEvent.ElementType.ALL && Minecraft.getInstance().currentScreen == null) { + Minecraft minecraft = Minecraft.getInstance(); + PlayerEntity player = minecraft.player; RayTraceResult posHit = minecraft.objectMouseOver; FontRenderer font = minecraft.fontRenderer; ItemStack stack = player.getHeldItemMainhand(); @@ -193,7 +194,9 @@ public class ClientEvents { if (tileHit instanceof TileEntityBase) { TileEntityBase base = (TileEntityBase) tileHit; if (base.isRedstoneToggle()) { - String strg = String.format("%s: %s", StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode.name"), TextFormatting.DARK_RED + StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode." + (base.isPulseMode ? "pulse" : "deactivation")) + TextFormatting.RESET); + String strg = String.format("%s: %s", StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode.name"), TextFormatting.DARK_RED + StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode." + (base.isPulseMode + ? "pulse" + : "deactivation")) + TextFormatting.RESET); font.drawStringWithShadow(strg, event.getResolution().getScaledWidth() / 2 + 5, event.getResolution().getScaledHeight() / 2 + 5, StringUtil.DECIMAL_COLOR_WHITE); String expl; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java index 04fec3e6b..904393908 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.event; -import java.util.Locale; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.data.PlayerData; @@ -26,11 +24,11 @@ import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.monster.EntitySpider; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.living.LivingDropsEvent; @@ -40,11 +38,13 @@ import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent; +import java.util.Locale; + public class CommonEvents { @SubscribeEvent public void onBlockBreakEvent(BlockEvent.HarvestDropsEvent event) { - IBlockState state = event.getState(); + BlockState state = event.getState(); if (state != null && state.getBlock() == Blocks.MOB_SPAWNER) { event.getDrops().add(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.SPAWNER_SHARD.ordinal())); } @@ -52,9 +52,11 @@ public class CommonEvents { @SubscribeEvent public void onItemPickup(EntityItemPickupEvent event) { - if (event.isCanceled() || event.getResult() == Event.Result.ALLOW) { return; } + if (event.isCanceled() || event.getResult() == Event.Result.ALLOW) { + return; + } - EntityPlayer player = event.getEntityPlayer(); + PlayerEntity player = event.getEntityPlayer(); EntityItem item = event.getItem(); if (item != null && !item.isDead) { ItemStack stack = item.getItem(); @@ -123,7 +125,7 @@ public class CommonEvents { } //TODO Checking Achievements? - /*public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){ + /*public static void checkAchievements(ItemStack gotten, PlayerEntity player, InitAchievements.Type type){ if(gotten != null && player != null){ for(TheAchievements ach : TheAchievements.values()){ if(ach.type == type){ @@ -137,7 +139,7 @@ public class CommonEvents { @SubscribeEvent public void onEntityDropEvent(LivingDropsEvent event) { - if (event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote && event.getSource().getTrueSource() instanceof EntityPlayer) { + if (event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote && event.getSource().getTrueSource() instanceof PlayerEntity) { //Drop Cobwebs from Spiders if (ConfigBoolValues.DO_SPIDER_DROPS.isEnabled() && event.getEntityLiving() instanceof EntitySpider) { if (event.getEntityLiving().world.rand.nextInt(20) <= event.getLootingLevel() * 2) { @@ -149,8 +151,8 @@ public class CommonEvents { @SubscribeEvent public void onLogInEvent(PlayerEvent.PlayerLoggedInEvent event) { - if (!event.player.world.isRemote && event.player instanceof EntityPlayerMP) { - EntityPlayerMP player = (EntityPlayerMP) event.player; + if (!event.player.world.isRemote && event.player instanceof ServerPlayerEntity) { + ServerPlayerEntity player = (ServerPlayerEntity) event.player; PacketHandlerHelper.syncPlayerData(player, true); ActuallyAdditions.LOGGER.info("Sending Player Data to player " + player.getName() + " with UUID " + player.getUniqueID() + "."); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/AAWorldGen.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/AAWorldGen.java index 3db235c7d..9aaf6ad9e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/AAWorldGen.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/AAWorldGen.java @@ -28,7 +28,7 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockHorizontal; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.block.state.pattern.BlockMatcher; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -93,7 +93,7 @@ public class AAWorldGen implements IWorldGenerator { } } - public void addOreSpawn(IBlockState state, Block blockIn, World world, Random random, int blockXPos, int blockZPos, int maxVeinSize, int chancesToSpawn, int minY, int maxY) { + public void addOreSpawn(BlockState state, Block blockIn, World world, Random random, int blockXPos, int blockZPos, int maxVeinSize, int chancesToSpawn, int minY, int maxY) { for (int i = 0; i < chancesToSpawn; i++) { int posX = blockXPos + random.nextInt(16); int posY = minY + random.nextInt(maxY - minY); @@ -108,7 +108,7 @@ public class AAWorldGen implements IWorldGenerator { if (event.getType() == EventType.FLOWERS) { if (!ArrayUtils.contains(ConfigIntListValues.PLANT_DIMENSION_BLACKLIST.getValue(), event.getWorld().provider.getDimension())) { this.generateRice(event); - IBlockState plantDefault = InitBlocks.blockWildPlant.getDefaultState(); + BlockState plantDefault = InitBlocks.blockWildPlant.getDefaultState(); this.genPlantNormally(plantDefault.withProperty(BlockWildPlant.TYPE, TheWildPlants.CANOLA), ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.GRASS, event); this.genPlantNormally(plantDefault.withProperty(BlockWildPlant.TYPE, TheWildPlants.FLAX), ConfigIntValues.FLAX_AMOUNT.getValue(), ConfigBoolValues.DO_FLAX_GEN.isEnabled(), Material.GRASS, event); this.genPlantNormally(plantDefault.withProperty(BlockWildPlant.TYPE, TheWildPlants.COFFEE), ConfigIntValues.COFFEE_AMOUNT.getValue(), ConfigBoolValues.DO_COFFEE_GEN.isEnabled(), Material.GRASS, event); @@ -159,7 +159,7 @@ public class AAWorldGen implements IWorldGenerator { } } - private void genPlantNormally(IBlockState plant, int amount, boolean doIt, Material blockBelow, DecorateBiomeEvent event) { + private void genPlantNormally(BlockState plant, int amount, boolean doIt, Material blockBelow, DecorateBiomeEvent event) { if (doIt) { for (int i = 0; i < amount; i++) { if (event.getRand().nextInt(100) == 0) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java index 0304811cf..c1662a929 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/WorldGenLushCaves.java @@ -21,7 +21,7 @@ import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest; import net.minecraft.block.Block; import net.minecraft.block.BlockDirectional; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -78,8 +78,8 @@ public class WorldGenLushCaves { BlockPos posSide = pos.offset(side); if (!this.checkIndestructable(world, posSide)) { - IBlockState state = world.getBlockState(pos); - IBlockState stateSide = world.getBlockState(posSide); + BlockState state = world.getBlockState(pos); + BlockState stateSide = world.getBlockState(posSide); if (state.getBlock().isAir(state, world, pos) && stateSide.isSideSolid(world, posSide, side.getOpposite())) { Block block = CRYSTAL_CLUSTERS[rand.nextInt(CRYSTAL_CLUSTERS.length)]; @@ -118,7 +118,7 @@ public class WorldGenLushCaves { if (ConfigBoolValues.DUNGEON_LOOT.isEnabled() && !crateGenDone && genCrate) { BlockPos cratePos = pos.add(MathHelper.getInt(rand, -2, 2), MathHelper.getInt(rand, 3, 8), MathHelper.getInt(rand, -2, 2)); - IBlockState state = world.getBlockState(cratePos); + BlockState state = world.getBlockState(cratePos); if (state != null && state.getBlock().isLeaves(state, world, cratePos)) { world.setBlockState(cratePos, InitBlocks.blockGiantChest.getDefaultState(), 2); @@ -157,11 +157,11 @@ public class WorldGenLushCaves { for (double y = -radius; y <= -3; y++) { BlockPos pos = center.add(x, y, z); if (boundingBox.isVecInside(pos) && !this.checkIndestructable(world, pos)) { - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); BlockPos posUp = pos.up(); if (!this.checkIndestructable(world, posUp)) { - IBlockState stateUp = world.getBlockState(posUp); + BlockState stateUp = world.getBlockState(posUp); if (!state.getBlock().isAir(state, world, pos) && stateUp.getBlock().isAir(stateUp, world, posUp)) { world.setBlockState(pos, Blocks.GRASS.getDefaultState(), 2); } @@ -177,7 +177,7 @@ public class WorldGenLushCaves { TileEntity tile = world.getTileEntity(pos); if (tile instanceof ILootContainer) { return true; } - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); if (state != null) { Block block = state.getBlock(); //check if it's tree or grass that is generated here @@ -186,4 +186,4 @@ public class WorldGenLushCaves { } return true; } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentCustomCropField.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentCustomCropField.java index 7b5d38de2..591805d70 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentCustomCropField.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentCustomCropField.java @@ -16,7 +16,7 @@ import java.util.Random; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import net.minecraft.block.Block; import net.minecraft.block.BlockCrops; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.MathHelper; @@ -97,7 +97,7 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous } } - private IBlockState getRandomCropType(Random rand) { + private BlockState getRandomCropType(Random rand) { int randomMeta = MathHelper.getInt(rand, 1, 7); switch (rand.nextInt(4)) { case 0: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentJamHouse.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentJamHouse.java index d9be48266..0ccf60ba4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentJamHouse.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentJamHouse.java @@ -23,7 +23,7 @@ import net.minecraft.block.BlockDoor; import net.minecraft.block.BlockLeaves; import net.minecraft.block.BlockStairs; import net.minecraft.block.BlockTorch; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -166,8 +166,8 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1 { //Roof this.fillWithBlocks(world, sbb, 1, 6, 3, 9, 6, 5, Blocks.PLANKS); - IBlockState stairSouth = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.SOUTH); - IBlockState stairNorth = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.NORTH); + BlockState stairSouth = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.SOUTH); + BlockState stairNorth = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.NORTH); this.fillWithBlocks(world, sbb, 0, 4, 0, 10, 4, 0, stairNorth, stairNorth, false); this.fillWithBlocks(world, sbb, 0, 5, 1, 10, 5, 1, stairNorth, stairNorth, false); this.fillWithBlocks(world, sbb, 0, 6, 2, 10, 6, 2, stairNorth, stairNorth, false); @@ -204,7 +204,7 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1 { this.setBlockState(world, Blocks.LEAVES.getDefaultState().withProperty(BlockLeaves.DECAYABLE, false), 8, 2, 2, sbb); this.setBlockState(world, Blocks.OAK_FENCE.getDefaultState(), 2, 1, 6, sbb); this.setBlockState(world, Blocks.LEAVES.getDefaultState().withProperty(BlockLeaves.DECAYABLE, false), 2, 2, 6, sbb); - IBlockState stairWest = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.WEST); + BlockState stairWest = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.WEST); this.fillWithBlocks(world, sbb, 2, 1, 3, 2, 1, 5, stairWest, stairWest, false); this.fillWithBlocks(world, sbb, 3, 1, 2, 5, 1, 3, Blocks.CARPET.getStateFromMeta(10), Blocks.CARPET.getStateFromMeta(10), false); this.fillWithBlocks(world, sbb, 3, 1, 4, 4, 1, 6, Blocks.CARPET.getStateFromMeta(10), Blocks.CARPET.getStateFromMeta(10), false); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBag.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBag.java index 0c9e9f106..7dff34908 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBag.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBag.java @@ -10,11 +10,6 @@ package de.ellpeck.actuallyadditions.mod.inventory; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.tuple.Pair; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotDeletion; @@ -27,19 +22,23 @@ import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; import net.minecraft.inventory.IContainerListener; import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.common.registry.ForgeRegistries; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; +import org.apache.commons.lang3.tuple.Pair; + +import java.util.ArrayList; +import java.util.List; public class ContainerBag extends Container implements IButtonReactor { @@ -98,7 +97,7 @@ public class ContainerBag extends Container implements IButtonReactor { if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemBag) { ItemDrill.loadSlotsFromNBT(this.bagInventory, inventory.getCurrentItem()); if (stack.hasTagCompound()) { - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); this.filter.readFromNBT(compound, "Filter"); this.autoInsert = compound.getBoolean("AutoInsert"); } @@ -106,7 +105,9 @@ public class ContainerBag extends Container implements IButtonReactor { } public static int getSlotAmount(boolean isVoid) { - return isVoid ? 1 : 28; + return isVoid + ? 1 + : 28; } @Override @@ -115,12 +116,22 @@ public class ContainerBag extends Container implements IButtonReactor { if (this.filter.needsUpdateSend() || this.autoInsert != this.oldAutoInsert) { for (IContainerListener listener : this.listeners) { - listener.sendWindowProperty(this, 0, this.filter.isWhitelist ? 1 : 0); - listener.sendWindowProperty(this, 1, this.filter.respectMeta ? 1 : 0); - listener.sendWindowProperty(this, 2, this.filter.respectNBT ? 1 : 0); + listener.sendWindowProperty(this, 0, this.filter.isWhitelist + ? 1 + : 0); + listener.sendWindowProperty(this, 1, this.filter.respectMeta + ? 1 + : 0); + listener.sendWindowProperty(this, 2, this.filter.respectNBT + ? 1 + : 0); listener.sendWindowProperty(this, 3, this.filter.respectOredict); - listener.sendWindowProperty(this, 4, this.autoInsert ? 1 : 0); - listener.sendWindowProperty(this, 5, this.filter.respectMod ? 1 : 0); + listener.sendWindowProperty(this, 4, this.autoInsert + ? 1 + : 0); + listener.sendWindowProperty(this, 5, this.filter.respectMod + ? 1 + : 0); } this.filter.updateLasts(); this.oldAutoInsert = this.autoInsert; @@ -128,7 +139,7 @@ public class ContainerBag extends Container implements IButtonReactor { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void updateProgressBar(int id, int data) { if (id == 0) { this.filter.isWhitelist = data == 1; @@ -146,7 +157,7 @@ public class ContainerBag extends Container implements IButtonReactor { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = this.bagInventory.getSlots() + 4; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -163,12 +174,18 @@ public class ContainerBag extends Container implements IButtonReactor { //Shift from Inventory if (this.isVoid || !this.filter.check(newStack) || !this.mergeItemStack(newStack, 4, 32, false)) { if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } + if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + return StackUtil.getEmpty(); + } + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + return StackUtil.getEmpty(); + } } // - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } + } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + return StackUtil.getEmpty(); + } if (!StackUtil.isValid(newStack)) { theSlot.putStack(StackUtil.getEmpty()); @@ -176,7 +193,9 @@ public class ContainerBag extends Container implements IButtonReactor { theSlot.onSlotChanged(); } - if (newStack.getCount() == currentStack.getCount()) { return StackUtil.getEmpty(); } + if (newStack.getCount() == currentStack.getCount()) { + return StackUtil.getEmpty(); + } theSlot.onTake(player, newStack); return currentStack; @@ -185,7 +204,7 @@ public class ContainerBag extends Container implements IButtonReactor { } @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) { + public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { if (SlotFilter.checkFilter(this, slotId, player)) { return StackUtil.getEmpty(); } else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.currentItem) { @@ -196,11 +215,11 @@ public class ContainerBag extends Container implements IButtonReactor { } @Override - public void onContainerClosed(EntityPlayer player) { + public void onContainerClosed(PlayerEntity player) { ItemStack stack = this.inventory.getCurrentItem(); if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemBag) { ItemDrill.writeSlotsToNBT(this.bagInventory, this.inventory.getCurrentItem()); - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); this.filter.writeToNBT(compound, "Filter"); compound.setBoolean("AutoInsert", this.autoInsert); } @@ -208,12 +227,12 @@ public class ContainerBag extends Container implements IButtonReactor { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return !this.sack.isEmpty() && player.getHeldItemMainhand() == this.sack; } @Override - public void onButtonPressed(int buttonID, EntityPlayer player) { + public void onButtonPressed(int buttonID, PlayerEntity player) { if (buttonID == 0) { this.autoInsert = !this.autoInsert; } else { @@ -235,12 +254,13 @@ public class ContainerBag extends Container implements IButtonReactor { ActuallyAdditions.LOGGER.error("Invalid item in sack blacklist: " + s); continue; } - if (split.length == 1) BLACKLIST.add(Pair.of(item, 0)); - else if (split.length == 2) { + if (split.length == 1) { + BLACKLIST.add(Pair.of(item, 0)); + } else if (split.length == 2) { BLACKLIST.add(Pair.of(item, Integer.parseInt(split[1]))); } } } return BLACKLIST.contains(Pair.of(stack.getItem(), stack.getMetadata())); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java index 172ee7928..099147dff 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -44,7 +44,7 @@ public class ContainerBioReactor extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 8; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -84,7 +84,7 @@ public class ContainerBioReactor extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.tile.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java index 45be35e3e..85f7e71ca 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -44,7 +44,7 @@ public class ContainerBreaker extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -82,7 +82,7 @@ public class ContainerBreaker extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.breaker.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java index 712f513fe..98c7e21ad 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java @@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -42,7 +42,7 @@ public class ContainerCanolaPress extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 1; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -82,7 +82,7 @@ public class ContainerCanolaPress extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.press.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java index 01e1422d3..7163aeccf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -41,7 +41,7 @@ public class ContainerCoalGenerator extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 1; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -81,7 +81,7 @@ public class ContainerCoalGenerator extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.generator.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java index 5c210df53..ee579b907 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java @@ -18,7 +18,7 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -52,7 +52,7 @@ public class ContainerCoffeeMachine extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 11; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -101,7 +101,7 @@ public class ContainerCoffeeMachine extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.machine.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java index 4a0c6ce72..cfc8b0ed0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -44,7 +44,7 @@ public class ContainerDirectionalBreaker extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -82,7 +82,7 @@ public class ContainerDirectionalBreaker extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.breaker.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java index 4313404ec..ca8812089 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java @@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.items.ItemDrill; import de.ellpeck.actuallyadditions.mod.items.ItemDrillUpgrade; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; @@ -62,7 +62,7 @@ public class ContainerDrill extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 5; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -102,7 +102,7 @@ public class ContainerDrill extends Container { } @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) { + public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.currentItem) { return ItemStack.EMPTY; } else { @@ -111,7 +111,7 @@ public class ContainerDrill extends Container { } @Override - public void onContainerClosed(EntityPlayer player) { + public void onContainerClosed(PlayerEntity player) { ItemStack stack = this.inventory.getCurrentItem(); if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemDrill) { ItemDrill.writeSlotsToNBT(this.drillInventory, this.inventory.getCurrentItem()); @@ -120,7 +120,7 @@ public class ContainerDrill extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return true; } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java index a839ba4c7..e3d90605c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java @@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -24,9 +24,9 @@ import net.minecraft.item.ItemStack; public class ContainerDropper extends Container { private final TileEntityDropper dropper; - EntityPlayer player; + PlayerEntity player; - public ContainerDropper(EntityPlayer player, TileEntityBase tile) { + public ContainerDropper(PlayerEntity player, TileEntityBase tile) { this.dropper = (TileEntityDropper) tile; this.player = player; InventoryPlayer inventory = player.inventory; @@ -47,7 +47,7 @@ public class ContainerDropper extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -85,13 +85,13 @@ public class ContainerDropper extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.dropper.canPlayerUse(player); } @Override - public void onContainerClosed(EntityPlayer playerIn) { + public void onContainerClosed(PlayerEntity playerIn) { super.onContainerClosed(playerIn); if (!this.player.isSpectator()) this.dropper.getWorld().notifyNeighborsOfStateChange(this.dropper.getPos(), InitBlocks.blockDropper, false); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java index 066786a94..ecc3efbca 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java @@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.EntityEquipmentSlot; @@ -25,14 +25,14 @@ import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class ContainerEnergizer extends Container { public static final EntityEquipmentSlot[] VALID_EQUIPMENT_SLOTS = new EntityEquipmentSlot[] { EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET }; private final TileEntityEnergizer energizer; - public ContainerEnergizer(final EntityPlayer player, TileEntityBase tile) { + public ContainerEnergizer(final PlayerEntity player, TileEntityBase tile) { this.energizer = (TileEntityEnergizer) tile; InventoryPlayer inventory = player.inventory; @@ -67,13 +67,13 @@ public class ContainerEnergizer extends Container { } @Override - public boolean canTakeStack(EntityPlayer player) { + public boolean canTakeStack(PlayerEntity player) { ItemStack itemstack = this.getStack(); return !itemstack.isEmpty() && !player.isCreative() && EnchantmentHelper.hasBindingCurse(itemstack) ? false : super.canTakeStack(player); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getSlotTexture() { return ItemArmor.EMPTY_SLOT_NAMES[slot.getIndex()]; } @@ -82,7 +82,7 @@ public class ContainerEnergizer extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 2; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -127,7 +127,7 @@ public class ContainerEnergizer extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.energizer.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java index e607122bb..b2acf7f9d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java @@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.EntityEquipmentSlot; @@ -24,13 +24,13 @@ import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class ContainerEnervator extends Container { private final TileEntityEnervator enervator; - public ContainerEnervator(final EntityPlayer player, TileEntityBase tile) { + public ContainerEnervator(final PlayerEntity player, TileEntityBase tile) { this.enervator = (TileEntityEnervator) tile; InventoryPlayer inventory = player.inventory; @@ -60,7 +60,7 @@ public class ContainerEnervator extends Container { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getSlotTexture() { return ItemArmor.EMPTY_SLOT_NAMES[slot.getIndex()]; } @@ -69,7 +69,7 @@ public class ContainerEnervator extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 2; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -114,7 +114,7 @@ public class ContainerEnervator extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.enervator.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java index a680ad5d8..f024a4829 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -49,7 +49,7 @@ public class ContainerFarmer extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 12; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -87,7 +87,7 @@ public class ContainerFarmer extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.farmer.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java index 909a68e92..bff89e9da 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -39,7 +39,7 @@ public class ContainerFeeder extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 1; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -77,7 +77,7 @@ public class ContainerFeeder extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.tileFeeder.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java index bd9f51091..0fa1a6c0a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java @@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -37,7 +37,7 @@ public class ContainerFermentingBarrel extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 0; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -71,7 +71,7 @@ public class ContainerFermentingBarrel extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.barrel.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java index afa306218..550e9e603 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java @@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotImmovable; import de.ellpeck.actuallyadditions.mod.items.ItemDrill; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; @@ -58,7 +58,7 @@ public class ContainerFilter extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = SLOT_AMOUNT; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -94,7 +94,7 @@ public class ContainerFilter extends Container { } @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) { + public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { if (SlotFilter.checkFilter(this, slotId, player)) { return StackUtil.getEmpty(); } else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.currentItem) { @@ -105,7 +105,7 @@ public class ContainerFilter extends Container { } @Override - public void onContainerClosed(EntityPlayer player) { + public void onContainerClosed(PlayerEntity player) { ItemStack stack = this.inventory.getCurrentItem(); if (SlotFilter.isFilter(stack)) { ItemDrill.writeSlotsToNBT(this.filterInventory, this.inventory.getCurrentItem()); @@ -114,7 +114,7 @@ public class ContainerFilter extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return true; } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFireworkBox.java index 319210ce0..deda0a006 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFireworkBox.java @@ -10,19 +10,19 @@ package de.ellpeck.actuallyadditions.mod.inventory; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; public class ContainerFireworkBox extends Container { @Override - public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) { + public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { return ItemStack.EMPTY; } @Override - public boolean canInteractWith(EntityPlayer playerIn) { + public boolean canInteractWith(PlayerEntity playerIn) { return true; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java index 1fbf30a60..78dbca4fb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java @@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -37,7 +37,7 @@ public class ContainerFluidCollector extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 0; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -76,7 +76,7 @@ public class ContainerFluidCollector extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.collector.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java index c11205223..ce1c400d2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java @@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -45,7 +45,7 @@ public class ContainerFurnaceDouble extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 4; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -92,7 +92,7 @@ public class ContainerFurnaceDouble extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.tileFurnace.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java index 4ea41feeb..a5b6d5d8b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java @@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import invtweaks.api.container.ChestContainer; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -46,7 +46,7 @@ public class ContainerGiantChest extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 117; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -84,7 +84,7 @@ public class ContainerGiantChest extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.tileChest.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java index 2edaab084..6c92a6c80 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java @@ -16,10 +16,10 @@ import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.container.Container; +import net.minecraft.inventory.container.Slot; import net.minecraft.item.ItemStack; public class ContainerGrinder extends Container { @@ -27,13 +27,19 @@ public class ContainerGrinder extends Container { public final TileEntityGrinder tileGrinder; private final boolean isDouble; - public ContainerGrinder(InventoryPlayer inventory, TileEntityBase tile, boolean isDouble) { + public ContainerGrinder(PlayerInventory inventory, TileEntityBase tile, boolean isDouble) { this.tileGrinder = (TileEntityGrinder) tile; this.isDouble = isDouble; - this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.tileGrinder.inv, TileEntityGrinder.SLOT_INPUT_1, this.isDouble ? 51 : 80, 21)); - this.addSlotToContainer(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_1_1, this.isDouble ? 37 : 66, 69)); - this.addSlotToContainer(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_1_2, this.isDouble ? 64 : 92, 69)); + this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.tileGrinder.inv, TileEntityGrinder.SLOT_INPUT_1, this.isDouble + ? 51 + : 80, 21)); + this.addSlotToContainer(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_1_1, this.isDouble + ? 37 + : 66, 69)); + this.addSlotToContainer(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_1_2, this.isDouble + ? 64 + : 92, 69)); if (this.isDouble) { this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.tileGrinder.inv, TileEntityGrinder.SLOT_INPUT_2, 109, 21)); this.addSlotToContainer(new SlotOutput(this.tileGrinder.inv, TileEntityGrinder.SLOT_OUTPUT_2_1, 96, 69)); @@ -51,8 +57,10 @@ public class ContainerGrinder extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { - int inventoryStart = this.isDouble ? 6 : 3; + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + int inventoryStart = this.isDouble + ? 6 + : 3; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; @@ -65,7 +73,9 @@ public class ContainerGrinder extends Container { //Slots in Inventory to shift from if (slot == TileEntityGrinder.SLOT_OUTPUT_1_1 || slot == TileEntityGrinder.SLOT_OUTPUT_1_2 || this.isDouble && (slot == TileEntityGrinder.SLOT_OUTPUT_2_1 || slot == TileEntityGrinder.SLOT_OUTPUT_2_2)) { - if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, true)) { return StackUtil.getEmpty(); } + if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, true)) { + return StackUtil.getEmpty(); + } theSlot.onSlotChange(newStack, currentStack); } //Other Slots in Inventory excluded @@ -74,7 +84,9 @@ public class ContainerGrinder extends Container { if (CrusherRecipeRegistry.getRecipeFromInput(newStack) != null) { if (!this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_1, TileEntityGrinder.SLOT_INPUT_1 + 1, false)) { if (this.isDouble) { - if (!this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_2, TileEntityGrinder.SLOT_INPUT_2 + 1, false)) { return StackUtil.getEmpty(); } + if (!this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_2, TileEntityGrinder.SLOT_INPUT_2 + 1, false)) { + return StackUtil.getEmpty(); + } } else { return StackUtil.getEmpty(); } @@ -83,9 +95,15 @@ public class ContainerGrinder extends Container { // else if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } + if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + return StackUtil.getEmpty(); + } + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + return StackUtil.getEmpty(); + } + } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + return StackUtil.getEmpty(); + } if (!StackUtil.isValid(newStack)) { theSlot.putStack(StackUtil.getEmpty()); @@ -93,7 +111,9 @@ public class ContainerGrinder extends Container { theSlot.onSlotChanged(); } - if (newStack.getCount() == currentStack.getCount()) { return StackUtil.getEmpty(); } + if (newStack.getCount() == currentStack.getCount()) { + return StackUtil.getEmpty(); + } theSlot.onTake(player, newStack); return currentStack; @@ -102,7 +122,7 @@ public class ContainerGrinder extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.tileGrinder.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java index dc5e6116c..ab5524672 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java @@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; @@ -56,7 +56,7 @@ public class ContainerInputter extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = this.isAdvanced ? 25 : 1; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -94,7 +94,7 @@ public class ContainerInputter extends Container { } @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) { + public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { if (SlotFilter.checkFilter(this, slotId, player)) { return StackUtil.getEmpty(); } else { @@ -103,7 +103,7 @@ public class ContainerInputter extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.tileInputter.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java index 178b98bf4..cdc715fa9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; @@ -47,7 +47,7 @@ public class ContainerLaserRelayItemWhitelist extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 24; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -81,7 +81,7 @@ public class ContainerLaserRelayItemWhitelist extends Container { } @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) { + public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { if (SlotFilter.checkFilter(this, slotId, player)) { return StackUtil.getEmpty(); } else { @@ -90,7 +90,7 @@ public class ContainerLaserRelayItemWhitelist extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.tile.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java index b85faa13f..31902aff3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -44,7 +44,7 @@ public class ContainerMiner extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -82,7 +82,7 @@ public class ContainerMiner extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.miner.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java index 3c96a3230..7aa0a2c95 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java @@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -37,7 +37,7 @@ public class ContainerOilGenerator extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 0; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -71,7 +71,7 @@ public class ContainerOilGenerator extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.generator.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java index 69ad4b61c..f32cfe114 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -44,7 +44,7 @@ public class ContainerPhantomPlacer extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -82,7 +82,7 @@ public class ContainerPhantomPlacer extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.placer.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java index b5e360a40..dbfbaa26b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java @@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; @@ -51,7 +51,7 @@ public class ContainerRangedCollector extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 18; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -89,7 +89,7 @@ public class ContainerRangedCollector extends Container { } @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) { + public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { if (SlotFilter.checkFilter(this, slotId, player)) { return StackUtil.getEmpty(); } else { @@ -98,7 +98,7 @@ public class ContainerRangedCollector extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.collector.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRepairer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRepairer.java index 6ca69a116..c177ff70f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRepairer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRepairer.java @@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -42,7 +42,7 @@ public class ContainerRepairer extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 2; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -82,7 +82,7 @@ public class ContainerRepairer extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.tileRepairer.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerSmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerSmileyCloud.java index 6cfd89925..85cd101c3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerSmileyCloud.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerSmileyCloud.java @@ -10,19 +10,19 @@ package de.ellpeck.actuallyadditions.mod.inventory; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; public class ContainerSmileyCloud extends Container { @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { return ItemStack.EMPTY; } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return true; } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java index c2fb8ceee..13b795cad 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java @@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.items.ItemSolidifiedExperience; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -43,7 +43,7 @@ public class ContainerXPSolidifier extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + public ItemStack transferStackInSlot(PlayerEntity player, int slot) { int inventoryStart = 2; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -79,7 +79,7 @@ public class ContainerXPSolidifier extends Container { } @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(PlayerEntity player) { return this.solidifier.canPlayerUse(player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiFireworkBox.java index 98c518c36..991a9b288 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiFireworkBox.java @@ -19,9 +19,9 @@ import net.minecraft.client.gui.GuiSlider; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiFireworkBox extends GuiContainer implements GuiResponder { private final TileEntityFireworkBox tile; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java index 18c7f7879..897d5a4c3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java @@ -46,7 +46,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiXPSolidifier; import de.ellpeck.actuallyadditions.mod.items.ItemBooklet; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.IGuiHandler; @@ -60,7 +60,7 @@ public class GuiHandler implements IGuiHandler { } @Override - public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { + public Object getServerGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) { TileEntityBase tile = null; if (GuiTypes.values()[id].checkTileEntity) { tile = (TileEntityBase) world.getTileEntity(new BlockPos(x, y, z)); @@ -142,7 +142,7 @@ public class GuiHandler implements IGuiHandler { } @Override - public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { + public Object getClientGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) { TileEntityBase tile = null; if (GuiTypes.values()[id].checkTileEntity) { tile = (TileEntityBase) world.getTileEntity(new BlockPos(x, y, z)); @@ -284,4 +284,4 @@ public class GuiHandler implements IGuiHandler { this.checkTileEntity = checkTileEntity; } } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java index 534d7a3ad..8d7ada93b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java @@ -10,10 +10,6 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; @@ -22,10 +18,13 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.List; + +@OnlyIn(Dist.CLIENT) public class EnergyDisplay extends Gui { private CustomEnergyStorage rfReference; @@ -51,7 +50,7 @@ public class EnergyDisplay extends Gui { } public void draw() { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); int barX = this.x; @@ -81,7 +80,7 @@ public class EnergyDisplay extends Gui { public void drawOverlay(int mouseX, int mouseY) { if (this.isMouseOver(mouseX, mouseY)) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); List text = new ArrayList<>(); text.add(this.getOverlayText()); @@ -90,7 +89,11 @@ public class EnergyDisplay extends Gui { } private boolean isMouseOver(int mouseX, int mouseY) { - return mouseX >= this.x && mouseY >= this.y && mouseX < this.x + (this.outline ? 26 : 18) && mouseY < this.y + (this.outline ? 93 : 85); + return mouseX >= this.x && mouseY >= this.y && mouseX < this.x + (this.outline + ? 26 + : 18) && mouseY < this.y + (this.outline + ? 93 + : 85); } private String getOverlayText() { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java index 16022195f..0325bd6c6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java @@ -10,10 +10,6 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter.SmallerButton; import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; @@ -23,10 +19,13 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiButton; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +@OnlyIn(Dist.CLIENT) public class FilterSettingsGui extends Gui { private final FilterSettings theSettings; @@ -59,35 +58,59 @@ public class FilterSettingsGui extends Gui { } public void update() { - this.whitelistButton.displayString = (this.theSettings.isWhitelist ? TextFormatting.DARK_GREEN : TextFormatting.RED) + "WH"; - this.metaButton.displayString = (this.theSettings.respectMeta ? TextFormatting.DARK_GREEN : TextFormatting.RED) + "ME"; - this.nbtButton.displayString = (this.theSettings.respectNBT ? TextFormatting.DARK_GREEN : TextFormatting.RED) + "NB"; - this.modButton.displayString = (this.theSettings.respectMod ? TextFormatting.DARK_GREEN : TextFormatting.RED) + "MO"; - this.oredictButton.displayString = (this.theSettings.respectOredict == 0 ? TextFormatting.RED : this.theSettings.respectOredict == 1 ? TextFormatting.GREEN : TextFormatting.DARK_GREEN) + "OR"; + this.whitelistButton.displayString = (this.theSettings.isWhitelist + ? TextFormatting.DARK_GREEN + : TextFormatting.RED) + "WH"; + this.metaButton.displayString = (this.theSettings.respectMeta + ? TextFormatting.DARK_GREEN + : TextFormatting.RED) + "ME"; + this.nbtButton.displayString = (this.theSettings.respectNBT + ? TextFormatting.DARK_GREEN + : TextFormatting.RED) + "NB"; + this.modButton.displayString = (this.theSettings.respectMod + ? TextFormatting.DARK_GREEN + : TextFormatting.RED) + "MO"; + this.oredictButton.displayString = (this.theSettings.respectOredict == 0 + ? TextFormatting.RED + : this.theSettings.respectOredict == 1 + ? TextFormatting.GREEN + : TextFormatting.DARK_GREEN) + "OR"; } public void drawHover(int mouseX, int mouseY) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); if (this.whitelistButton.isMouseOver()) { List list = new ArrayList<>(); - list.add(TextFormatting.BOLD + (this.theSettings.isWhitelist ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.whitelist") : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.blacklist"))); + list.add(TextFormatting.BOLD + (this.theSettings.isWhitelist + ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.whitelist") + : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.blacklist"))); list.addAll(mc.fontRenderer.listFormattedStringToWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".gui.whitelistInfo"), 200)); GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); } else if (this.metaButton.isMouseOver()) { - GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectMeta ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMeta") : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreMeta"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); + GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectMeta + ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMeta") + : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreMeta"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); } else if (this.nbtButton.isMouseOver()) { - GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectNBT ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectNBT") : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreNBT"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); + GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectNBT + ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectNBT") + : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreNBT"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); } else if (this.modButton.isMouseOver()) { List list = new ArrayList<>(); - list.add(TextFormatting.BOLD + (this.theSettings.respectMod ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMod") : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreMod"))); + list.add(TextFormatting.BOLD + (this.theSettings.respectMod + ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMod") + : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreMod"))); list.addAll(mc.fontRenderer.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectModInfo"), 200)); GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); } else if (this.oredictButton.isMouseOver()) { List list = new ArrayList<>(); - list.add(TextFormatting.BOLD + (this.theSettings.respectOredict == 0 ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreOredict") : this.theSettings.respectOredict == 1 ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectOredictSoft") : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectOredictHard"))); + list.add(TextFormatting.BOLD + (this.theSettings.respectOredict == 0 + ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreOredict") + : this.theSettings.respectOredict == 1 + ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectOredictSoft") + : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectOredictHard"))); String type = null; if (this.theSettings.respectOredict == 1) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java index 31f615196..ad3b0af6f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java @@ -10,9 +10,6 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import java.text.NumberFormat; -import java.util.Collections; - import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; @@ -23,10 +20,12 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +import java.text.NumberFormat; +import java.util.Collections; + +@OnlyIn(Dist.CLIENT) public class FluidDisplay extends Gui { private FluidTank fluidReference; @@ -57,7 +56,7 @@ public class FluidDisplay extends Gui { } public void draw() { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); int barX = this.x; @@ -72,7 +71,9 @@ public class FluidDisplay extends Gui { this.drawTexturedModalRect(barX, barY, 0, 171, 18, 85); FluidStack stack = this.fluidReference.getFluid(); - Fluid fluid = stack == null ? null : stack.getFluid(); + Fluid fluid = stack == null + ? null + : stack.getFluid(); if (this.resLoc == null || this.oldFluid != fluid) { this.oldFluid = fluid; @@ -102,8 +103,12 @@ public class FluidDisplay extends Gui { } public void drawOverlay(int mouseX, int mouseY) { - if (mouseX >= this.x && mouseY >= this.y && mouseX < this.x + (this.outline ? 26 : 18) && mouseY < this.y + (this.outline ? 93 : 85)) { - Minecraft mc = Minecraft.getMinecraft(); + if (mouseX >= this.x && mouseY >= this.y && mouseX < this.x + (this.outline + ? 26 + : 18) && mouseY < this.y + (this.outline + ? 93 + : 85)) { + Minecraft mc = Minecraft.getInstance(); GuiUtils.drawHoveringText(Collections.singletonList(this.getOverlayText()), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); } } @@ -112,6 +117,8 @@ public class FluidDisplay extends Gui { NumberFormat format = NumberFormat.getInstance(); FluidStack stack = this.fluidReference.getFluid(); String cap = format.format(this.fluidReference.getCapacity()); - return stack == null || stack.getFluid() == null ? "0/" + cap + " mB" : format.format(this.fluidReference.getFluidAmount()) + "/" + cap + " mB " + stack.getLocalizedName(); + return stack == null || stack.getFluid() == null + ? "0/" + cap + " mB" + : format.format(this.fluidReference.getFluidAmount()) + "/" + cap + " mB " + stack.getLocalizedName(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBag.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBag.java index e230d5be5..8d6f7f83e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBag.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBag.java @@ -10,10 +10,6 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerBag; import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer; @@ -25,13 +21,16 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +@OnlyIn(Dist.CLIENT) public class GuiBag extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_bag"); @@ -60,16 +59,18 @@ public class GuiBag extends GuiWtfMojang { this.filter = new FilterSettingsGui(this.container.filter, this.guiLeft + 138, this.guiTop + 10, this.buttonList); - this.buttonAutoInsert = new GuiButton(0, this.guiLeft - 21, this.guiTop + 8, 20, 20, (this.container.autoInsert ? TextFormatting.DARK_GREEN : TextFormatting.RED) + "I"); + this.buttonAutoInsert = new GuiButton(0, this.guiLeft - 21, this.guiTop + 8, 20, 20, (this.container.autoInsert + ? TextFormatting.DARK_GREEN + : TextFormatting.RED) + "I"); this.buttonList.add(this.buttonAutoInsert); } @Override protected void actionPerformed(GuiButton button) throws IOException { - NBTTagCompound data = new NBTTagCompound(); + CompoundNBT data = new CompoundNBT(); data.setInteger("ButtonID", button.id); - data.setInteger("PlayerID", Minecraft.getMinecraft().player.getEntityId()); - data.setInteger("WorldID", Minecraft.getMinecraft().world.provider.getDimension()); + data.setInteger("PlayerID", Minecraft.getInstance().player.getEntityId()); + data.setInteger("WorldID", Minecraft.getInstance().world.provider.getDimension()); PacketHandler.theNetwork.sendToServer(new PacketClientToServer(data, PacketHandler.GUI_BUTTON_TO_CONTAINER_HANDLER)); } @@ -78,12 +79,16 @@ public class GuiBag extends GuiWtfMojang { super.updateScreen(); this.filter.update(); - this.buttonAutoInsert.displayString = (this.container.autoInsert ? TextFormatting.DARK_GREEN : TextFormatting.RED) + "I"; + this.buttonAutoInsert.displayString = (this.container.autoInsert + ? TextFormatting.DARK_GREEN + : TextFormatting.RED) + "I"; } @Override public void drawGuiContainerForegroundLayer(int x, int y) { - AssetUtil.displayNameString(this.fontRenderer, this.xSize, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + "." + (this.isVoid ? "voidBag" : "bag") + ".name")); + AssetUtil.displayNameString(this.fontRenderer, this.xSize, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + "." + (this.isVoid + ? "voidBag" + : "bag") + ".name")); } @Override @@ -93,7 +98,9 @@ public class GuiBag extends GuiWtfMojang { this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.drawTexturedModalRect(this.guiLeft, this.guiTop + 90, 0, 0, 176, 86); - this.mc.getTextureManager().bindTexture(this.isVoid ? RES_LOC_VOID : RES_LOC); + this.mc.getTextureManager().bindTexture(this.isVoid + ? RES_LOC_VOID + : RES_LOC); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 90); } @@ -104,10 +111,12 @@ public class GuiBag extends GuiWtfMojang { if (this.buttonAutoInsert.isMouseOver()) { List text = new ArrayList<>(); - text.add(TextFormatting.BOLD + "Auto-Insert " + (this.container.autoInsert ? "On" : "Off")); + text.add(TextFormatting.BOLD + "Auto-Insert " + (this.container.autoInsert + ? "On" + : "Off")); text.addAll(this.mc.fontRenderer.listFormattedStringToWidth("Turn this on to make items that get picked up automatically go into the bag.", 200)); text.addAll(this.mc.fontRenderer.listFormattedStringToWidth(TextFormatting.GRAY + "" + TextFormatting.ITALIC + "Note that this WON'T work when you are holding the bag in your hand.", 200)); this.drawHoveringText(text, mouseX, mouseY); } } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java index 98649cdf5..57708c959 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java @@ -18,9 +18,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiBreaker extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker"); @@ -48,4 +48,4 @@ public class GuiBreaker extends GuiWtfMojang { this.mc.getTextureManager().bindTexture(RES_LOC); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java index d06c1d20b..2399def12 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java @@ -18,9 +18,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiCanolaPress extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_canola_press"); @@ -73,4 +73,4 @@ public class GuiCanolaPress extends GuiWtfMojang { this.energy.draw(); this.fluid.draw(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java index 8ab878610..a625493dc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java @@ -18,9 +18,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiCoalGenerator extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_coal_generator"); @@ -68,4 +68,4 @@ public class GuiCoalGenerator extends GuiWtfMojang { this.energy.draw(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java index fcc879603..74b81ab84 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java @@ -24,9 +24,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiCoffeeMachine extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_coffee_machine"); @@ -102,4 +102,4 @@ public class GuiCoffeeMachine extends GuiWtfMojang { public void actionPerformed(GuiButton button) { PacketHandlerHelper.sendButtonPacket(this.machine, button.id); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java index 50a4fffef..dafad859a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java @@ -18,9 +18,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiDirectionalBreaker extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_directional_breaker"); @@ -64,4 +64,4 @@ public class GuiDirectionalBreaker extends GuiWtfMojang { this.energy.draw(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java index 7ed16f66d..22b194ef4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDrill.java @@ -18,9 +18,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiDrill extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_drill"); @@ -46,4 +46,4 @@ public class GuiDrill extends GuiWtfMojang { this.mc.getTextureManager().bindTexture(RES_LOC); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 54); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java index 7175054a3..41c6c4199 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java @@ -15,18 +15,18 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiDropper extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker"); private final TileEntityDropper dropper; - public GuiDropper(EntityPlayer player, TileEntityBase tile) { + public GuiDropper(PlayerEntity player, TileEntityBase tile) { super(new ContainerDropper(player, tile)); this.dropper = (TileEntityDropper) tile; this.xSize = 176; @@ -48,4 +48,4 @@ public class GuiDropper extends GuiWtfMojang { this.mc.getTextureManager().bindTexture(RES_LOC); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java index d29b30f3b..244ce010c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java @@ -15,19 +15,19 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiEnergizer extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_energizer"); private final TileEntityEnergizer energizer; private EnergyDisplay energy; - public GuiEnergizer(EntityPlayer inventory, TileEntityBase tile) { + public GuiEnergizer(PlayerEntity inventory, TileEntityBase tile) { super(new ContainerEnergizer(inventory, tile)); this.energizer = (TileEntityEnergizer) tile; this.xSize = 176; @@ -63,4 +63,4 @@ public class GuiEnergizer extends GuiWtfMojang { this.energy.draw(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java index 0fd6a5df3..8fe9c56ad 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java @@ -15,19 +15,19 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiEnervator extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_energizer"); private final TileEntityEnervator enervator; private EnergyDisplay energy; - public GuiEnervator(EntityPlayer inventory, TileEntityBase tile) { + public GuiEnervator(PlayerEntity inventory, TileEntityBase tile) { super(new ContainerEnervator(inventory, tile)); this.enervator = (TileEntityEnervator) tile; this.xSize = 176; @@ -63,4 +63,4 @@ public class GuiEnervator extends GuiWtfMojang { this.energy.draw(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFarmer.java index 44c5ae42b..02df0d49d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFarmer.java @@ -18,9 +18,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiFarmer extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_farmer"); @@ -65,4 +65,4 @@ public class GuiFarmer extends GuiWtfMojang { super.drawScreen(x, y, f); this.energy.drawOverlay(x, y); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java index 45bfe2da5..9c6f7d7f5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java @@ -22,9 +22,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiFeeder extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_feeder"); @@ -72,4 +72,4 @@ public class GuiFeeder extends GuiWtfMojang { this.drawTexturedModalRect(this.guiLeft + 70, this.guiTop + 31, 192, 24, 8, 8); } } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java index 818940186..50b04f25b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java @@ -18,9 +18,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiFermentingBarrel extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_fermenting_barrel"); @@ -72,4 +72,4 @@ public class GuiFermentingBarrel extends GuiWtfMojang { this.input.draw(); this.output.draw(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java index 48e27d4ee..05ee8afb5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java @@ -18,9 +18,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiFilter extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_filter"); @@ -46,4 +46,4 @@ public class GuiFilter extends GuiWtfMojang { this.mc.getTextureManager().bindTexture(RES_LOC); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 90); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java index b50c2aa24..3b5de96fa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java @@ -18,9 +18,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiFluidCollector extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_fluid_collector"); @@ -64,4 +64,4 @@ public class GuiFluidCollector extends GuiWtfMojang { this.fluid.draw(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java index 84d7ef70a..dded17f22 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java @@ -26,9 +26,9 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiFurnaceDouble extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_furnace_double"); @@ -103,4 +103,4 @@ public class GuiFurnaceDouble extends GuiWtfMojang { this.energy.draw(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGiantChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGiantChest.java index 981eff115..1d7793d25 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGiantChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGiantChest.java @@ -24,9 +24,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiGiantChest extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_giant_chest"); @@ -76,4 +76,4 @@ public class GuiGiantChest extends GuiWtfMojang { this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.drawTexturedModalRect(this.guiLeft + 33, this.guiTop + 172, 0, 0, 176, 86); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java index fe4c13473..633bcd7c3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java @@ -26,9 +26,9 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiGrinder extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_grinder"); @@ -124,4 +124,4 @@ public class GuiGrinder extends GuiWtfMojang { super(inventory, tile, true); } } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java index 880a376d7..ddb12366e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java @@ -28,9 +28,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiInputter extends GuiWtfMojang { public static final int OFFSET_ADVANCED = 12 + 36; @@ -230,7 +230,7 @@ public class GuiInputter extends GuiWtfMojang { } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static class SmallerButton extends GuiButton { public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter"); @@ -272,7 +272,7 @@ public class GuiInputter extends GuiWtfMojang { } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static class TinyButton extends GuiButton { public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter"); @@ -296,4 +296,4 @@ public class GuiInputter extends GuiWtfMojang { } } } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java index 22d653987..572ddf5ec 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java @@ -27,9 +27,9 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiLaserRelayItemWhitelist extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_laser_relay_item_whitelist"); @@ -110,4 +110,4 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang { this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiMiner.java index a225dfec2..be42fe2c8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiMiner.java @@ -21,9 +21,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiMiner extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker"); @@ -70,4 +70,4 @@ public class GuiMiner extends GuiWtfMojang { public void actionPerformed(GuiButton button) { PacketHandlerHelper.sendButtonPacket(this.miner, button.id); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java index 2b76070a2..ff2f34734 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java @@ -20,9 +20,9 @@ import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiOilGenerator extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_oil_generator"); @@ -85,4 +85,4 @@ public class GuiOilGenerator extends GuiWtfMojang { this.energy.draw(); this.fluid.draw(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java index 32aa3ad8d..ce1c44a0f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java @@ -27,9 +27,9 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiPhantomPlacer extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker"); @@ -100,4 +100,4 @@ public class GuiPhantomPlacer extends GuiWtfMojang { this.mc.getTextureManager().bindTexture(RES_LOC); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java index 014844b8e..517a4e5c8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java @@ -20,9 +20,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiRangedCollector extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_ranged_collector"); @@ -78,4 +78,4 @@ public class GuiRangedCollector extends GuiWtfMojang { public void actionPerformed(GuiButton button) { PacketHandlerHelper.sendButtonPacket(this.collector, button.id); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRepairer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRepairer.java index 2568f9dd2..23c1d69dd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRepairer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRepairer.java @@ -18,9 +18,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiRepairer extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_repairer"); @@ -68,4 +68,4 @@ public class GuiRepairer extends GuiWtfMojang { this.energy.draw(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiSmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiSmileyCloud.java index 653e103a8..67701de03 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiSmileyCloud.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiSmileyCloud.java @@ -10,10 +10,6 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import java.io.IOException; - -import org.lwjgl.input.Keyboard; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerSmileyCloud; import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer; @@ -25,14 +21,16 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; +import org.lwjgl.input.Keyboard; -@SideOnly(Side.CLIENT) +import java.io.IOException; + +@OnlyIn(Dist.CLIENT) public class GuiSmileyCloud extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_smiley_cloud"); @@ -67,7 +65,9 @@ public class GuiSmileyCloud extends GuiWtfMojang { @Override public void drawGuiContainerForegroundLayer(int x, int y) { - String name = this.cloud.name == null || this.cloud.name.isEmpty() ? "" : TextFormatting.GOLD + this.cloud.name + TextFormatting.RESET + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.the") + " "; + String name = this.cloud.name == null || this.cloud.name.isEmpty() + ? "" + : TextFormatting.GOLD + this.cloud.name + TextFormatting.RESET + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.the") + " "; String localizedName = name + StringUtil.localize("container." + ActuallyAdditions.MODID + ".cloud.name"); this.fontRenderer.drawString(localizedName, this.xSize / 2 - this.fontRenderer.getStringWidth(localizedName) / 2, -10, StringUtil.DECIMAL_COLOR_WHITE); } @@ -113,14 +113,14 @@ public class GuiSmileyCloud extends GuiWtfMojang { } private void sendPacket(String text, int textID) { - NBTTagCompound compound = new NBTTagCompound(); + CompoundNBT compound = new CompoundNBT(); compound.setInteger("X", this.x); compound.setInteger("Y", this.y); compound.setInteger("Z", this.z); compound.setInteger("WorldID", this.world.provider.getDimension()); - compound.setInteger("PlayerID", Minecraft.getMinecraft().player.getEntityId()); + compound.setInteger("PlayerID", Minecraft.getInstance().player.getEntityId()); compound.setInteger("TextID", textID); compound.setString("Text", text); PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_STRING_TO_TILE_HANDLER)); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java index 23438b279..b40a061c8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java @@ -21,10 +21,9 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class GuiXPSolidifier extends GuiWtfMojang { private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_xp_solidifier"); @@ -84,6 +83,6 @@ public class GuiXPSolidifier extends GuiWtfMojang { public void actionPerformed(GuiButton button) { PacketHandlerHelper.sendButtonPacket(this.solidifier, button.id); - this.solidifier.onButtonPressed(button.id, Minecraft.getMinecraft().player); + this.solidifier.onButtonPressed(button.id, Minecraft.getInstance().player); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java index e3401f027..fd13c5d5c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java @@ -10,18 +10,17 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +import java.util.ArrayList; +import java.util.List; + +@OnlyIn(Dist.CLIENT) public class TexturedButton extends GuiButton { public final List textList = new ArrayList<>(); @@ -62,7 +61,7 @@ public class TexturedButton extends GuiButton { public void drawHover(int x, int y) { if (this.isMouseOver()) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); GuiUtils.drawHoveringText(this.textList, x, y, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java index a2ce69533..a9084b6c4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.items.ItemFilter; import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -29,7 +29,7 @@ public class SlotFilter extends SlotItemHandlerUnconditioned { this(inv.filterInventory, slot, x, y); } - public static boolean checkFilter(Container container, int slotId, EntityPlayer player) { + public static boolean checkFilter(Container container, int slotId, PlayerEntity player) { if (slotId >= 0 && slotId < container.inventorySlots.size()) { Slot slot = container.getSlot(slotId); if (slot instanceof SlotFilter) { @@ -44,7 +44,7 @@ public class SlotFilter extends SlotItemHandlerUnconditioned { return StackUtil.isValid(stack) && stack.getItem() instanceof ItemFilter; } - private void slotClick(EntityPlayer player) { + private void slotClick(PlayerEntity player) { ItemStack heldStack = player.inventory.getItemStack(); ItemStack stackInSlot = this.getStack(); @@ -78,7 +78,7 @@ public class SlotFilter extends SlotItemHandlerUnconditioned { } @Override - public boolean canTakeStack(EntityPlayer player) { + public boolean canTakeStack(PlayerEntity player) { return false; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java index cec0555ce..be9d3099d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.inventory.slot; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -37,7 +37,7 @@ public class SlotImmovable extends Slot { } @Override - public boolean canTakeStack(EntityPlayer player) { + public boolean canTakeStack(PlayerEntity player) { return false; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java index 6246f4f64..3f9fcdf2d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java @@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.inventory.slot; import javax.annotation.Nonnull; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraftforge.items.SlotItemHandler; @@ -64,7 +64,7 @@ public class SlotItemHandlerUnconditioned extends SlotItemHandler { } @Override - public boolean canTakeStack(EntityPlayer playerIn) { + public boolean canTakeStack(PlayerEntity playerIn) { return !this.inv.extractItem(this.getSlotIndex(), 1, true, false).isEmpty(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java index 40241b6d9..6a4dd1e96 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java @@ -10,33 +10,32 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.HashSet; -import java.util.Set; - import com.google.common.collect.Sets; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues; import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA; import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.IRarity; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import java.util.HashSet; +import java.util.Set; public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem { @@ -70,20 +69,38 @@ public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem { } @Override - public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { - if (!playerIn.isSneaking()) return Items.IRON_HOE.onItemUse(playerIn, worldIn, pos, hand, side, hitX, hitY, hitZ); + public EnumActionResult onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, EnumFacing side, float hitX, float hitY, float hitZ) { + if (!playerIn.isSneaking()) { + return Items.IRON_HOE.onItemUse(playerIn, worldIn, pos, hand, side, hitX, hitY, hitZ); + } return Items.IRON_SHOVEL.onItemUse(playerIn, worldIn, pos, hand, side, hitX, hitY, hitZ); } @Override - public boolean canHarvestBlock(IBlockState state, ItemStack stack) { - return this.hasExtraWhitelist(state.getBlock()) || state.getMaterial().isToolNotRequired() || state.getBlock() == Blocks.SNOW_LAYER || state.getBlock() == Blocks.SNOW || (state.getBlock() == Blocks.OBSIDIAN ? this.toolMaterial.getHarvestLevel() >= 3 : state.getBlock() != Blocks.DIAMOND_BLOCK && state.getBlock() != Blocks.DIAMOND_ORE ? state.getBlock() != Blocks.EMERALD_ORE && state.getBlock() != Blocks.EMERALD_BLOCK ? state.getBlock() != Blocks.GOLD_BLOCK && state.getBlock() != Blocks.GOLD_ORE ? state.getBlock() != Blocks.IRON_BLOCK && state.getBlock() != Blocks.IRON_ORE ? state.getBlock() != Blocks.LAPIS_BLOCK && state.getBlock() != Blocks.LAPIS_ORE ? state.getBlock() != Blocks.REDSTONE_ORE && state.getBlock() != Blocks.LIT_REDSTONE_ORE ? state.getMaterial() == Material.ROCK || state.getMaterial() == Material.IRON || state.getMaterial() == Material.ANVIL : this.toolMaterial.getHarvestLevel() >= 2 : this.toolMaterial.getHarvestLevel() >= 1 : this.toolMaterial.getHarvestLevel() >= 1 : this.toolMaterial.getHarvestLevel() >= 2 : this.toolMaterial.getHarvestLevel() >= 2 : this.toolMaterial.getHarvestLevel() >= 2); + public boolean canHarvestBlock(BlockState state, ItemStack stack) { + return this.hasExtraWhitelist(state.getBlock()) || state.getMaterial().isToolNotRequired() || state.getBlock() == Blocks.SNOW_LAYER || state.getBlock() == Blocks.SNOW || (state.getBlock() == Blocks.OBSIDIAN + ? this.toolMaterial.getHarvestLevel() >= 3 + : state.getBlock() != Blocks.DIAMOND_BLOCK && state.getBlock() != Blocks.DIAMOND_ORE + ? state.getBlock() != Blocks.EMERALD_ORE && state.getBlock() != Blocks.EMERALD_BLOCK + ? state.getBlock() != Blocks.GOLD_BLOCK && state.getBlock() != Blocks.GOLD_ORE + ? state.getBlock() != Blocks.IRON_BLOCK && state.getBlock() != Blocks.IRON_ORE + ? state.getBlock() != Blocks.LAPIS_BLOCK && state.getBlock() != Blocks.LAPIS_ORE + ? state.getBlock() != Blocks.REDSTONE_ORE && state.getBlock() != Blocks.LIT_REDSTONE_ORE + ? state.getMaterial() == Material.ROCK || state.getMaterial() == Material.IRON || state.getMaterial() == Material.ANVIL + : this.toolMaterial.getHarvestLevel() >= 2 + : this.toolMaterial.getHarvestLevel() >= 1 + : this.toolMaterial.getHarvestLevel() >= 1 + : this.toolMaterial.getHarvestLevel() >= 2 + : this.toolMaterial.getHarvestLevel() >= 2 + : this.toolMaterial.getHarvestLevel() >= 2); } private boolean hasExtraWhitelist(Block block) { String name = block.getRegistryName().toString(); for (String list : ConfigStringListValues.PAXEL_EXTRA_MINING_WHITELIST.getValue()) { - if (list.equals(name)) { return true; } + if (list.equals(name)) { + return true; + } } return false; } @@ -94,22 +111,26 @@ public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem { } @Override - public float getDestroySpeed(ItemStack stack, IBlockState state) { + public float getDestroySpeed(ItemStack stack, BlockState state) { if (state.getBlock() == Blocks.WEB) { return 15.0F; } else { - return this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) ? this.efficiency : 1.0F; + return this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) + ? this.efficiency + : 1.0F; } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) @Override public IItemColor getItemColor() { - return (stack, pass) -> pass > 0 ? ItemAllToolAA.this.color : 0xFFFFFF; + return (stack, pass) -> pass > 0 + ? ItemAllToolAA.this.color + : 0xFFFFFF; } @Override public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { return super.canApplyAtEnchantingTable(stack, enchantment) || enchantment.type.canEnchantItem(Items.DIAMOND_SWORD); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java index 040d7bd44..3796aaf23 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java @@ -18,7 +18,7 @@ import com.google.common.collect.Sets; import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -39,7 +39,7 @@ public class ItemAxeAA extends ItemToolAA { } @Override - public float getDestroySpeed(ItemStack stack, IBlockState state) { + public float getDestroySpeed(ItemStack stack, BlockState state) { Material material = state.getMaterial(); return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getDestroySpeed(stack, state) : this.efficiency; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java index d827ef3cb..8bde91052 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java @@ -16,15 +16,15 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler.GuiTypes; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.items.CapabilityItemHandler; @@ -41,7 +41,7 @@ public class ItemBag extends ItemBase { } @Override - public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = playerIn.getHeldItem(hand); if (!this.isVoid) { TileEntity tile = worldIn.getTileEntity(pos); @@ -83,20 +83,24 @@ public class ItemBag extends ItemBase { } @Override - public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { - if (!world.isRemote && hand == EnumHand.MAIN_HAND) { - player.openGui(ActuallyAdditions.INSTANCE, (this.isVoid ? GuiTypes.VOID_BAG : GuiTypes.BAG).ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ); + public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { + if (!world.isRemote && hand == Hand.MAIN_HAND) { + player.openGui(ActuallyAdditions.INSTANCE, (this.isVoid + ? GuiTypes.VOID_BAG + : GuiTypes.BAG).ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ); } return new ActionResult<>(EnumActionResult.PASS, player.getHeldItem(hand)); } @Override public EnumRarity getRarity(ItemStack stack) { - return this.isVoid ? EnumRarity.RARE : EnumRarity.UNCOMMON; + return this.isVoid + ? EnumRarity.RARE + : EnumRarity.UNCOMMON; } @Override - public NBTTagCompound getNBTShareTag(ItemStack stack) { + public CompoundNBT getNBTShareTag(ItemStack stack) { return null; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java index bd0a4b90f..6cf1f59bd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; @@ -19,16 +17,18 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.world.World; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; +import java.util.List; + public class ItemBattery extends ItemEnergy { public ItemBattery(String name, int capacity, int transfer) { @@ -48,8 +48,8 @@ public class ItemBattery extends ItemEnergy { @Override public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) { - if (!world.isRemote && entity instanceof EntityPlayer && ItemUtil.isEnabled(stack) && !isSelected) { - EntityPlayer player = (EntityPlayer) entity; + if (!world.isRemote && entity instanceof PlayerEntity && ItemUtil.isEnabled(stack) && !isSelected) { + PlayerEntity player = (PlayerEntity) entity; for (int i = 0; i < player.inventory.getSizeInventory(); i++) { ItemStack slot = player.inventory.getStackInSlot(i); if (StackUtil.isValid(slot) && slot.getCount() == 1) { @@ -72,7 +72,7 @@ public class ItemBattery extends ItemEnergy { } @Override - public ActionResult onItemRightClick(World worldIn, EntityPlayer player, EnumHand hand) { + public ActionResult onItemRightClick(World worldIn, PlayerEntity player, Hand hand) { if (!worldIn.isRemote && player.isSneaking()) { ItemUtil.changeEnabled(player, hand); return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand)); @@ -83,7 +83,9 @@ public class ItemBattery extends ItemEnergy { @Override public void addInformation(ItemStack stack, World playerIn, List list, ITooltipFlag advanced) { super.addInformation(stack, playerIn, list, advanced); - list.add(StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".battery." + (ItemUtil.isEnabled(stack) ? "discharge" : "noDischarge"))); + list.add(StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".battery." + (ItemUtil.isEnabled(stack) + ? "discharge" + : "noDischarge"))); list.add(StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".battery.changeMode")); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java index f92450c62..b1824e5bf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java @@ -10,10 +10,6 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.List; - -import javax.annotation.Nullable; - import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay; @@ -24,27 +20,30 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import javax.annotation.Nullable; +import java.util.List; public class ItemBooklet extends ItemBase implements IHudDisplay { - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static IBookletPage forcedPage; public ItemBooklet(String name) { @@ -54,9 +53,9 @@ public class ItemBooklet extends ItemBase implements IHudDisplay { } @Override - public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing face, float hitX, float hitY, float hitZ) { if (player.isSneaking()) { - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); Block block = state.getBlock(); ItemStack blockStack = new ItemStack(block, 1, block.damageDropped(state)); IBookletPage page = BookletUtils.findFirstPageForStack(blockStack); @@ -72,7 +71,7 @@ public class ItemBooklet extends ItemBase implements IHudDisplay { } @Override - public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { + public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ); if (!world.isRemote) { @@ -87,7 +86,9 @@ public class ItemBooklet extends ItemBase implements IHudDisplay { tooltip.add(StringUtil.localize("tooltip." + ActuallyAdditions.MODID + "." + this.getBaseName() + ".desc")); for (int i = 1; i <= 4; i++) { - String format = i == 4 ? TextFormatting.GOLD.toString() + TextFormatting.ITALIC : TextFormatting.RESET.toString(); + String format = i == 4 + ? TextFormatting.GOLD.toString() + TextFormatting.ITALIC + : TextFormatting.RESET.toString(); tooltip.add(format + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + "." + this.getBaseName() + ".sub." + i)); } } @@ -98,10 +99,10 @@ public class ItemBooklet extends ItemBase implements IHudDisplay { } @Override - @SideOnly(Side.CLIENT) - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { + @OnlyIn(Dist.CLIENT) + public void displayHud(Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) { if (posHit != null && posHit.getBlockPos() != null) { - IBlockState state = minecraft.world.getBlockState(posHit.getBlockPos()); + BlockState state = minecraft.world.getBlockState(posHit.getBlockPos()); Block block = state.getBlock(); if (block != null && !block.isAir(minecraft.world.getBlockState(posHit.getBlockPos()), minecraft.world, posHit.getBlockPos())) { ItemStack blockStack = new ItemStack(block, 1, block.getMetaFromState(state)); @@ -113,7 +114,9 @@ public class ItemBooklet extends ItemBase implements IHudDisplay { String strg2 = StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.page") + " " + (page.getChapter().getPageIndex(page) + 1); String strg3 = StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.open"); - AssetUtil.renderStackToGui(StackUtil.isValid(page.getChapter().getDisplayItemStack()) ? page.getChapter().getDisplayItemStack() : new ItemStack(InitItems.itemBooklet), resolution.getScaledWidth() / 2 - 10, height + 41, 1F); + AssetUtil.renderStackToGui(StackUtil.isValid(page.getChapter().getDisplayItemStack()) + ? page.getChapter().getDisplayItemStack() + : new ItemStack(InitItems.itemBooklet), resolution.getScaledWidth() / 2 - 10, height + 41, 1F); minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg1, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg1) / 2, height + 20, StringUtil.DECIMAL_COLOR_WHITE); minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg2, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg2) / 2, height + 30, StringUtil.DECIMAL_COLOR_WHITE); minecraft.fontRenderer.drawStringWithShadow(TextFormatting.GOLD + strg3, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg3) / 2, height + 60, StringUtil.DECIMAL_COLOR_WHITE); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java index 6aa66069d..c504e2f33 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java @@ -14,15 +14,15 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.IInventory; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.items.IItemHandlerModifiable; @@ -31,16 +31,16 @@ import net.minecraftforge.items.wrapper.InvWrapper; public class ItemChestToCrateUpgrade extends ItemBase { private final Class start; - private final IBlockState end; + private final BlockState end; - public ItemChestToCrateUpgrade(String name, Class start, IBlockState end) { + public ItemChestToCrateUpgrade(String name, Class start, BlockState end) { super(name); this.start = start; this.end = end; } @Override - public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + public EnumActionResult onItemUseFirst(PlayerEntity player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, Hand hand) { ItemStack heldStack = player.getHeldItem(hand); if (player.isSneaking()) { TileEntity tileHit = world.getTileEntity(pos); @@ -67,7 +67,9 @@ public class ItemChestToCrateUpgrade extends ItemBase { world.removeTileEntity(pos); world.setBlockState(pos, this.end, 2); - if (!player.capabilities.isCreativeMode) heldStack.shrink(1); + if (!player.capabilities.isCreativeMode) { + heldStack.shrink(1); + } //Copy Items into new Chest TileEntity newTileHit = world.getTileEntity(pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java index bdf31de4a..4ba050834 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java @@ -10,11 +10,6 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Nullable; - import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; @@ -32,12 +27,16 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.potion.PotionEffect; import net.minecraft.util.StringUtils; import net.minecraft.world.World; import net.minecraftforge.fml.common.Loader; +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.List; + public class ItemCoffee extends ItemFoodBase { public ItemCoffee(String name) { @@ -70,7 +69,9 @@ public class ItemCoffee extends ItemFoodBase { @Nullable public static CoffeeIngredient getIngredientFromStack(ItemStack stack) { for (CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS) { - if (ingredient.getInput().apply(stack)) return ingredient; + if (ingredient.getInput().apply(stack)) { + return ingredient; + } } return null; } @@ -123,12 +124,12 @@ public class ItemCoffee extends ItemFoodBase { tooltip.add(StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".coffeeCup.noEffect")); } } - + @Override public boolean isEnchantable(ItemStack stack) { return false; } - + @Override public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { return false; @@ -155,7 +156,7 @@ public class ItemCoffee extends ItemFoodBase { effectsNew.add(new PotionEffect(effect.getPotion(), effect.getDuration() + 120, effect.getAmplifier() - 1)); } } - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); if (effectsNew.size() > 0) { this.effects = effectsNew.toArray(new PotionEffect[effectsNew.size()]); ActuallyAdditionsAPI.methodHandler.addEffectToStack(stack, this); @@ -170,4 +171,4 @@ public class ItemCoffee extends ItemFoodBase { return StringUtil.localize("container.nei." + ActuallyAdditions.MODID + ".coffee.extra.milk"); } } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java index f78cabee1..e79e2d0fa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java @@ -13,12 +13,12 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.world.World; public class ItemCrafterOnAStick extends ItemBase { @@ -29,7 +29,7 @@ public class ItemCrafterOnAStick extends ItemBase { } @Override - public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { + public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { if (!world.isRemote) { player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.CRAFTER.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java index cacd108e1..8a0fe4b9a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java @@ -21,7 +21,7 @@ import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.IRarity; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class ItemCrystal extends ItemBase { @@ -55,7 +55,7 @@ public class ItemCrystal extends ItemBase { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void getSubItems(CreativeTabs tab, NonNullList list) { if (this.isInCreativeTab(tab)) { for (int j = 0; j < BlockCrystal.ALL_CRYSTALS.length; j++) { @@ -71,4 +71,4 @@ public class ItemCrystal extends ItemBase { ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(name), "inventory"); } } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystalShard.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystalShard.java index ddb89fd2f..d904e80fd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystalShard.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystalShard.java @@ -22,7 +22,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraftforge.common.IRarity; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class ItemCrystalShard extends ItemBase implements IColorProvidingItem { @@ -48,7 +48,7 @@ public class ItemCrystalShard extends ItemBase implements IColorProvidingItem { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void getSubItems(CreativeTabs tab, NonNullList list) { if (this.isInCreativeTab(tab)) { for (int j = 0; j < BlockCrystal.ALL_CRYSTALS.length; j++) { @@ -65,7 +65,7 @@ public class ItemCrystalShard extends ItemBase implements IColorProvidingItem { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IItemColor getItemColor() { return (stack, tintIndex) -> { int damage = stack.getItemDamage(); @@ -76,4 +76,4 @@ public class ItemCrystalShard extends ItemBase implements IColorProvidingItem { } }; } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java index 8cd52e3a3..473349f4a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java @@ -10,12 +10,7 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - import com.google.common.collect.Multimap; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors; import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues; @@ -29,35 +24,36 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.init.Blocks; import net.minecraft.init.Enchantments; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ActionResult; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing.Axis; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + public class ItemDrill extends ItemEnergy { public static final int HARVEST_LEVEL = 4; @@ -77,7 +73,7 @@ public class ItemDrill extends ItemEnergy { * @param stack The Drill */ public static void loadSlotsFromNBT(IItemHandlerModifiable slots, ItemStack stack) { - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); if (compound != null) { TileEntityInventoryBase.loadSlots(slots, compound); } @@ -90,9 +86,9 @@ public class ItemDrill extends ItemEnergy { * @param stack The Drill */ public static void writeSlotsToNBT(IItemHandler slots, ItemStack stack) { - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); if (compound == null) { - compound = new NBTTagCompound(); + compound = new CompoundNBT(); } TileEntityInventoryBase.saveSlots(slots, compound); stack.setTagCompound(compound); @@ -100,7 +96,7 @@ public class ItemDrill extends ItemEnergy { @Override //Places Blocks if the Placing Upgrade is installed - public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing side, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); ItemStack upgrade = this.getHasUpgradeAsStack(stack, ItemDrillUpgrade.UpgradeType.PLACER); if (StackUtil.isValid(upgrade)) { @@ -141,26 +137,31 @@ public class ItemDrill extends ItemEnergy { * * @param stack The Drill * @param upgrade The Upgrade to be checked + * * @return The Upgrade, if it's installed */ public ItemStack getHasUpgradeAsStack(ItemStack stack, ItemDrillUpgrade.UpgradeType upgrade) { - NBTTagCompound compound = stack.getTagCompound(); - if (compound == null) { return StackUtil.getEmpty(); } + CompoundNBT compound = stack.getTagCompound(); + if (compound == null) { + return StackUtil.getEmpty(); + } ItemStackHandlerAA inv = new ItemStackHandlerAA(ContainerDrill.SLOT_AMOUNT); loadSlotsFromNBT(inv, stack); for (int i = 0; i < inv.getSlots(); i++) { ItemStack slotStack = inv.getStackInSlot(i); if (StackUtil.isValid(slotStack) && slotStack.getItem() instanceof ItemDrillUpgrade) { - if (((ItemDrillUpgrade) slotStack.getItem()).type == upgrade) { return slotStack; } + if (((ItemDrillUpgrade) slotStack.getItem()).type == upgrade) { + return slotStack; + } } } return StackUtil.getEmpty(); } @Override - public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { - if (!world.isRemote && player.isSneaking() && hand == EnumHand.MAIN_HAND) { + public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { + if (!world.isRemote && player.isSneaking() && hand == Hand.MAIN_HAND) { player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.DRILL.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ); } return new ActionResult<>(EnumActionResult.PASS, player.getHeldItem(hand)); @@ -174,7 +175,7 @@ public class ItemDrill extends ItemEnergy { @Override public boolean hitEntity(ItemStack stack, EntityLivingBase entity1, EntityLivingBase entity2) { int use = this.getEnergyUsePerBlock(stack); - if (!(entity2 instanceof EntityPlayer) || !((EntityPlayer) entity2).capabilities.isCreativeMode) { + if (!(entity2 instanceof PlayerEntity) || !((PlayerEntity) entity2).capabilities.isCreativeMode) { if (this.getEnergyStored(stack) >= use) { this.extractEnergyInternal(stack, use, false); } @@ -192,7 +193,9 @@ public class ItemDrill extends ItemEnergy { Multimap map = super.getAttributeModifiers(slot, stack); if (slot == EntityEquipmentSlot.MAINHAND) { - map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Drill Modifier", this.getEnergyStored(stack) >= ENERGY_USE ? 8.0F : 0.1F, 0)); + map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Drill Modifier", this.getEnergyStored(stack) >= ENERGY_USE + ? 8.0F + : 0.1F, 0)); map.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool Modifier", -2.5F, 0)); } @@ -200,12 +203,16 @@ public class ItemDrill extends ItemEnergy { } @Override - public float getDestroySpeed(ItemStack stack, IBlockState state) { - return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) ? this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) ? this.getEfficiencyFromUpgrade(stack) : 1.0F : 0.1F; + public float getDestroySpeed(ItemStack stack, BlockState state) { + return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) + ? this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) + ? this.getEfficiencyFromUpgrade(stack) + : 1.0F + : 0.1F; } @Override - public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, EntityPlayer player) { + public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, PlayerEntity player) { boolean toReturn = false; int use = this.getEnergyUsePerBlock(stack); if (this.getEnergyStored(stack) >= use) { @@ -214,7 +221,9 @@ public class ItemDrill extends ItemEnergy { ItemUtil.addEnchantment(stack, Enchantments.SILK_TOUCH, 1); } else { if (this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE)) { - ItemUtil.addEnchantment(stack, Enchantments.FORTUNE, this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) ? 3 : 1); + ItemUtil.addEnchantment(stack, Enchantments.FORTUNE, this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) + ? 3 + : 1); } } @@ -242,9 +251,23 @@ public class ItemDrill extends ItemEnergy { } @Override - public boolean canHarvestBlock(IBlockState state, ItemStack stack) { + public boolean canHarvestBlock(BlockState state, ItemStack stack) { Block block = state.getBlock(); - return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || state.getMaterial().isToolNotRequired() || block == Blocks.SNOW_LAYER || block == Blocks.SNOW || (block == Blocks.OBSIDIAN ? HARVEST_LEVEL >= 3 : block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE ? block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK ? block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE ? block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE ? block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE ? block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE ? state.getMaterial() == Material.ROCK || state.getMaterial() == Material.IRON || state.getMaterial() == Material.ANVIL : HARVEST_LEVEL >= 2 : HARVEST_LEVEL >= 1 : HARVEST_LEVEL >= 1 : HARVEST_LEVEL >= 2 : HARVEST_LEVEL >= 2 : HARVEST_LEVEL >= 2)); + return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || state.getMaterial().isToolNotRequired() || block == Blocks.SNOW_LAYER || block == Blocks.SNOW || (block == Blocks.OBSIDIAN + ? HARVEST_LEVEL >= 3 + : block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE + ? block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK + ? block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE + ? block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE + ? block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE + ? block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE + ? state.getMaterial() == Material.ROCK || state.getMaterial() == Material.IRON || state.getMaterial() == Material.ANVIL + : HARVEST_LEVEL >= 2 + : HARVEST_LEVEL >= 1 + : HARVEST_LEVEL >= 1 + : HARVEST_LEVEL >= 2 + : HARVEST_LEVEL >= 2 + : HARVEST_LEVEL >= 2)); } @Override @@ -256,7 +279,7 @@ public class ItemDrill extends ItemEnergy { } @Override - public int getHarvestLevel(ItemStack stack, String toolClass, EntityPlayer player, IBlockState blockState) { + public int getHarvestLevel(ItemStack stack, String toolClass, PlayerEntity player, BlockState blockState) { return HARVEST_LEVEL; } @@ -264,6 +287,7 @@ public class ItemDrill extends ItemEnergy { * Gets the Energy that is used per Block broken * * @param stack The Drill + * * @return The Energy use per Block */ public int getEnergyUsePerBlock(ItemStack stack) { @@ -309,6 +333,7 @@ public class ItemDrill extends ItemEnergy { * * @param stack The Drill * @param upgrade The Upgrade to be checked + * * @return Is the Upgrade applied? */ public boolean getHasUpgrade(ItemStack stack, ItemDrillUpgrade.UpgradeType upgrade) { @@ -324,7 +349,7 @@ public class ItemDrill extends ItemEnergy { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void getSubItems(CreativeTabs tabs, NonNullList list) { if (this.isInCreativeTab(tabs)) { for (int i = 0; i < 16; i++) { @@ -347,6 +372,7 @@ public class ItemDrill extends ItemEnergy { * Gets the Mining Speed of the Drill * * @param stack The Drill + * * @return The Mining Speed depending on the Speed Upgrades */ public float getEfficiencyFromUpgrade(ItemStack stack) { @@ -380,7 +406,7 @@ public class ItemDrill extends ItemEnergy { * @param world The World * @param player The Player who breaks the Blocks */ - public boolean breakBlocks(ItemStack stack, int radius, World world, BlockPos aPos, EnumFacing side, EntityPlayer player) { + public boolean breakBlocks(ItemStack stack, int radius, World world, BlockPos aPos, EnumFacing side, PlayerEntity player) { int xRange = radius; int yRange = radius; int zRange = 0; @@ -396,20 +422,22 @@ public class ItemDrill extends ItemEnergy { } //Not defined later because main Block is getting broken below - IBlockState state = world.getBlockState(aPos); + BlockState state = world.getBlockState(aPos); float mainHardness = state.getBlockHardness(world, aPos); //Break Middle Block first int use = this.getEnergyUsePerBlock(stack); if (this.getEnergyStored(stack) >= use) { - if (!this.tryHarvestBlock(world, aPos, false, stack, player, use)) { return false; } + if (!this.tryHarvestBlock(world, aPos, false, stack, player, use)) { + return false; + } } else { return false; } if (radius == 2 && side.getAxis() != Axis.Y) { aPos = aPos.up(); - IBlockState theState = world.getBlockState(aPos); + BlockState theState = world.getBlockState(aPos); if (theState.getBlockHardness(world, aPos) <= mainHardness + 5.0F) { this.tryHarvestBlock(world, aPos, true, stack, player, use); } @@ -424,7 +452,7 @@ public class ItemDrill extends ItemEnergy { if (this.getEnergyStored(stack) >= use) { //Only break Blocks around that are (about) as hard or softer BlockPos thePos = new BlockPos(xPos, yPos, zPos); - IBlockState theState = world.getBlockState(thePos); + BlockState theState = world.getBlockState(thePos); if (theState.getBlockHardness(world, thePos) <= mainHardness + 5.0F) { this.tryHarvestBlock(world, thePos, true, stack, player, use); } @@ -450,8 +478,8 @@ public class ItemDrill extends ItemEnergy { * @param player The Player breaking the Blocks * @param use The Energy that should be extracted per Block */ - private boolean tryHarvestBlock(World world, BlockPos pos, boolean isExtra, ItemStack stack, EntityPlayer player, int use) { - IBlockState state = world.getBlockState(pos); + private boolean tryHarvestBlock(World world, BlockPos pos, boolean isExtra, ItemStack stack, PlayerEntity player, int use) { + BlockState state = world.getBlockState(pos); Block block = state.getBlock(); float hardness = state.getBlockHardness(world, pos); boolean canHarvest = (ForgeHooks.canHarvestBlock(block, player, world, pos) || this.canHarvestBlock(state, stack)) && (!isExtra || this.getDestroySpeed(stack, world.getBlockState(pos)) > 1.0F); @@ -472,7 +500,9 @@ public class ItemDrill extends ItemEnergy { String name = location.toString(); if (name != null) { for (String s : ConfigStringListValues.DRILL_EXTRA_MINING_WHITELIST.getValue()) { - if (s != null && s.equals(name)) { return true; } + if (s != null && s.equals(name)) { + return true; + } } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java index c12138e06..687b744d5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java @@ -11,12 +11,12 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.world.World; public class ItemDrillUpgrade extends ItemBase { @@ -30,13 +30,15 @@ public class ItemDrillUpgrade extends ItemBase { } public static int getSlotToPlaceFrom(ItemStack stack) { - NBTTagCompound compound = stack.getTagCompound(); - if (compound != null) { return compound.getInteger("SlotToPlaceFrom") - 1; } + CompoundNBT compound = stack.getTagCompound(); + if (compound != null) { + return compound.getInteger("SlotToPlaceFrom") - 1; + } return -1; } @Override - public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { + public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { ItemStack stack = player.getHeldItem(hand); if (!world.isRemote && this.type == UpgradeType.PLACER) { this.setSlotToPlaceFrom(stack, player.inventory.currentItem); @@ -46,9 +48,9 @@ public class ItemDrillUpgrade extends ItemBase { } public void setSlotToPlaceFrom(ItemStack stack, int slot) { - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); if (compound == null) { - compound = new NBTTagCompound(); + compound = new CompoundNBT(); } compound.setInteger("SlotToPlaceFrom", slot + 1); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java index 376789b7d..09cec274e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java @@ -21,7 +21,7 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class ItemDust extends ItemBase implements IColorProvidingItem { @@ -48,7 +48,7 @@ public class ItemDust extends ItemBase implements IColorProvidingItem { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void getSubItems(CreativeTabs tab, NonNullList list) { if (this.isInCreativeTab(tab)) { for (int j = 0; j < ALL_DUSTS.length; j++) { @@ -64,7 +64,7 @@ public class ItemDust extends ItemBase implements IColorProvidingItem { } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) @Override public IItemColor getItemColor() { return (stack, pass) -> stack.getItemDamage() >= ALL_DUSTS.length ? 0xFFFFFF : ALL_DUSTS[stack.getItemDamage()].color; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java index 5aad503f0..0ef41fe35 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java @@ -20,7 +20,7 @@ import de.ellpeck.actuallyadditions.mod.material.InitArmorMaterials; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import io.netty.util.internal.ConcurrentSet; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.math.AxisAlignedBB; @@ -28,7 +28,7 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles { @@ -44,15 +44,15 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles { MinecraftForge.EVENT_BUS.register(this); } - public static boolean isWearing(EntityPlayer player) { + public static boolean isWearing(PlayerEntity player) { ItemStack face = player.inventory.armorInventory.get(3); return StackUtil.isValid(face) && face.getItem() instanceof IGoggles; } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) @SubscribeEvent public void onClientTick(ClientTickEvent event) { - EntityPlayer player = ActuallyAdditions.PROXY.getCurrentPlayer(); + PlayerEntity player = ActuallyAdditions.PROXY.getCurrentPlayer(); if (player != null && isWearing(player)) { ItemStack face = player.inventory.armorInventory.get(3); if (((IGoggles) face.getItem()).displaySpectralMobs()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java index dce158405..68a6d0381 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java @@ -13,13 +13,13 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.misc.DispenserHandlerFertilize; import net.minecraft.block.BlockDispenser; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -32,7 +32,7 @@ public class ItemFertilizer extends ItemBase { } @Override - public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float par8, float par9, float par10) { + public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing side, float par8, float par9, float par10) { ItemStack stack = player.getHeldItem(hand); if (ItemDye.applyBonemeal(stack, world, pos, player, hand)) { if (!world.isRemote) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java index b16e772d7..d111f2c06 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java @@ -10,10 +10,6 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.List; - -import org.apache.commons.lang3.tuple.Pair; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.util.StackUtil; @@ -21,22 +17,25 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.block.SoundType; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; +import org.apache.commons.lang3.tuple.Pair; + +import java.util.List; public class ItemFillingWand extends ItemEnergy { @@ -44,7 +43,7 @@ public class ItemFillingWand extends ItemEnergy { super(500000, 1000, name); } - private static boolean removeFittingItem(IBlockState state, EntityPlayer player) { + private static boolean removeFittingItem(BlockState state, PlayerEntity player) { Block block = state.getBlock(); ItemStack stack = new ItemStack(block, 1, block.damageDropped(state)); @@ -65,32 +64,36 @@ public class ItemFillingWand extends ItemEnergy { return false; } - private static void saveData(ItemStack pickBlock, IBlockState state, ItemStack wand) { - if (!wand.hasTagCompound()) wand.setTagCompound(new NBTTagCompound()); + private static void saveData(ItemStack pickBlock, BlockState state, ItemStack wand) { + if (!wand.hasTagCompound()) { + wand.setTagCompound(new CompoundNBT()); + } wand.getTagCompound().setInteger("state", Block.getStateId(state)); wand.getTagCompound().setString("name", pickBlock.getDisplayName()); } - private static Pair loadData(ItemStack stack) { - if (stack.hasTagCompound()) return Pair.of(Block.getStateById(stack.getTagCompound().getInteger("state")), stack.getTagCompound().getString("name")); + private static Pair loadData(ItemStack stack) { + if (stack.hasTagCompound()) { + return Pair.of(Block.getStateById(stack.getTagCompound().getInteger("state")), stack.getTagCompound().getString("name")); + } return null; } @Override - public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); if (!world.isRemote && player.getItemInUseCount() <= 0) { if (player.isSneaking()) { - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); ItemStack pick = state.getBlock().getPickBlock(state, world.rayTraceBlocks(player.getPositionVector(), new Vec3d(pos.getX() + hitX, pos.getY() + hitY, pos.getZ() + hitZ)), world, pos, player); saveData(pick, state, stack); return EnumActionResult.SUCCESS; } else if (loadData(stack) != null) { if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); } - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); if (compound.getInteger("CurrX") == 0 && compound.getInteger("CurrY") == 0 && compound.getInteger("CurrZ") == 0) { compound.setInteger("FirstX", pos.getX()); @@ -109,13 +112,13 @@ public class ItemFillingWand extends ItemEnergy { public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entity, int timeLeft) { if (!world.isRemote) { boolean clear = true; - if (entity instanceof EntityPlayer) { - RayTraceResult result = WorldUtil.getNearestBlockWithDefaultReachDistance(world, (EntityPlayer) entity); + if (entity instanceof PlayerEntity) { + RayTraceResult result = WorldUtil.getNearestBlockWithDefaultReachDistance(world, (PlayerEntity) entity); if (result != null && result.getBlockPos() != null) { if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); } - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); BlockPos pos = result.getBlockPos(); compound.setInteger("SecondX", pos.getX()); @@ -142,11 +145,11 @@ public class ItemFillingWand extends ItemEnergy { boolean shouldClear = false; if (isSelected) { - if (entity instanceof EntityPlayer && stack.hasTagCompound()) { - EntityPlayer player = (EntityPlayer) entity; + if (entity instanceof PlayerEntity && stack.hasTagCompound()) { + PlayerEntity player = (PlayerEntity) entity; boolean creative = player.capabilities.isCreativeMode; - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); BlockPos firstPos = new BlockPos(compound.getInteger("FirstX"), compound.getInteger("FirstY"), compound.getInteger("FirstZ")); BlockPos secondPos = new BlockPos(compound.getInteger("SecondX"), compound.getInteger("SecondY"), compound.getInteger("SecondZ")); @@ -154,9 +157,9 @@ public class ItemFillingWand extends ItemEnergy { if (!BlockPos.ORIGIN.equals(firstPos) && !BlockPos.ORIGIN.equals(secondPos)) { int energyUse = 1500; - Pair data = loadData(stack); + Pair data = loadData(stack); if (data != null && (creative || this.getEnergyStored(stack) >= energyUse)) { - IBlockState replaceState = data.getLeft(); + BlockState replaceState = data.getLeft(); int lowestX = Math.min(firstPos.getX(), secondPos.getX()); int lowestY = Math.min(firstPos.getY(), secondPos.getY()); int lowestZ = Math.min(firstPos.getZ(), secondPos.getZ()); @@ -166,7 +169,7 @@ public class ItemFillingWand extends ItemEnergy { int currZ = compound.getInteger("CurrZ"); BlockPos pos = new BlockPos(lowestX + currX, lowestY + currY, lowestZ + currZ); - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); if (state.getBlock().isReplaceable(world, pos) && replaceState.getBlock().canPlaceBlockAt(world, pos)) { if (creative || removeFittingItem(replaceState, player)) { @@ -226,7 +229,7 @@ public class ItemFillingWand extends ItemEnergy { String display = StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".item_filling_wand.selectedBlock.none"); - Pair data = loadData(stack); + Pair data = loadData(stack); if (data != null) { display = data.getRight(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java index e8658583b..0a7ea5a79 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; @@ -19,14 +17,16 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.world.World; +import java.util.List; + public class ItemFilter extends ItemBase { public ItemFilter(String name) { @@ -40,8 +40,8 @@ public class ItemFilter extends ItemBase { } @Override - public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { - if (!world.isRemote && hand == EnumHand.MAIN_HAND) { + public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { + if (!world.isRemote && hand == Hand.MAIN_HAND) { player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FILTER.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ); } return new ActionResult<>(EnumActionResult.PASS, player.getHeldItem(hand)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java index aed981b8c..0a055bee2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java @@ -19,14 +19,14 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class ItemFoods extends ItemFoodBase { @@ -43,8 +43,8 @@ public class ItemFoods extends ItemFoodBase { public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player) { ItemStack stackToReturn = super.onItemUseFinish(stack, world, player); ItemStack returnItem = stack.getItemDamage() >= ALL_FOODS.length ? null : ALL_FOODS[stack.getItemDamage()].returnItem; - if (StackUtil.isValid(returnItem) && player instanceof EntityPlayer) { - if (!((EntityPlayer) player).inventory.addItemStackToInventory(returnItem.copy())) { + if (StackUtil.isValid(returnItem) && player instanceof PlayerEntity) { + if (!((PlayerEntity) player).inventory.addItemStackToInventory(returnItem.copy())) { if (!world.isRemote) { EntityItem entityItem = new EntityItem(player.world, player.posX, player.posY, player.posZ, returnItem.copy()); entityItem.setPickupDelay(0); @@ -91,7 +91,7 @@ public class ItemFoods extends ItemFoodBase { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void getSubItems(CreativeTabs tab, NonNullList list) { if (this.isInCreativeTab(tab)) { for (int j = 0; j < ALL_FOODS.length; j++) { @@ -107,4 +107,4 @@ public class ItemFoods extends ItemFoodBase { ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), new ModelResourceLocation(name), "inventory"); } } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java index 51de42b1a..90b4315c1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java @@ -18,9 +18,9 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockGrass; import net.minecraft.block.IGrowable; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; @@ -36,9 +36,9 @@ public class ItemGrowthRing extends ItemEnergy { @Override public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { - if (!(entity instanceof EntityPlayer) || world.isRemote || entity.isSneaking()) { return; } + if (!(entity instanceof PlayerEntity) || world.isRemote || entity.isSneaking()) { return; } - EntityPlayer player = (EntityPlayer) entity; + PlayerEntity player = (PlayerEntity) entity; ItemStack equipped = player.getHeldItemMainhand(); int energyUse = 300; @@ -69,13 +69,13 @@ public class ItemGrowthRing extends ItemEnergy { if (this.getEnergyStored(stack) >= energyUse) { BlockPos pos = blocks.get(world.rand.nextInt(blocks.size())); - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); Block block = state.getBlock(); int metaBefore = block.getMetaFromState(state); block.updateTick(world, pos, world.getBlockState(pos), world.rand); //Show Particles if Metadata changed - IBlockState newState = world.getBlockState(pos); + BlockState newState = world.getBlockState(pos); if (newState.getBlock().getMetaFromState(newState) != metaBefore) { world.playEvent(2005, pos, 0); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java index 6778174a5..ca6dd9a8e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java @@ -10,29 +10,25 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.Random; -import java.util.UUID; - import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntityOcelot; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.init.SoundEvents; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.WeightedRandom; +import net.minecraft.util.*; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import java.util.Random; +import java.util.UUID; + public class ItemHairyBall extends ItemBase { private final UUID KittyVanCatUUID = UUID.fromString("681d4e20-10ef-40c9-a0a5-ba2f1995ef44"); @@ -47,7 +43,7 @@ public class ItemHairyBall extends ItemBase { public void livingUpdateEvent(LivingEvent.LivingUpdateEvent event) { //Ocelots dropping Hair Balls if (ConfigBoolValues.DO_CAT_DROPS.isEnabled() && event.getEntityLiving() != null && event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote) { - if (event.getEntityLiving() instanceof EntityOcelot && ((EntityOcelot) event.getEntityLiving()).isTamed() || event.getEntityLiving() instanceof EntityPlayer && event.getEntityLiving().getUniqueID().equals(this.KittyVanCatUUID)) { + if (event.getEntityLiving() instanceof EntityOcelot && ((EntityOcelot) event.getEntityLiving()).isTamed() || event.getEntityLiving() instanceof PlayerEntity && event.getEntityLiving().getUniqueID().equals(this.KittyVanCatUUID)) { if (event.getEntityLiving().world.rand.nextInt(ConfigIntValues.FUR_CHANCE.getValue()) == 0) { EntityItem item = new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX + 0.5, event.getEntityLiving().posY + 0.5, event.getEntityLiving().posZ + 0.5, new ItemStack(InitItems.itemHairyBall)); event.getEntityLiving().world.spawnEntity(item); @@ -57,7 +53,7 @@ public class ItemHairyBall extends ItemBase { } @Override - public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { + public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { ItemStack stack = player.getHeldItem(hand); if (!world.isRemote) { ItemStack returnItem = this.getRandomReturnItem(world.rand); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java index 83b8f3d8f..456de82ce 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java @@ -19,7 +19,7 @@ import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.init.Items; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -28,7 +28,7 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class ItemJams extends ItemFoodBase implements IColorProvidingItem { @@ -57,7 +57,7 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void getSubItems(CreativeTabs tab, NonNullList list) { if (this.isInCreativeTab(tab)) { for (int j = 0; j < ALL_JAMS.length; j++) { @@ -70,7 +70,7 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem { public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player) { ItemStack stackToReturn = super.onItemUseFinish(stack, world, player); - if (player instanceof EntityPlayer && !world.isRemote && stack.getItemDamage() < ALL_JAMS.length) { + if (player instanceof PlayerEntity && !world.isRemote && stack.getItemDamage() < ALL_JAMS.length) { PotionEffect firstEffectToGet = new PotionEffect(Potion.getPotionById(ALL_JAMS[stack.getItemDamage()].firstEffectToGet), 200); player.addPotionEffect(firstEffectToGet); @@ -78,7 +78,7 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem { player.addPotionEffect(secondEffectToGet); ItemStack returnItem = new ItemStack(Items.GLASS_BOTTLE); - if (!((EntityPlayer) player).inventory.addItemStackToInventory(returnItem.copy())) { + if (!((PlayerEntity) player).inventory.addItemStackToInventory(returnItem.copy())) { EntityItem entityItem = new EntityItem(player.world, player.posX, player.posY, player.posZ, returnItem.copy()); entityItem.setPickupDelay(0); player.world.spawnEntity(entityItem); @@ -105,8 +105,8 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IItemColor getItemColor() { return (stack, pass) -> pass > 0 ? stack.getItemDamage() >= ALL_JAMS.length ? 0xFFFFFF : ALL_JAMS[stack.getItemDamage()].color : 0xFFFFFF; } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java index 3c2068efc..f8098be62 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java @@ -10,26 +10,26 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.List; - import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; +import java.util.List; + public class ItemLaserWrench extends ItemBase { public ItemLaserWrench(String name) { @@ -38,7 +38,7 @@ public class ItemLaserWrench extends ItemBase { } @Override - public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing par7, float par8, float par9, float par10) { + public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing par7, float par8, float par9, float par10) { ItemStack stack = player.getHeldItem(hand); TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityLaserRelay) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java index e07ae858c..b79ec06e2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java @@ -10,16 +10,13 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.ArrayList; -import java.util.Collections; - import de.ellpeck.actuallyadditions.api.misc.IDisplayStandItem; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.init.SoundEvents; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; @@ -27,13 +24,16 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.IShearable; +import java.util.ArrayList; +import java.util.Collections; + public class ItemLeafBlower extends ItemBase implements IDisplayStandItem { private final boolean isAdvanced; @@ -45,7 +45,7 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem { } @Override - public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { + public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { player.setActiveHand(hand); return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand)); } @@ -63,7 +63,9 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem { @Override public EnumRarity getRarity(ItemStack stack) { - return this.isAdvanced ? EnumRarity.EPIC : EnumRarity.RARE; + return this.isAdvanced + ? EnumRarity.EPIC + : EnumRarity.RARE; } @Override @@ -99,7 +101,11 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem { int rangeUp = 1; for (int reachX = -rangeSides; reachX < rangeSides + 1; reachX++) { for (int reachZ = -rangeSides; reachZ < rangeSides + 1; reachZ++) { - for (int reachY = this.isAdvanced ? -rangeSides : -rangeUp; reachY < (this.isAdvanced ? rangeSides : rangeUp) + 1; reachY++) { + for (int reachY = this.isAdvanced + ? -rangeSides + : -rangeUp; reachY < (this.isAdvanced + ? rangeSides + : rangeUp) + 1; reachY++) { //The current Block to break BlockPos pos = new BlockPos(x + reachX, y + reachY, z + reachZ); Block block = world.getBlockState(pos).getBlock(); @@ -115,7 +121,7 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem { Collections.shuffle(breakPositions); BlockPos theCoord = breakPositions.get(0); - IBlockState theState = world.getBlockState(theCoord); + BlockState theState = world.getBlockState(theCoord); theState.getBlock().dropBlockAsItem(world, theCoord, theState, 0); //Plays the Breaking Sound diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java index ada7e71c7..834846311 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java @@ -10,21 +10,21 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; +import java.util.List; + public class ItemMagnetRing extends ItemEnergy { public ItemMagnetRing(String name) { @@ -38,16 +38,20 @@ public class ItemMagnetRing extends ItemEnergy { @Override public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { - if (entity instanceof EntityPlayer && !world.isRemote && !ItemUtil.isEnabled(stack)) { - EntityPlayer player = (EntityPlayer) entity; - if (player.isCreative() || player.isSpectator()) return; + if (entity instanceof PlayerEntity && !world.isRemote && !ItemUtil.isEnabled(stack)) { + PlayerEntity player = (PlayerEntity) entity; + if (player.isCreative() || player.isSpectator()) { + return; + } if (!entity.isSneaking()) { //Get all the Items in the area int range = 5; List items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range)); if (!items.isEmpty()) { for (EntityItem item : items) { - if (item.getEntityData().getBoolean("PreventRemoteMovement")) continue; + if (item.getEntityData().getBoolean("PreventRemoteMovement")) { + continue; + } if (!item.isDead && !item.cannotPickup()) { int energyForItem = 50 * item.getItem().getCount(); @@ -70,7 +74,7 @@ public class ItemMagnetRing extends ItemEnergy { } @Override - public ActionResult onItemRightClick(World worldIn, EntityPlayer player, EnumHand hand) { + public ActionResult onItemRightClick(World worldIn, PlayerEntity player, Hand hand) { if (!worldIn.isRemote && player.isSneaking()) { ItemUtil.changeEnabled(player, hand); return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMisc.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMisc.java index db4f923f6..21d1ebc19 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMisc.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMisc.java @@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.EnumRarity; @@ -28,7 +28,7 @@ import net.minecraftforge.common.IRarity; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class ItemMisc extends ItemBase { @@ -55,7 +55,7 @@ public class ItemMisc extends ItemBase { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void getSubItems(CreativeTabs tab, NonNullList list) { if (this.isInCreativeTab(tab)) { for (int j = 0; j < ALL_MISC_ITEMS.length; j++) { @@ -82,7 +82,7 @@ public class ItemMisc extends ItemBase { boolean isEmpowered = stack.getItemDamage() == TheMiscItems.EMPOWERED_CANOLA_SEED.ordinal(); if (stack.getItemDamage() == TheMiscItems.CRYSTALLIZED_CANOLA_SEED.ordinal() || isEmpowered) { BlockPos pos = entity.getPosition(); - IBlockState state = entity.world.getBlockState(pos); + BlockState state = entity.world.getBlockState(pos); Block block = state.getBlock(); if (block instanceof IFluidBlock && block.getMetaFromState(state) == 0) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java index 2555fd0af..24621381d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java @@ -10,30 +10,29 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.List; - -import javax.annotation.Nullable; - import de.ellpeck.actuallyadditions.api.tile.IPhantomTile; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; +import javax.annotation.Nullable; +import java.util.List; + public class ItemPhantomConnector extends ItemBase { public ItemPhantomConnector(String name) { @@ -42,25 +41,29 @@ public class ItemPhantomConnector extends ItemBase { } public static World getStoredWorld(ItemStack stack) { - NBTTagCompound tag = stack.getTagCompound(); - if (tag != null) { return DimensionManager.getWorld(tag.getInteger("WorldOfTileStored")); } + CompoundNBT tag = stack.getTagCompound(); + if (tag != null) { + return DimensionManager.getWorld(tag.getInteger("WorldOfTileStored")); + } return null; } public static BlockPos getStoredPosition(ItemStack stack) { - NBTTagCompound tag = stack.getTagCompound(); + CompoundNBT tag = stack.getTagCompound(); if (tag != null) { int x = tag.getInteger("XCoordOfTileStored"); int y = tag.getInteger("YCoordOfTileStored"); int z = tag.getInteger("ZCoordOfTileStored"); - if (!(x == 0 && y == 0 && z == 0)) { return new BlockPos(x, y, z); } + if (!(x == 0 && y == 0 && z == 0)) { + return new BlockPos(x, y, z); + } } return null; } public static void clearStorage(ItemStack stack, String... keys) { if (stack.hasTagCompound()) { - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); for (String key : keys) { compound.removeTag(key); } @@ -68,9 +71,9 @@ public class ItemPhantomConnector extends ItemBase { } public static void storeConnection(ItemStack stack, int x, int y, int z, World world) { - NBTTagCompound tag = stack.getTagCompound(); + CompoundNBT tag = stack.getTagCompound(); if (tag == null) { - tag = new NBTTagCompound(); + tag = new CompoundNBT(); } tag.setInteger("XCoordOfTileStored", x); @@ -82,7 +85,7 @@ public class ItemPhantomConnector extends ItemBase { } @Override - public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing par7, float par8, float par9, float par10) { + public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing par7, float par8, float par9, float par10) { ItemStack stack = player.getHeldItem(hand); if (!world.isRemote) { //Passing Data to Phantoms diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java index 4d674f9ef..4268620f5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java @@ -18,7 +18,7 @@ import com.google.common.collect.Sets; import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -39,7 +39,7 @@ public class ItemPickaxeAA extends ItemToolAA { } @Override - public boolean canHarvestBlock(IBlockState blockIn) { + public boolean canHarvestBlock(BlockState blockIn) { Block block = blockIn.getBlock(); if (block == Blocks.OBSIDIAN) { @@ -73,7 +73,7 @@ public class ItemPickaxeAA extends ItemToolAA { } @Override - public float getDestroySpeed(ItemStack stack, IBlockState state) { + public float getDestroySpeed(ItemStack stack, BlockState state) { Material material = state.getMaterial(); return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getDestroySpeed(stack, state) : this.efficiency; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPlayerProbe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPlayerProbe.java index a0c78bd3f..f1028de14 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPlayerProbe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPlayerProbe.java @@ -10,11 +10,6 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.List; -import java.util.UUID; - -import javax.annotation.Nullable; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlayerInterface; @@ -23,17 +18,21 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; +import javax.annotation.Nullable; +import java.util.List; +import java.util.UUID; + public class ItemPlayerProbe extends ItemBase { public ItemPlayerProbe(String name) { @@ -45,10 +44,10 @@ public class ItemPlayerProbe extends ItemBase { public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) { if (!world.isRemote) { if (stack.hasTagCompound()) { - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); if (compound.hasKey("UUIDMost")) { UUID id = compound.getUniqueId("UUID"); - EntityPlayer player = world.getPlayerEntityByUUID(id); + PlayerEntity player = world.getPlayerEntityByUUID(id); if (player != null) { if (player.isSneaking()) { ItemPhantomConnector.clearStorage(stack, "UUIDLeast", "UUIDMost", "Name"); @@ -66,12 +65,12 @@ public class ItemPlayerProbe extends ItemBase { } @Override - public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityPlayerInterface) { if (stack.hasTagCompound()) { - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); if (compound.hasKey("UUIDMost")) { if (!world.isRemote) { TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile; @@ -90,19 +89,19 @@ public class ItemPlayerProbe extends ItemBase { } @Override - public boolean itemInteractionForEntity(ItemStack aStack, EntityPlayer player, EntityLivingBase entity, EnumHand hand) { + public boolean itemInteractionForEntity(ItemStack aStack, PlayerEntity player, EntityLivingBase entity, Hand hand) { if (!player.world.isRemote) { ItemStack stack = player.getHeldItemMainhand(); if (StackUtil.isValid(stack) && stack.getItem() == this) { - if (entity instanceof EntityPlayer) { - EntityPlayer playerHit = (EntityPlayer) entity; + if (entity instanceof PlayerEntity) { + PlayerEntity playerHit = (PlayerEntity) entity; if (!playerHit.isSneaking()) { if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); } - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); compound.setString("Name", playerHit.getName()); compound.setUniqueId("UUID", playerHit.getUniqueID()); return true; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java index 3a0c7a1f4..7e13a8c48 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java @@ -10,11 +10,6 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.Collections; -import java.util.List; - -import javax.annotation.Nullable; - import de.ellpeck.actuallyadditions.api.misc.IDisplayStandItem; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; @@ -28,10 +23,10 @@ import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.tileentity.TileEntity; @@ -39,8 +34,11 @@ import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import javax.annotation.Nullable; +import java.util.Collections; +import java.util.List; public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDisplayStandItem { @@ -67,7 +65,7 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi public static void setStoredBlaze(ItemStack stack, int amount) { if (StackUtil.isValid(stack)) { if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); } stack.getTagCompound().setInteger("Blaze", amount); } @@ -92,7 +90,9 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi @Override public String getTranslationKey(ItemStack stack) { - return stack.getItemDamage() >= ALL_RINGS.length ? StringUtil.BUGGED_ITEM_NAME : this.getTranslationKey() + ALL_RINGS[stack.getItemDamage()].name; + return stack.getItemDamage() >= ALL_RINGS.length + ? StringUtil.BUGGED_ITEM_NAME + : this.getTranslationKey() + ALL_RINGS[stack.getItemDamage()].name; } @Override @@ -105,8 +105,8 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi super.onUpdate(stack, world, player, par4, par5); if (!world.isRemote && stack.getItemDamage() < ALL_RINGS.length) { - if (player instanceof EntityPlayer) { - EntityPlayer thePlayer = (EntityPlayer) player; + if (player instanceof PlayerEntity) { + PlayerEntity thePlayer = (PlayerEntity) player; int storedBlaze = getStoredBlaze(stack); if (storedBlaze > 0) { @@ -148,11 +148,13 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi @Override public EnumRarity getRarity(ItemStack stack) { - return stack.getItemDamage() >= ALL_RINGS.length ? EnumRarity.COMMON : ALL_RINGS[stack.getItemDamage()].rarity; + return stack.getItemDamage() >= ALL_RINGS.length + ? EnumRarity.COMMON + : ALL_RINGS[stack.getItemDamage()].rarity; } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void getSubItems(CreativeTabs tab, NonNullList list) { if (this.isInCreativeTab(tab)) { for (int j = 0; j < ALL_RINGS.length; j++) { @@ -173,15 +175,19 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IItemColor getItemColor() { - return (stack, tintIndex) -> stack.getItemDamage() >= ALL_RINGS.length ? 0xFFFFFF : ALL_RINGS[stack.getItemDamage()].color; + return (stack, tintIndex) -> stack.getItemDamage() >= ALL_RINGS.length + ? 0xFFFFFF + : ALL_RINGS[stack.getItemDamage()].color; } @Override public boolean update(ItemStack stack, TileEntity tile, int elapsedTicks) { boolean advanced = ((ItemPotionRing) stack.getItem()).isAdvanced; - int range = advanced ? 48 : 16; + int range = advanced + ? 48 + : 16; List entities = tile.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(tile.getPos().getX() - range, tile.getPos().getY() - range, tile.getPos().getZ() - range, tile.getPos().getX() + range, tile.getPos().getY() + range, tile.getPos().getZ() + range)); if (entities != null && !entities.isEmpty()) { if (advanced) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java index 78a59f2a4..f8a8af5b5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java @@ -11,12 +11,12 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.world.World; public class ItemResonantRice extends ItemBase { @@ -26,7 +26,7 @@ public class ItemResonantRice extends ItemBase { } @Override - public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { + public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { ItemStack stack = player.getHeldItem(hand); if (!world.isRemote) { stack.shrink(1); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java index 7180d8ded..1913df305 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java @@ -10,26 +10,25 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.Collections; -import java.util.Set; - import com.google.common.collect.Sets; - import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.IRarity; +import java.util.Collections; +import java.util.Set; + public class ItemShovelAA extends ItemToolAA { private static final Set EFFECTIVE_ON = Sets.newHashSet(Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH); @@ -45,13 +44,13 @@ public class ItemShovelAA extends ItemToolAA { } @Override - public boolean canHarvestBlock(IBlockState blockIn) { + public boolean canHarvestBlock(BlockState blockIn) { Block block = blockIn.getBlock(); return block == Blocks.SNOW_LAYER || block == Blocks.SNOW; } @Override - public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { return Items.IRON_SHOVEL.onItemUse(playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java index 37b393c1e..40400f5ae 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java @@ -16,12 +16,12 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityXPOrb; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.FakePlayer; @@ -41,7 +41,7 @@ public class ItemSolidifiedExperience extends ItemBase { @SubscribeEvent public void onEntityDropEvent(LivingDropsEvent event) { if (ConfigBoolValues.DO_XP_DROPS.isEnabled()) { - if (event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote && event.getSource().getTrueSource() instanceof EntityPlayer && event.getEntityLiving().world.getGameRules().getBoolean("doMobLoot")) { + if (event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote && event.getSource().getTrueSource() instanceof PlayerEntity && event.getEntityLiving().world.getGameRules().getBoolean("doMobLoot")) { //Drop Solidified XP if (event.getEntityLiving() instanceof EntityCreature) { if (event.getEntityLiving().world.rand.nextInt(10) <= event.getLootingLevel() * 2) { @@ -53,7 +53,7 @@ public class ItemSolidifiedExperience extends ItemBase { } @Override - public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { + public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { ItemStack stack = player.getHeldItem(hand); if (!world.isRemote) { int amount; @@ -73,7 +73,9 @@ public class ItemSolidifiedExperience extends ItemBase { EntityXPOrb orb = new EntityXPOrb(world, player.posX + 0.5, player.posY + 0.5, player.posZ + 0.5, amount); orb.getEntityData().setBoolean(ActuallyAdditions.MODID + "FromSolidified", true); world.spawnEntity(orb); - } else player.addExperience(amount); + } else { + player.addExperience(amount); + } } return new ActionResult<>(EnumActionResult.SUCCESS, stack); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSpawnerChanger.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSpawnerChanger.java index fa805acb3..54da2177d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSpawnerChanger.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSpawnerChanger.java @@ -10,31 +10,31 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.MobSpawnerBaseLogic; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; +import java.util.List; + public class ItemSpawnerChanger extends ItemBase { public ItemSpawnerChanger(String name) { @@ -43,7 +43,7 @@ public class ItemSpawnerChanger extends ItemBase { } @Override - public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (!world.isRemote) { ItemStack stack = player.getHeldItemMainhand(); if (player.canPlayerEdit(pos.offset(facing), facing, stack)) { @@ -55,7 +55,7 @@ public class ItemSpawnerChanger extends ItemBase { //This is a hacky way to remove the spawn potentials that make the spawner reset from time to time //Don't judge, there isn't a method for it and it's better than Reflection hackiness - NBTTagCompound compound = new NBTTagCompound(); + CompoundNBT compound = new CompoundNBT(); logic.writeToNBT(compound); compound.removeTag("SpawnPotentials"); compound.removeTag("SpawnData"); @@ -65,7 +65,7 @@ public class ItemSpawnerChanger extends ItemBase { tile.markDirty(); - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); world.notifyBlockUpdate(pos, state, state, 3); ItemPhantomConnector.clearStorage(stack, "Entity"); @@ -83,7 +83,7 @@ public class ItemSpawnerChanger extends ItemBase { } @Override - public boolean itemInteractionForEntity(ItemStack aStack, EntityPlayer player, EntityLivingBase entity, EnumHand hand) { + public boolean itemInteractionForEntity(ItemStack aStack, PlayerEntity player, EntityLivingBase entity, Hand hand) { if (!player.world.isRemote) { ItemStack stack = player.getHeldItemMainhand(); if (this.getStoredEntity(stack) == null) { @@ -98,16 +98,18 @@ public class ItemSpawnerChanger extends ItemBase { private boolean storeClickedEntity(ItemStack stack, EntityLivingBase entity) { if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); } - if (!(entity instanceof EntityPlayer) && entity.isNonBoss()) { + if (!(entity instanceof PlayerEntity) && entity.isNonBoss()) { ResourceLocation entityLoc = EntityList.getKey(entity.getClass()); if (entityLoc != null) { String entityName = entityLoc.toString(); if (entityName != null && !entityName.isEmpty()) { for (String name : ConfigStringListValues.SPAWNER_CHANGER_BLACKLIST.getValue()) { - if (entityName.equals(name)) { return false; } + if (entityName.equals(name)) { + return false; + } } stack.getTagCompound().setString("Entity", entityName); @@ -121,7 +123,9 @@ public class ItemSpawnerChanger extends ItemBase { private String getStoredEntity(ItemStack stack) { if (stack.hasTagCompound()) { String entity = stack.getTagCompound().getString("Entity"); - if (entity != null && !entity.isEmpty()) { return entity; } + if (entity != null && !entity.isEmpty()) { + return entity; + } } return null; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java index 1d3e8fb54..7f7329df4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java @@ -12,14 +12,14 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.init.SoundEvents; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; @@ -32,20 +32,32 @@ public class ItemTeleStaff extends ItemEnergy { } @Override - public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { + public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { ItemStack stack = player.getHeldItem(hand); if (!world.isRemote) { RayTraceResult pos = WorldUtil.getNearestPositionWithAir(world, player, 100); if (pos != null && (pos.typeOfHit == RayTraceResult.Type.BLOCK || player.rotationPitch >= -5)) { int side = pos.sideHit.ordinal(); if (side != -1) { - double x = pos.hitVec.x - (side == 4 ? 0.5 : 0) + (side == 5 ? 0.5 : 0); - double y = pos.hitVec.y - (side == 0 ? 2.0 : 0) + (side == 1 ? 0.5 : 0); - double z = pos.hitVec.z - (side == 2 ? 0.5 : 0) + (side == 3 ? 0.5 : 0); + double x = pos.hitVec.x - (side == 4 + ? 0.5 + : 0) + (side == 5 + ? 0.5 + : 0); + double y = pos.hitVec.y - (side == 0 + ? 2.0 + : 0) + (side == 1 + ? 0.5 + : 0); + double z = pos.hitVec.z - (side == 2 + ? 0.5 + : 0) + (side == 3 + ? 0.5 + : 0); int baseUse = 200; int use = baseUse + (int) (baseUse * pos.hitVec.distanceTo(new Vec3d(player.posX, player.posY + (player.getEyeHeight() - player.getDefaultEyeHeight()), player.posZ))); if (this.getEnergyStored(stack) >= use) { - ((EntityPlayerMP) player).connection.setPlayerLocation(x, y, z, player.rotationYaw, player.rotationPitch); + ((ServerPlayerEntity) player).connection.setPlayerLocation(x, y, z, player.rotationYaw, player.rotationPitch); player.dismountRidingEntity(); world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1.0F, 1.0F); if (!player.capabilities.isCreativeMode) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java index ec14ce369..ba21658e5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java @@ -17,21 +17,18 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ActionResult; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; @@ -58,7 +55,7 @@ public class ItemWaterBowl extends ItemBase { ActionResult result = ForgeEventFactory.onBucketUse(event.getEntityPlayer(), event.getWorld(), event.getItemStack(), trace); if (result == null && trace != null && trace.getBlockPos() != null) { if (event.getEntityPlayer().canPlayerEdit(trace.getBlockPos().offset(trace.sideHit), trace.sideHit, event.getItemStack())) { - IBlockState state = event.getWorld().getBlockState(trace.getBlockPos()); + BlockState state = event.getWorld().getBlockState(trace.getBlockPos()); Block block = state.getBlock(); if ((block == Blocks.WATER || block == Blocks.FLOWING_WATER) && state.getValue(BlockLiquid.LEVEL) == 0) { @@ -86,12 +83,14 @@ public class ItemWaterBowl extends ItemBase { } @Override - public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { + public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { ItemStack stack = player.getHeldItem(hand); RayTraceResult trace = WorldUtil.getNearestBlockWithDefaultReachDistance(world, player); ActionResult result = ForgeEventFactory.onBucketUse(player, world, stack, trace); - if (result != null) { return result; } + if (result != null) { + return result; + } if (trace == null) { return new ActionResult<>(EnumActionResult.PASS, stack); @@ -103,12 +102,16 @@ public class ItemWaterBowl extends ItemBase { if (!world.isBlockModifiable(player, pos)) { return new ActionResult<>(EnumActionResult.FAIL, stack); } else { - BlockPos pos1 = world.getBlockState(pos).getBlock().isReplaceable(world, pos) && trace.sideHit == EnumFacing.UP ? pos : pos.offset(trace.sideHit); + BlockPos pos1 = world.getBlockState(pos).getBlock().isReplaceable(world, pos) && trace.sideHit == EnumFacing.UP + ? pos + : pos.offset(trace.sideHit); if (!player.canPlayerEdit(pos1, trace.sideHit, stack)) { return new ActionResult<>(EnumActionResult.FAIL, stack); } else if (this.tryPlaceContainedLiquid(player, world, pos1, false)) { - return !player.capabilities.isCreativeMode ? new ActionResult<>(EnumActionResult.SUCCESS, new ItemStack(Items.BOWL)) : new ActionResult<>(EnumActionResult.SUCCESS, stack); + return !player.capabilities.isCreativeMode + ? new ActionResult<>(EnumActionResult.SUCCESS, new ItemStack(Items.BOWL)) + : new ActionResult<>(EnumActionResult.SUCCESS, stack); } else { return new ActionResult<>(EnumActionResult.FAIL, stack); } @@ -125,7 +128,7 @@ public class ItemWaterBowl extends ItemBase { int lastY = 0; if (stack.hasTagCompound()) { - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); lastX = compound.getInteger("lastX"); lastY = compound.getInteger("lastY"); } @@ -133,8 +136,8 @@ public class ItemWaterBowl extends ItemBase { boolean change = false; if (lastX != 0 && lastX != (int) entity.posX || lastY != 0 && lastY != (int) entity.posY) { if (!entity.isSneaking()) { - if (entity instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) entity; + if (entity instanceof PlayerEntity) { + PlayerEntity player = (PlayerEntity) entity; if (this.tryPlaceContainedLiquid(player, world, player.getPosition(), true)) { this.checkReplace(player, stack, new ItemStack(Items.BOWL), itemSlot); } @@ -145,10 +148,10 @@ public class ItemWaterBowl extends ItemBase { if (change || lastX == 0 || lastY == 0) { if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); } - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); compound.setInteger("lastX", (int) entity.posX); compound.setInteger("lastY", (int) entity.posY); } @@ -157,9 +160,12 @@ public class ItemWaterBowl extends ItemBase { } } - private void checkReplace(EntityPlayer player, ItemStack old, ItemStack stack, int slot) { - if (player.inventory.getStackInSlot(slot) == old) player.inventory.setInventorySlotContents(slot, stack); - else if (player.inventory.offHandInventory.get(slot) == old) player.inventory.offHandInventory.set(slot, stack); + private void checkReplace(PlayerEntity player, ItemStack old, ItemStack stack, int slot) { + if (player.inventory.getStackInSlot(slot) == old) { + player.inventory.setInventorySlotContents(slot, stack); + } else if (player.inventory.offHandInventory.get(slot) == old) { + player.inventory.offHandInventory.set(slot, stack); + } } @Override @@ -167,8 +173,8 @@ public class ItemWaterBowl extends ItemBase { return !ItemStack.areItemsEqual(oldStack, newStack); } - public boolean tryPlaceContainedLiquid(EntityPlayer player, World world, BlockPos pos, boolean finite) { - IBlockState state = world.getBlockState(pos); + public boolean tryPlaceContainedLiquid(PlayerEntity player, World world, BlockPos pos, boolean finite) { + BlockState state = world.getBlockState(pos); Material material = state.getMaterial(); boolean nonSolid = !material.isSolid(); boolean replaceable = state.getBlock().isReplaceable(world, pos); @@ -189,7 +195,7 @@ public class ItemWaterBowl extends ItemBase { world.playSound(player, pos, SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); - IBlockState placeState; + BlockState placeState; if (finite) { placeState = Blocks.FLOWING_WATER.getDefaultState(); } else { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java index ef420d299..faf771de1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.Block; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -30,9 +30,9 @@ public class ItemWaterRemovalRing extends ItemEnergy { @Override public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { - if (!(entity instanceof EntityPlayer) || world.isRemote || entity.isSneaking()) { return; } + if (!(entity instanceof PlayerEntity) || world.isRemote || entity.isSneaking()) { return; } - EntityPlayer player = (EntityPlayer) entity; + PlayerEntity player = (PlayerEntity) entity; ItemStack equipped = player.getHeldItemMainhand(); int energyUse = 150; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java index 49291f1bc..87f0ffa6c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java @@ -17,11 +17,11 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntityBat; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; @@ -51,7 +51,7 @@ public class ItemWingsOfTheBats extends ItemBase { * @param player The Player * @return The Wings */ - public static ItemStack getWingItem(EntityPlayer player) { + public static ItemStack getWingItem(PlayerEntity player) { for (int i = 0; i < player.inventory.getSizeInventory(); i++) { if (StackUtil.isValid(player.inventory.getStackInSlot(i)) && player.inventory.getStackInSlot(i).getItem() instanceof ItemWingsOfTheBats) { return player.inventory.getStackInSlot(i); } } @@ -65,7 +65,7 @@ public class ItemWingsOfTheBats extends ItemBase { @Override public double getDurabilityForDisplay(ItemStack stack) { - EntityPlayer player = ActuallyAdditions.PROXY.getCurrentPlayer(); + PlayerEntity player = ActuallyAdditions.PROXY.getCurrentPlayer(); if (player != null) { PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); if (data != null) { @@ -78,7 +78,7 @@ public class ItemWingsOfTheBats extends ItemBase { @Override public int getRGBDurabilityForDisplay(ItemStack stack) { - EntityPlayer player = ActuallyAdditions.PROXY.getCurrentPlayer(); + PlayerEntity player = ActuallyAdditions.PROXY.getCurrentPlayer(); if (player != null) { PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); if (data != null) { @@ -93,7 +93,7 @@ public class ItemWingsOfTheBats extends ItemBase { public void onEntityDropEvent(LivingDropsEvent event) { Entity source = event.getSource().getTrueSource(); - if (event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote && source instanceof EntityPlayer) { + if (event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote && source instanceof PlayerEntity) { //Drop Wings from Bats if (ConfigBoolValues.DO_BAT_DROPS.isEnabled() && event.getEntityLiving() instanceof EntityBat) { int looting = event.getLootingLevel(); @@ -115,8 +115,8 @@ public class ItemWingsOfTheBats extends ItemBase { @SubscribeEvent public void livingUpdateEvent(LivingEvent.LivingUpdateEvent event) { - if (event.getEntityLiving() instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) event.getEntityLiving(); + if (event.getEntityLiving() instanceof PlayerEntity) { + PlayerEntity player = (PlayerEntity) event.getEntityLiving(); if (!player.capabilities.isCreativeMode && !player.isSpectator()) { PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); @@ -166,7 +166,7 @@ public class ItemWingsOfTheBats extends ItemBase { deductTime = 2; } else { BlockPos pos = new BlockPos(player.posX, player.posY + player.height, player.posZ); - IBlockState state = player.world.getBlockState(pos); + BlockState state = player.world.getBlockState(pos); if (state != null && state.isSideSolid(player.world, pos, EnumFacing.DOWN)) { deductTime = 10; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWorm.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWorm.java index fc57f8f39..72474027a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWorm.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWorm.java @@ -10,23 +10,21 @@ package de.ellpeck.actuallyadditions.mod.items; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.entity.EntityWorm; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import net.minecraft.block.BlockGrass; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.EnumRarity; import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -37,7 +35,9 @@ import net.minecraftforge.fml.common.eventhandler.Event.Result; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import java.util.List; public class ItemWorm extends ItemBase { @@ -48,17 +48,19 @@ public class ItemWorm extends ItemBase { this.addPropertyOverride(new ResourceLocation(ActuallyAdditions.MODID, "snail"), new IItemPropertyGetter() { @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public float apply(ItemStack stack, World world, EntityLivingBase entity) { - return "snail mail".equalsIgnoreCase(stack.getDisplayName()) ? 1F : 0F; + return "snail mail".equalsIgnoreCase(stack.getDisplayName()) + ? 1F + : 0F; } }); } @Override - public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float par8, float par9, float par10) { + public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing side, float par8, float par9, float par10) { ItemStack stack = player.getHeldItem(hand); - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); if (EntityWorm.canWormify(world, pos, state)) { List worms = world.getEntitiesWithinAABB(EntityWorm.class, new AxisAlignedBB(pos.getX() - 1, pos.getY(), pos.getZ() - 1, pos.getX() + 2, pos.getY() + 1, pos.getZ() + 2)); if (worms == null || worms.isEmpty()) { @@ -67,7 +69,9 @@ public class ItemWorm extends ItemBase { worm.setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); worm.setCustomNameTag(stack.getDisplayName()); world.spawnEntity(worm); - if (!player.capabilities.isCreativeMode) stack.shrink(1); + if (!player.capabilities.isCreativeMode) { + stack.shrink(1); + } } return EnumActionResult.SUCCESS; } @@ -82,7 +86,7 @@ public class ItemWorm extends ItemBase { if (!world.isRemote) { BlockPos pos = event.getPos(); if (world.isAirBlock(pos.up())) { - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); if (state.getBlock() instanceof BlockGrass && world.rand.nextFloat() >= 0.95F) { ItemStack stack = new ItemStack(InitItems.itemWorm, world.rand.nextInt(2) + 1); EntityItem item = new EntityItem(event.getWorld(), pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, stack); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java index d81e28ffe..7562eb8a8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java @@ -10,20 +10,15 @@ package de.ellpeck.actuallyadditions.mod.items.base; -import java.text.NumberFormat; -import java.util.List; - -import javax.annotation.Nullable; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.NonNullList; import net.minecraft.util.math.MathHelper; @@ -32,8 +27,11 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import javax.annotation.Nullable; +import java.text.NumberFormat; +import java.util.List; public abstract class ItemEnergy extends ItemBase { @@ -66,7 +64,7 @@ public abstract class ItemEnergy extends ItemBase { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public boolean hasEffect(ItemStack stack) { return false; } @@ -109,7 +107,7 @@ public abstract class ItemEnergy extends ItemBase { @Override public int getRGBDurabilityForDisplay(ItemStack stack) { - EntityPlayer player = ActuallyAdditions.PROXY.getCurrentPlayer(); + PlayerEntity player = ActuallyAdditions.PROXY.getCurrentPlayer(); if (player != null && player.world != null) { float[] color = AssetUtil.getWheelColor(player.world.getTotalWorldTime() % 256); return MathHelper.rgb(color[0] / 255F, color[1] / 255F, color[2] / 255F); @@ -149,7 +147,9 @@ public abstract class ItemEnergy extends ItemBase { public int receiveEnergy(ItemStack stack, int maxReceive, boolean simulate) { if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) { IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null); - if (storage != null) { return storage.receiveEnergy(maxReceive, simulate); } + if (storage != null) { + return storage.receiveEnergy(maxReceive, simulate); + } } return 0; } @@ -157,7 +157,9 @@ public abstract class ItemEnergy extends ItemBase { public int extractEnergy(ItemStack stack, int maxExtract, boolean simulate) { if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) { IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null); - if (storage != null) { return storage.extractEnergy(maxExtract, simulate); } + if (storage != null) { + return storage.extractEnergy(maxExtract, simulate); + } } return 0; } @@ -165,7 +167,9 @@ public abstract class ItemEnergy extends ItemBase { public int getEnergyStored(ItemStack stack) { if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) { IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null); - if (storage != null) { return storage.getEnergyStored(); } + if (storage != null) { + return storage.getEnergyStored(); + } } return 0; } @@ -173,13 +177,15 @@ public abstract class ItemEnergy extends ItemBase { public int getMaxEnergyStored(ItemStack stack) { if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) { IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null); - if (storage != null) { return storage.getMaxEnergyStored(); } + if (storage != null) { + return storage.getMaxEnergyStored(); + } } return 0; } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { return new EnergyCapabilityProvider(stack, this); } @@ -187,7 +193,7 @@ public abstract class ItemEnergy extends ItemBase { public final CustomEnergyStorage storage; - public EnergyCapabilityProvider(final ItemStack stack, ItemEnergy item) { + public EnergyCapabilityProvider(ItemStack stack, ItemEnergy item) { this.storage = new CustomEnergyStorage(item.maxPower, item.transfer, item.transfer) { @Override public int getEnergyStored() { @@ -201,7 +207,7 @@ public abstract class ItemEnergy extends ItemBase { @Override public void setEnergyStored(int energy) { if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); } stack.getTagCompound().setInteger("Energy", energy); @@ -217,7 +223,9 @@ public abstract class ItemEnergy extends ItemBase { @Nullable @Override public T getCapability(Capability capability, EnumFacing facing) { - if (capability == CapabilityEnergy.ENERGY) { return CapabilityEnergy.ENERGY.cast(this.storage); } + if (capability == CapabilityEnergy.ENERGY) { + return CapabilityEnergy.ENERGY.cast(this.storage); + } return null; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodSeed.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodSeed.java index 9b642a4eb..2ea31498e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodSeed.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodSeed.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; @@ -73,7 +73,7 @@ public class ItemFoodSeed extends ItemSeedFood { } @Override - public IBlockState getPlant(IBlockAccess world, BlockPos pos) { + public BlockState getPlant(IBlockAccess world, BlockPos pos) { return this.plant.getDefaultState(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java index 1b7f6708b..6969273c5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; @@ -66,7 +66,7 @@ public class ItemSeed extends ItemSeeds { } @Override - public IBlockState getPlant(IBlockAccess world, BlockPos pos) { + public BlockState getPlant(IBlockAccess world, BlockPos pos) { return this.plant.getDefaultState(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java index 4f897762d..53d8c5564 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java @@ -20,13 +20,13 @@ import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.WorldServer; @@ -52,16 +52,16 @@ public class LensColor extends Lens { private final Random rand = new Random(); @Override - public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { + public boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { if (hitBlock != null) { if (tile.getEnergy() >= ENERGY_USE) { - IBlockState state = tile.getWorldObject().getBlockState(hitBlock); + BlockState state = tile.getWorldObject().getBlockState(hitBlock); Block block = state.getBlock(); int meta = block.getMetaFromState(state); ItemStack returnStack = this.tryConvert(new ItemStack(block, 1, meta), hitState, hitBlock, tile); if (returnStack != null && returnStack.getItem() instanceof ItemBlock) { Block toPlace = Block.getBlockFromItem(returnStack.getItem()); - IBlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), hitBlock, EnumFacing.UP, 0, 0, 0, returnStack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), EnumHand.MAIN_HAND); + BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), hitBlock, EnumFacing.UP, 0, 0, 0, returnStack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND); tile.getWorldObject().setBlockState(hitBlock, state2Place, 2); tile.extractEnergy(ENERGY_USE); } @@ -85,7 +85,7 @@ public class LensColor extends Lens { return false; } - private ItemStack tryConvert(ItemStack stack, IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { + private ItemStack tryConvert(ItemStack stack, BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { if (StackUtil.isValid(stack)) { Item item = stack.getItem(); for (Map.Entry changer : ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_COLOR_CHANGERS.entrySet()) { @@ -110,4 +110,4 @@ public class LensColor extends Lens { public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot) { return tile.getEnergy() - energyUsePerShot >= ENERGY_USE; } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java index 302f495bf..cbd2ca0d7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java @@ -15,7 +15,7 @@ import java.util.ArrayList; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.mod.misc.DamageSources; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -23,7 +23,7 @@ import net.minecraft.util.math.BlockPos; public class LensDeath extends Lens { @Override - public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { + public boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { ArrayList entities = (ArrayList) tile.getWorldObject().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1)); for (EntityLivingBase entity : entities) { int use = this.getUsePerEntity(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java index 65afac6f2..d7b56b295 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java @@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items.lens; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -21,7 +21,7 @@ public class LensDetonation extends Lens { private static final int ENERGY_USE = 250000; @Override - public boolean invoke(IBlockState state, BlockPos hitBlock, IAtomicReconstructor tile) { + public boolean invoke(BlockState state, BlockPos hitBlock, IAtomicReconstructor tile) { if (hitBlock != null && !state.getBlock().isAir(state, tile.getWorldObject(), hitBlock)) { if (tile.getEnergy() >= ENERGY_USE) { tile.getWorldObject().newExplosion(null, hitBlock.getX() + 0.5, hitBlock.getY() + 0.5, hitBlock.getZ() + 0.5, 10F, true, true); @@ -46,4 +46,4 @@ public class LensDetonation extends Lens { public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot) { return tile.getEnergy() - energyUsePerShot >= ENERGY_USE; } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java index e902b69cb..2657acc98 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java @@ -17,7 +17,7 @@ import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentData; import net.minecraft.enchantment.EnchantmentHelper; @@ -35,7 +35,7 @@ public class LensDisenchanting extends Lens { public static final int ENERGY_USE = 250000; @Override - public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { + public boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { if (tile.getEnergy() >= ENERGY_USE) { List items = tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1)); if (items != null && !items.isEmpty()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisruption.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisruption.java index d2fe0886f..ee283a9c4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisruption.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisruption.java @@ -10,29 +10,29 @@ package de.ellpeck.actuallyadditions.mod.items.lens; -import java.util.ArrayList; - import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import java.util.ArrayList; + public class LensDisruption extends Lens { private static final int ENERGY_USE = 150000; @Override - public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { + public boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { if (ConfigIntValues.ELEVEN.getValue() == 11 && tile.getEnergy() >= ENERGY_USE && hitBlock != null && !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock)) { int range = 2; ArrayList items = (ArrayList) tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(hitBlock.getX() - range, hitBlock.getY() - range, hitBlock.getZ() - range, hitBlock.getX() + range, hitBlock.getY() + range, hitBlock.getZ() + range)); @@ -53,7 +53,7 @@ public class LensDisruption extends Lens { newStack.setCount(stack.getCount()); if (!newStack.hasTagCompound()) { - newStack.setTagCompound(new NBTTagCompound()); + newStack.setTagCompound(new CompoundNBT()); } newStack.getTagCompound().setBoolean(ActuallyAdditions.MODID + "DisruptedAlready", true); @@ -73,7 +73,7 @@ public class LensDisruption extends Lens { @Override public float[] getColor() { - return new float[] { 246F / 255F, 255F / 255F, 183F / 255F }; + return new float[]{246F / 255F, 255F / 255F, 183F / 255F}; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java index 0adfecc9c..e20cd09f2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.items.lens; -import java.util.List; - import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; @@ -25,18 +23,20 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockNetherrack; import net.minecraft.block.BlockStone; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.WeightedRandom; import net.minecraft.util.math.BlockPos; import net.minecraft.world.WorldServer; import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.oredict.OreDictionary; +import java.util.List; + public class LensMining extends Lens { public static void init() { @@ -122,7 +122,7 @@ public class LensMining extends Lens { } @Override - public boolean invoke(IBlockState hitState, BlockPos hitPos, IAtomicReconstructor tile) { + public boolean invoke(BlockState hitState, BlockPos hitPos, IAtomicReconstructor tile) { if (!tile.getWorldObject().isAirBlock(hitPos)) { if (tile.getEnergy() >= ConfigIntValues.MINING_LENS_USE.getValue()) { int adaptedUse = ConfigIntValues.MINING_LENS_USE.getValue(); @@ -148,7 +148,9 @@ public class LensMining extends Lens { if (stacks != null && !stacks.isEmpty()) { for (ItemStack aStack : stacks) { if (StackUtil.isValid(aStack) && !CrusherRecipeRegistry.hasBlacklistedOutput(aStack, ConfigStringListValues.MINING_LENS_BLACKLIST.getValue()) && aStack.getItem() instanceof ItemBlock) { - if (ConfigBoolValues.MINING_LENS_ADAPTED_USE.isEnabled()) adaptedUse += (totalWeight - ore.itemWeight) % 40000; + if (ConfigBoolValues.MINING_LENS_ADAPTED_USE.isEnabled()) { + adaptedUse += (totalWeight - ore.itemWeight) % 40000; + } stack = aStack; found = true; @@ -162,7 +164,7 @@ public class LensMining extends Lens { if (tile.getEnergy() >= adaptedUse) { Block block = Block.getBlockFromItem(stack.getItem()); if (block != Blocks.AIR) { - IBlockState state = block.getStateForPlacement(tile.getWorldObject(), hitPos, EnumFacing.UP, 0, 0, 0, stack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), EnumHand.MAIN_HAND); + BlockState state = block.getStateForPlacement(tile.getWorldObject(), hitPos, EnumFacing.UP, 0, 0, 0, stack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND); tile.getWorldObject().setBlockState(hitPos, state, 2); tile.getWorldObject().playEvent(2001, hitPos, Block.getStateId(state)); @@ -181,7 +183,7 @@ public class LensMining extends Lens { @Override public float[] getColor() { - return new float[] { 76F / 255F, 76F / 255F, 76F / 255F }; + return new float[]{76F / 255F, 76F / 255F, 76F / 255F}; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java index 14a588fe0..90b4ec7e8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java @@ -10,11 +10,6 @@ package de.ellpeck.actuallyadditions.mod.jei; -import java.util.Collections; -import java.util.List; - -import javax.annotation.Nullable; - import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; @@ -24,6 +19,10 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; +import javax.annotation.Nullable; +import java.util.Collections; +import java.util.List; + public abstract class RecipeWrapperWithButton implements IRecipeWrapper { protected final TexturedButton theButton; @@ -43,7 +42,7 @@ public abstract class RecipeWrapperWithButton implements IRecipeWrapper { IBookletPage page = this.getPage(); if (page != null) { - Minecraft.getMinecraft().displayGuiScreen(BookletUtils.createBookletGuiFromPage(Minecraft.getMinecraft().currentScreen, page)); + Minecraft.getInstance().displayGuiScreen(BookletUtils.createBookletGuiFromPage(Minecraft.getInstance().currentScreen, page)); return true; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java index e3b807e78..3d738be94 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.jei.reconstructor; -import java.util.Arrays; - import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; @@ -25,14 +23,18 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.NBTTagString; +import java.util.Arrays; + public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton { public static final IRecipeWrapperFactory FACTORY = (recipe) -> { - if (recipe instanceof EnchBookConversion) return new EnchBookWrapper((EnchBookConversion) recipe); + if (recipe instanceof EnchBookConversion) { + return new EnchBookWrapper((EnchBookConversion) recipe); + } return new ReconstructorRecipeWrapper(recipe); }; @@ -76,8 +78,8 @@ public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton { static { OUT.setStackDisplayName("Split Book"); - NBTTagCompound t = OUT.getTagCompound().getCompoundTag("display"); - NBTTagList l = new NBTTagList(); + CompoundNBT t = OUT.getTagCompound().getCompoundTag("display"); + ListNBT l = new ListNBT(); l.appendTag(new NBTTagString("Book will be split based on enchantments!")); t.setTag("Lore", l); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/ConnectionPair.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/ConnectionPair.java index fcf47ea26..139c3d42a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/ConnectionPair.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/ConnectionPair.java @@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.misc.apiimpl; import de.ellpeck.actuallyadditions.api.laser.IConnectionPair; import de.ellpeck.actuallyadditions.api.laser.LaserType; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.math.BlockPos; public class ConnectionPair implements IConnectionPair { @@ -33,12 +33,12 @@ public class ConnectionPair implements IConnectionPair { } @Override - public void readFromNBT(NBTTagCompound compound) { + public void readFromNBT(CompoundNBT compound) { if (compound != null) { for (int i = 0; i < this.positions.length; i++) { - int anX = compound.getInteger("x" + i); - int aY = compound.getInteger("y" + i); - int aZ = compound.getInteger("z" + i); + int anX = compound.getInt("x" + i); + int aY = compound.getInt("y" + i); + int aZ = compound.getInt("z" + i); this.positions[i] = new BlockPos(anX, aY, aZ); } this.suppressConnectionRender = compound.getBoolean("SuppressRender"); @@ -68,28 +68,34 @@ public class ConnectionPair implements IConnectionPair { @Override public boolean contains(BlockPos relay) { for (BlockPos position : this.positions) { - if (position != null && position.equals(relay)) { return true; } + if (position != null && position.equals(relay)) { + return true; + } } return false; } @Override public String toString() { - return (this.positions[0] == null ? "-" : this.positions[0].toString()) + " | " + (this.positions[1] == null ? "-" : this.positions[1].toString()); + return (this.positions[0] == null + ? "-" + : this.positions[0].toString()) + " | " + (this.positions[1] == null + ? "-" + : this.positions[1].toString()); } @Override - public void writeToNBT(NBTTagCompound compound) { + public void writeToNBT(CompoundNBT compound) { for (int i = 0; i < this.positions.length; i++) { BlockPos relay = this.positions[i]; - compound.setInteger("x" + i, relay.getX()); - compound.setInteger("y" + i, relay.getY()); - compound.setInteger("z" + i, relay.getZ()); + compound.putInt("x" + i, relay.getX()); + compound.putInt("y" + i, relay.getY()); + compound.putInt("z" + i, relay.getZ()); } if (this.type != null) { - compound.setString("Type", this.type.name()); + compound.putString("Type", this.type.name()); } - compound.setBoolean("SuppressRender", this.suppressConnectionRender); + compound.putBoolean("SuppressRender", this.suppressConnectionRender); } @Override @@ -97,7 +103,9 @@ public class ConnectionPair implements IConnectionPair { if (obj instanceof ConnectionPair) { ConnectionPair pair = (ConnectionPair) obj; for (int i = 0; i < this.positions.length; i++) { - if (this.positions[i] == pair.positions[i] || this.positions[i] != null && this.positions[i].equals(pair.positions[i])) { return true; } + if (this.positions[i] == pair.positions[i] || this.positions[i] != null && this.positions[i].equals(pair.positions[i])) { + return true; + } } } return super.equals(obj); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java index bffff80e7..f73c3f607 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java @@ -17,32 +17,32 @@ import de.ellpeck.actuallyadditions.api.laser.Network; import de.ellpeck.actuallyadditions.mod.data.WorldData; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay; import io.netty.util.internal.ConcurrentSet; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public final class LaserRelayConnectionHandler implements ILaserRelayConnectionHandler { - public static NBTTagCompound writeNetworkToNBT(Network network) { - NBTTagList list = new NBTTagList(); + public static CompoundNBT writeNetworkToNBT(Network network) { + ListNBT list = new ListNBT(); for (IConnectionPair pair : network.connections) { - NBTTagCompound tag = new NBTTagCompound(); + CompoundNBT tag = new CompoundNBT(); pair.writeToNBT(tag); - list.appendTag(tag); + list.add(tag); } - NBTTagCompound compound = new NBTTagCompound(); - compound.setTag("Network", list); + CompoundNBT compound = new CompoundNBT(); + compound.put("Network", list); return compound; } - public static Network readNetworkFromNBT(NBTTagCompound tag) { - NBTTagList list = tag.getTagList("Network", 10); + public static Network readNetworkFromNBT(CompoundNBT tag) { + ListNBT list = tag.getList("Network", 10); Network network = new Network(); - for (int i = 0; i < list.tagCount(); i++) { + for (int i = 0; i < list.size(); i++) { ConnectionPair pair = new ConnectionPair(); - pair.readFromNBT(list.getCompoundTagAt(i)); + pair.readFromNBT(list.getCompound(i)); network.connections.add(pair); } return network; @@ -107,9 +107,13 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH */ @Override public Network getNetworkFor(BlockPos relay, World world) { - if (world != null) for (Network aNetwork : WorldData.get(world).laserRelayNetworks) { - for (IConnectionPair pair : aNetwork.connections) { - if (pair.contains(relay)) { return aNetwork; } + if (world != null) { + for (Network aNetwork : WorldData.get(world).laserRelayNetworks) { + for (IConnectionPair pair : aNetwork.connections) { + if (pair.contains(relay)) { + return aNetwork; + } + } } } return null; @@ -131,7 +135,9 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH @Override public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world, boolean suppressConnectionRender, boolean removeIfConnected) { - if (firstRelay == null || secondRelay == null || firstRelay == secondRelay || firstRelay.equals(secondRelay)) { return false; } + if (firstRelay == null || secondRelay == null || firstRelay == secondRelay || firstRelay.equals(secondRelay)) { + return false; + } WorldData data = WorldData.get(world); Network firstNetwork = this.getNetworkFor(firstRelay, world); @@ -211,4 +217,4 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH return this.getTypeFromLaser(world.getTileEntity(pos)); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java index 8bb3a2e1b..bb490a5fa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java @@ -10,9 +10,6 @@ package de.ellpeck.actuallyadditions.mod.misc.apiimpl; -import java.util.ArrayList; -import java.util.List; - import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; @@ -35,16 +32,16 @@ import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry; import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -52,6 +49,9 @@ import net.minecraft.util.math.Vec3i; import net.minecraft.world.WorldServer; import net.minecraftforge.common.util.FakePlayerFactory; +import java.util.ArrayList; +import java.util.List; + public class MethodHandler implements IMethodHandler { @Override @@ -82,7 +82,9 @@ public class MethodHandler implements IMethodHandler { PotionEffect[] effectsStack = this.getEffectsFromStack(stack); if (effectsStack != null && effectsStack.length > 0) { for (PotionEffect effectStack : effectsStack) { - if (effect.getPotion() == effectStack.getPotion()) { return effectStack; } + if (effect.getPotion() == effectStack.getPotion()) { + return effectStack; + } } } return null; @@ -91,10 +93,16 @@ public class MethodHandler implements IMethodHandler { @Override public void addEffectProperties(ItemStack stack, PotionEffect effect, boolean addDur, boolean addAmp) { PotionEffect[] effects = this.getEffectsFromStack(stack); - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); for (int i = 0; i < effects.length; i++) { if (effects[i].getPotion() == effect.getPotion()) { - effects[i] = new PotionEffect(effects[i].getPotion(), effects[i].getDuration() + (addDur ? effect.getDuration() : 0), effects[i].getAmplifier() + (addAmp ? effect.getAmplifier() > 0 ? effect.getAmplifier() : 1 : 0)); + effects[i] = new PotionEffect(effects[i].getPotion(), effects[i].getDuration() + (addDur + ? effect.getDuration() + : 0), effects[i].getAmplifier() + (addAmp + ? effect.getAmplifier() > 0 + ? effect.getAmplifier() + : 1 + : 0)); } this.addEffectToStack(stack, effects[i]); } @@ -102,13 +110,13 @@ public class MethodHandler implements IMethodHandler { @Override public void addEffectToStack(ItemStack stack, PotionEffect effect) { - NBTTagCompound tag = stack.getTagCompound(); + CompoundNBT tag = stack.getTagCompound(); if (tag == null) { - tag = new NBTTagCompound(); + tag = new CompoundNBT(); } int prevCounter = tag.getInteger("Counter"); - NBTTagCompound compound = new NBTTagCompound(); + CompoundNBT compound = new CompoundNBT(); compound.setInteger("ID", Potion.getIdFromPotion(effect.getPotion())); compound.setInteger("Duration", effect.getDuration()); compound.setInteger("Amplifier", effect.getAmplifier()); @@ -123,21 +131,23 @@ public class MethodHandler implements IMethodHandler { @Override public PotionEffect[] getEffectsFromStack(ItemStack stack) { ArrayList effects = new ArrayList<>(); - NBTTagCompound tag = stack.getTagCompound(); + CompoundNBT tag = stack.getTagCompound(); if (tag != null) { int counter = tag.getInteger("Counter"); while (counter > 0) { - NBTTagCompound compound = (NBTTagCompound) tag.getTag(counter + ""); + CompoundNBT compound = (CompoundNBT) tag.getTag(counter + ""); PotionEffect effect = new PotionEffect(Potion.getPotionById(compound.getInteger("ID")), compound.getInteger("Duration"), compound.getByte("Amplifier")); effects.add(effect); counter--; } } - return effects.size() > 0 ? effects.toArray(new PotionEffect[effects.size()]) : null; + return effects.size() > 0 + ? effects.toArray(new PotionEffect[effects.size()]) + : null; } @Override - public boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { + public boolean invokeConversionLens(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { if (hitBlock != null) { int range = 1; int rangeX = 0; @@ -164,8 +174,10 @@ public class MethodHandler implements IMethodHandler { for (int reachY = -rangeY; reachY <= rangeY; reachY++) { BlockPos pos = new BlockPos(hitBlock.getX() + reachX, hitBlock.getY() + reachY, hitBlock.getZ() + reachZ); if (!tile.getWorldObject().isAirBlock(pos)) { - IBlockState state = tile.getWorldObject().getBlockState(pos); - if (state.getBlock() instanceof BlockLaserRelay) continue; + BlockState state = tile.getWorldObject().getBlockState(pos); + if (state.getBlock() instanceof BlockLaserRelay) { + continue; + } LensConversionRecipe recipe = LensRecipeHandler.findMatchingRecipe(new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state)), tile.getLens()); if (recipe != null && tile.getEnergy() >= recipe.getEnergyUsed()) { ItemStack output = recipe.getOutput(); @@ -174,7 +186,7 @@ public class MethodHandler implements IMethodHandler { recipe.transformHook(ItemStack.EMPTY, state, pos, tile); if (output.getItem() instanceof ItemBlock) { Block toPlace = Block.getBlockFromItem(output.getItem()); - IBlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), EnumHand.MAIN_HAND); + BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND); tile.getWorldObject().setBlockState(pos, state2Place, 2); } else { EntityItem item = new EntityItem(tile.getWorldObject(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output.copy()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/CactusFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/CactusFarmerBehavior.java index 17c5b92be..fa92571ea 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/CactusFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/CactusFarmerBehavior.java @@ -14,10 +14,10 @@ import de.ellpeck.actuallyadditions.api.farmer.FarmerResult; import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; import de.ellpeck.actuallyadditions.api.internal.IFarmer; import net.minecraft.block.Block; -import net.minecraft.block.BlockCactus; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.item.BlockItem; import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; @@ -30,11 +30,11 @@ public class CactusFarmerBehavior implements IFarmerBehavior { int use = 250; if (farmer.getEnergy() >= use) { Item item = seed.getItem(); - if (item instanceof ItemBlock) { + if (item instanceof BlockItem) { Block block = Block.getBlockFromItem(item); - if (block instanceof BlockCactus) { + if (block == Blocks.CACTUS) { if (block.canPlaceBlockAt(world, pos)) { - IBlockState state = block.getDefaultState(); + BlockState state = block.getDefaultState(); world.setBlockState(pos, state, 2); world.playEvent(2001, pos, Block.getStateId(state)); @@ -52,22 +52,22 @@ public class CactusFarmerBehavior implements IFarmerBehavior { public FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer) { int use = 250; if (farmer.getEnergy() >= use) { - IBlockState state = world.getBlockState(pos); - if (state.getBlock() instanceof BlockCactus) { + BlockState state = world.getBlockState(pos); + if (state.getBlock() == Blocks.CACTUS) { FarmerResult result = FarmerResult.STOP_PROCESSING; for (int i = 2; i >= 1; i--) { if (farmer.getEnergy() >= use) { BlockPos up = pos.up(i); - IBlockState upState = world.getBlockState(up); - if (upState.getBlock() instanceof BlockCactus) { + BlockState upState = world.getBlockState(up); + if (upState.getBlock() == Blocks.CACTUS) { NonNullList drops = NonNullList.create(); upState.getBlock().getDrops(drops, world, up, upState, 0); if (!drops.isEmpty()) { if (farmer.canAddToOutput(drops)) { world.playEvent(2001, up, Block.getStateId(upState)); - world.setBlockToAir(up); + world.setBlockState(up, Blocks.AIR.getDefaultState()); farmer.extractEnergy(use); farmer.addToOutput(drops); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java index edad90037..ae68b631d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java @@ -23,8 +23,8 @@ import net.minecraft.block.BlockDirt; import net.minecraft.block.BlockGrass; import net.minecraft.block.BlockStem; import net.minecraft.block.IGrowable; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; @@ -43,7 +43,7 @@ import net.minecraftforge.common.util.FakePlayerFactory; public class DefaultFarmerBehavior implements IFarmerBehavior { - public static boolean defaultPlant(World world, BlockPos pos, IBlockState toPlant, IFarmer farmer, int use) { + public static boolean defaultPlant(World world, BlockPos pos, BlockState toPlant, IFarmer farmer, int use) { if (toPlant != null) { BlockPos farmland = pos.down(); Block farmlandBlock = world.getBlockState(farmland).getBlock(); @@ -62,7 +62,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { return false; } - private static boolean tryPlant(IBlockState toPlant, World world, BlockPos pos) { + private static boolean tryPlant(BlockState toPlant, World world, BlockPos pos) { if (toPlant.getBlock().canPlaceBlockAt(world, pos)) { world.setBlockState(pos, toPlant); return true; @@ -83,7 +83,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { public FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer) { int use = 250; if (farmer.getEnergy() >= use) { - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); Block block = state.getBlock(); if (block instanceof BlockCrops) { @@ -95,7 +95,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { return FarmerResult.FAIL; } - private FarmerResult doFarmerStuff(IBlockState state, World world, BlockPos pos, IFarmer farmer) { + private FarmerResult doFarmerStuff(BlockState state, World world, BlockPos pos, IFarmer farmer) { List seeds = new ArrayList<>(); List other = new ArrayList<>(); NonNullList drops = NonNullList.create(); @@ -135,11 +135,11 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { return 0; } - private IBlockState getPlantablePlantFromStack(ItemStack stack, World world, BlockPos pos) { + private BlockState getPlantablePlantFromStack(ItemStack stack, World world, BlockPos pos) { if (StackUtil.isValid(stack)) { IPlantable plantable = this.getPlantableFromStack(stack); if (plantable != null) { - IBlockState state = plantable.getPlant(world, pos); + BlockState state = plantable.getPlant(world, pos); if (state != null && state.getBlock() instanceof IGrowable) return state; } } @@ -166,7 +166,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { public static EnumActionResult useHoeAt(World world, BlockPos pos) { - EntityPlayer player = FakePlayerFactory.getMinecraft((WorldServer) world); + PlayerEntity player = FakePlayerFactory.getMinecraft((WorldServer) world); ItemStack itemstack = getHoeStack(); @@ -176,7 +176,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(itemstack, player, world, pos); if (hook != 0) return hook > 0 ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; - IBlockState iblockstate = world.getBlockState(pos); + BlockState iblockstate = world.getBlockState(pos); Block block = iblockstate.getBlock(); if (world.isAirBlock(pos.up())) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java index 3c72ef7a9..5d33376b5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java @@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; import de.ellpeck.actuallyadditions.api.internal.IFarmer; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -35,7 +35,7 @@ public class MelonPumpkinFarmerBehavior implements IFarmerBehavior { boolean isPumpkin = seedItem == Items.PUMPKIN_SEEDS; if (isPumpkin || seedItem == Items.MELON_SEEDS) { if (pos.getX() % 2 == 0 == (pos.getZ() % 2 == 0)) { - IBlockState toPlant = (isPumpkin ? Blocks.PUMPKIN_STEM : Blocks.MELON_STEM).getDefaultState(); + BlockState toPlant = (isPumpkin ? Blocks.PUMPKIN_STEM : Blocks.MELON_STEM).getDefaultState(); if (DefaultFarmerBehavior.defaultPlant(world, pos, toPlant, farmer, use)) return FarmerResult.SUCCESS; } return FarmerResult.STOP_PROCESSING; @@ -50,7 +50,7 @@ public class MelonPumpkinFarmerBehavior implements IFarmerBehavior { public FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer) { int use = 500; if (farmer.getEnergy() >= use) { - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); Block block = state.getBlock(); if (block == Blocks.PUMPKIN || block == Blocks.MELON_BLOCK) { NonNullList drops = NonNullList.create(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java index 23fe4e854..40e3bd8f0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java @@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; import de.ellpeck.actuallyadditions.api.internal.IFarmer; import net.minecraft.block.Block; import net.minecraft.block.BlockNetherWart; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -47,7 +47,7 @@ public class NetherWartFarmerBehavior implements IFarmerBehavior { public FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer) { int use = 500; if (farmer.getEnergy() >= use) { - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); if (state.getBlock() instanceof BlockNetherWart) { if (state.getValue(BlockNetherWart.AGE) >= 3) { NonNullList drops = NonNullList.create(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/ReedFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/ReedFarmerBehavior.java index af8ee9d7c..2cfa750e2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/ReedFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/ReedFarmerBehavior.java @@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; import de.ellpeck.actuallyadditions.api.internal.IFarmer; import net.minecraft.block.Block; import net.minecraft.block.BlockReed; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -45,14 +45,14 @@ public class ReedFarmerBehavior implements IFarmerBehavior { public FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer) { int use = 250; if (farmer.getEnergy() >= use) { - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); if (state.getBlock() instanceof BlockReed) { FarmerResult result = FarmerResult.STOP_PROCESSING; for (int i = 2; i >= 1; --i) { if (farmer.getEnergy() >= use) { BlockPos up = pos.up(i); - IBlockState upState = world.getBlockState(up); + BlockState upState = world.getBlockState(up); if (upState.getBlock() instanceof BlockReed) { NonNullList drops = NonNullList.create(); upState.getBlock().getDrops(drops, world, pos, state, 0); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/EnderlillyFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/EnderlillyFarmerBehavior.java index b8e1db5a6..79df91eb6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/EnderlillyFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/EnderlillyFarmerBehavior.java @@ -1,34 +1,34 @@ -/* - * This file ("EnderlillyFarmerBehavior.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2017 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.exu; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockDirt; -import net.minecraft.block.BlockGrass; -import net.minecraft.init.Blocks; - -public class EnderlillyFarmerBehavior extends ExUPlantFarmerBehavior { - - @Override - protected String getPlantName() { - return "extrautils2:enderlilly"; - } - - @Override - protected boolean canPlaceOn(Block block) { - return block == Blocks.END_STONE || block instanceof BlockDirt || block instanceof BlockGrass; - } - - @Override - protected int getMaxStage() { - return 7; - } -} +// FIXME: [port] EXU is not for 1.16 +///* +// * This file ("EnderlillyFarmerBehavior.java") is part of the Actually Additions mod for Minecraft. +// * It is created and owned by Ellpeck and distributed +// * under the Actually Additions License to be found at +// * http://ellpeck.de/actaddlicense +// * View the source code at https://github.com/Ellpeck/ActuallyAdditions +// * +// * © 2015-2017 Ellpeck +// */ +// +//package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.exu; +// +//import net.minecraft.block.Block; +//import net.minecraft.block.Blocks; +//import net.minecraftforge.common.Tags; +// +//public class EnderlillyFarmerBehavior extends ExUPlantFarmerBehavior { +// +// @Override +// protected String getPlantName() { +// return "extrautils2:enderlilly"; +// } +// +// @Override +// protected boolean canPlaceOn(Block block) { +// return block == Blocks.END_STONE || Tags.Blocks.DIRT.contains(block) || Tags.Blocks.GLASS.contains(block); +// } +// +// @Override +// protected int getMaxStage() { +// return 7; +// } +//} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/ExUPlantFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/ExUPlantFarmerBehavior.java index a956657b8..865a93044 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/ExUPlantFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/ExUPlantFarmerBehavior.java @@ -1,120 +1,121 @@ -/* - * This file ("ExUPlantFarmerBehavior.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2017 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.exu; - -import de.ellpeck.actuallyadditions.api.farmer.FarmerResult; -import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; -import de.ellpeck.actuallyadditions.api.internal.IFarmer; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public abstract class ExUPlantFarmerBehavior implements IFarmerBehavior { - - @Override - public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer) { - int use = 600; - if (farmer.getEnergy() >= use) { - if (StackUtil.isValid(seed)) { - Item item = seed.getItem(); - ResourceLocation reg = item.getRegistryName(); - - if (reg != null && this.getPlantName().equals(reg.toString())) { - if (item instanceof ItemBlock) { - Block block = ((ItemBlock) item).getBlock(); - if (block != null) { - IBlockState stateThere = world.getBlockState(pos); - Block blockThere = stateThere.getBlock(); - - if (world.isAirBlock(pos) || blockThere.isReplaceable(world, pos)) { - BlockPos posBelow = pos.down(); - IBlockState stateBelow = world.getBlockState(posBelow); - - if (this.canPlaceOn(stateBelow.getBlock())) { - world.setBlockState(pos, block.getDefaultState(), 2); - farmer.extractEnergy(use); - - return FarmerResult.SUCCESS; - } - } - - return FarmerResult.STOP_PROCESSING; - } - } - } - } - } - return FarmerResult.FAIL; - } - - @Override - public FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer) { - int use = 600; - if (farmer.getEnergy() >= use) { - IBlockState state = world.getBlockState(pos); - Block block = state.getBlock(); - ResourceLocation reg = block.getRegistryName(); - - if (reg != null && this.getPlantName().equals(reg.toString())) { - if (block.getMetaFromState(state) >= this.getMaxStage()) { - NonNullList drops = NonNullList.create(); - block.getDrops(drops, world, pos, state, 0); - if (StackUtil.isEmpty(drops)) return FarmerResult.FAIL; - for (ItemStack stack : drops) { - if (StackUtil.isValid(stack)) { - ResourceLocation itemReg = stack.getItem().getRegistryName(); - if (itemReg != null && this.getPlantName().equals(itemReg.toString())) { - if (stack.getCount() <= 1) { - drops.remove(stack); - break; - } else { - stack.shrink(1); - } - } - } - } - - if (farmer.canAddToOutput(drops)) { - farmer.addToOutput(drops); - - world.playEvent(2001, pos, Block.getStateId(state)); - world.setBlockState(pos, block.getDefaultState(), 2); - - farmer.extractEnergy(use); - - return FarmerResult.SUCCESS; - } - } - - return FarmerResult.STOP_PROCESSING; - } - } - return FarmerResult.FAIL; - } - - @Override - public int getPriority() { - return 10; - } - - protected abstract String getPlantName(); - - protected abstract boolean canPlaceOn(Block block); - - protected abstract int getMaxStage(); -} +// FIXME: [port] EXU is not for 1.16 +///* +// * This file ("ExUPlantFarmerBehavior.java") is part of the Actually Additions mod for Minecraft. +// * It is created and owned by Ellpeck and distributed +// * under the Actually Additions License to be found at +// * http://ellpeck.de/actaddlicense +// * View the source code at https://github.com/Ellpeck/ActuallyAdditions +// * +// * © 2015-2017 Ellpeck +// */ +// +//package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.exu; +// +//import de.ellpeck.actuallyadditions.api.farmer.FarmerResult; +//import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; +//import de.ellpeck.actuallyadditions.api.internal.IFarmer; +//import de.ellpeck.actuallyadditions.mod.util.StackUtil; +//import net.minecraft.block.Block; +//import net.minecraft.block.state.BlockState; +//import net.minecraft.item.Item; +//import net.minecraft.item.ItemBlock; +//import net.minecraft.item.ItemStack; +//import net.minecraft.util.NonNullList; +//import net.minecraft.util.ResourceLocation; +//import net.minecraft.util.math.BlockPos; +//import net.minecraft.world.World; +// +//public abstract class ExUPlantFarmerBehavior implements IFarmerBehavior { +// +// @Override +// public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer) { +// int use = 600; +// if (farmer.getEnergy() >= use) { +// if (StackUtil.isValid(seed)) { +// Item item = seed.getItem(); +// ResourceLocation reg = item.getRegistryName(); +// +// if (reg != null && this.getPlantName().equals(reg.toString())) { +// if (item instanceof ItemBlock) { +// Block block = ((ItemBlock) item).getBlock(); +// if (block != null) { +// BlockState stateThere = world.getBlockState(pos); +// Block blockThere = stateThere.getBlock(); +// +// if (world.isAirBlock(pos) || blockThere.isReplaceable(world, pos)) { +// BlockPos posBelow = pos.down(); +// BlockState stateBelow = world.getBlockState(posBelow); +// +// if (this.canPlaceOn(stateBelow.getBlock())) { +// world.setBlockState(pos, block.getDefaultState(), 2); +// farmer.extractEnergy(use); +// +// return FarmerResult.SUCCESS; +// } +// } +// +// return FarmerResult.STOP_PROCESSING; +// } +// } +// } +// } +// } +// return FarmerResult.FAIL; +// } +// +// @Override +// public FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer) { +// int use = 600; +// if (farmer.getEnergy() >= use) { +// BlockState state = world.getBlockState(pos); +// Block block = state.getBlock(); +// ResourceLocation reg = block.getRegistryName(); +// +// if (reg != null && this.getPlantName().equals(reg.toString())) { +// if (block.getMetaFromState(state) >= this.getMaxStage()) { +// NonNullList drops = NonNullList.create(); +// block.getDrops(drops, world, pos, state, 0); +// if (StackUtil.isEmpty(drops)) return FarmerResult.FAIL; +// for (ItemStack stack : drops) { +// if (StackUtil.isValid(stack)) { +// ResourceLocation itemReg = stack.getItem().getRegistryName(); +// if (itemReg != null && this.getPlantName().equals(itemReg.toString())) { +// if (stack.getCount() <= 1) { +// drops.remove(stack); +// break; +// } else { +// stack.shrink(1); +// } +// } +// } +// } +// +// if (farmer.canAddToOutput(drops)) { +// farmer.addToOutput(drops); +// +// world.playEvent(2001, pos, Block.getStateId(state)); +// world.setBlockState(pos, block.getDefaultState(), 2); +// +// farmer.extractEnergy(use); +// +// return FarmerResult.SUCCESS; +// } +// } +// +// return FarmerResult.STOP_PROCESSING; +// } +// } +// return FarmerResult.FAIL; +// } +// +// @Override +// public int getPriority() { +// return 10; +// } +// +// protected abstract String getPlantName(); +// +// protected abstract boolean canPlaceOn(Block block); +// +// protected abstract int getMaxStage(); +//} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/RedOrchidFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/RedOrchidFarmerBehavior.java index 45556c491..b71581a63 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/RedOrchidFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/exu/RedOrchidFarmerBehavior.java @@ -1,32 +1,33 @@ -/* - * This file ("RedOrchidFarmerBehavior.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2017 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.exu; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockRedstoneOre; - -public class RedOrchidFarmerBehavior extends ExUPlantFarmerBehavior { - - @Override - protected String getPlantName() { - return "extrautils2:redorchid"; - } - - @Override - protected boolean canPlaceOn(Block block) { - return block instanceof BlockRedstoneOre; - } - - @Override - protected int getMaxStage() { - return 6; - } -} +// FIXME: [port] EXU is not for 1.16 +///* +// * This file ("RedOrchidFarmerBehavior.java") is part of the Actually Additions mod for Minecraft. +// * It is created and owned by Ellpeck and distributed +// * under the Actually Additions License to be found at +// * http://ellpeck.de/actaddlicense +// * View the source code at https://github.com/Ellpeck/ActuallyAdditions +// * +// * © 2015-2017 Ellpeck +// */ +// +//package de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.exu; +// +//import net.minecraft.block.Block; +//import net.minecraft.block.BlockRedstoneOre; +// +//public class RedOrchidFarmerBehavior extends ExUPlantFarmerBehavior { +// +// @Override +// protected String getPlantName() { +// return "extrautils2:redorchid"; +// } +// +// @Override +// protected boolean canPlaceOn(Block block) { +// return block instanceof BlockRedstoneOre; +// } +// +// @Override +// protected int getMaxStage() { +// return 6; +// } +//} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java index 1d6907db8..39b3f9cf0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java @@ -14,8 +14,8 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.math.Vec3d; @@ -28,15 +28,19 @@ public class RenderSpecial { this.theThingToRender = stack; } - public void render(EntityPlayer player, float partialTicks) { - if (player.isInvisible() || !player.isWearing(EnumPlayerModelParts.CAPE) || player.isElytraFlying()) { return; } + public void render(PlayerEntity player, float partialTicks) { + if (player.isInvisible() || !player.isWearing(EnumPlayerModelParts.CAPE) || player.isElytraFlying()) { + return; + } GlStateManager.pushMatrix(); - Vec3d currentPos = Minecraft.getMinecraft().player.getPositionEyes(partialTicks); + Vec3d currentPos = Minecraft.getInstance().player.getPositionEyes(partialTicks); Vec3d playerPos = player.getPositionEyes(partialTicks); GlStateManager.translate(playerPos.x - currentPos.x, playerPos.y - currentPos.y, playerPos.z - currentPos.z); - GlStateManager.translate(0D, 2.575D - (player.isSneaking() ? 0.125D : 0D), 0D); + GlStateManager.translate(0D, 2.575D - (player.isSneaking() + ? 0.125D + : 0D), 0D); this.render(); GlStateManager.popMatrix(); @@ -53,7 +57,9 @@ public class RenderSpecial { } GlStateManager.rotate(180F, 1.0F, 0.0F, 1.0F); - float size = isBlock ? 0.5F : 0.4F; + float size = isBlock + ? 0.5F + : 0.4F; GlStateManager.scale(size, size, size); //Make the floaty stuff look nice using sine waves \o/ -xdjackiexd diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/IDataHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/IDataHandler.java index 78aaff5ee..f930d66c0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/IDataHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/IDataHandler.java @@ -10,11 +10,11 @@ package de.ellpeck.actuallyadditions.mod.network; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public interface IDataHandler { - void handleData(NBTTagCompound compound, MessageContext context); + void handleData(CompoundNBT compound, MessageContext context); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java index 04253eec9..5946fda03 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java @@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.network; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import io.netty.buffer.ByteBuf; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; @@ -21,14 +21,14 @@ import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public class PacketClientToServer implements IMessage { - private NBTTagCompound data; + private CompoundNBT data; private IDataHandler handler; public PacketClientToServer() { } - public PacketClientToServer(NBTTagCompound data, IDataHandler handler) { + public PacketClientToServer(CompoundNBT data, IDataHandler handler) { this.data = data; this.handler = handler; } @@ -59,7 +59,7 @@ public class PacketClientToServer implements IMessage { public static class Handler implements IMessageHandler { @Override - public IMessage onMessage(final PacketClientToServer message, final MessageContext ctx) { + public IMessage onMessage(PacketClientToServer message, MessageContext ctx) { FMLCommonHandler.instance().getMinecraftServerInstance().addScheduledTask(() -> { if (message.data != null && message.handler != null) { message.handler.handleData(message.data, ctx); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java index 43afce109..f98863e38 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java @@ -10,9 +10,6 @@ package de.ellpeck.actuallyadditions.mod.network; -import java.util.ArrayList; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.WorldData; @@ -25,10 +22,10 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.Particle; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -36,24 +33,27 @@ import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; +import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; + +import java.util.ArrayList; +import java.util.List; public final class PacketHandler { public static final List DATA_HANDLERS = new ArrayList<>(); public static final IDataHandler LASER_HANDLER = new IDataHandler() { @Override - @SideOnly(Side.CLIENT) - public void handleData(NBTTagCompound compound, MessageContext context) { - AssetUtil.spawnLaserWithTimeClient(compound.getDouble("StartX"), compound.getDouble("StartY"), compound.getDouble("StartZ"), compound.getDouble("EndX"), compound.getDouble("EndY"), compound.getDouble("EndZ"), new float[] { compound.getFloat("Color1"), compound.getFloat("Color2"), compound.getFloat("Color3") }, compound.getInteger("MaxAge"), compound.getDouble("RotationTime"), compound.getFloat("Size"), compound.getFloat("Alpha")); + @OnlyIn(Dist.CLIENT) + public void handleData(CompoundNBT compound, MessageContext context) { + AssetUtil.spawnLaserWithTimeClient(compound.getDouble("StartX"), compound.getDouble("StartY"), compound.getDouble("StartZ"), compound.getDouble("EndX"), compound.getDouble("EndY"), compound.getDouble("EndZ"), new float[]{compound.getFloat("Color1"), compound.getFloat("Color2"), compound.getFloat("Color3")}, compound.getInteger("MaxAge"), compound.getDouble("RotationTime"), compound.getFloat("Size"), compound.getFloat("Alpha")); } }; public static final IDataHandler TILE_ENTITY_HANDLER = new IDataHandler() { @Override - @SideOnly(Side.CLIENT) - public void handleData(NBTTagCompound compound, MessageContext context) { - World world = Minecraft.getMinecraft().world; + @OnlyIn(Dist.CLIENT) + public void handleData(CompoundNBT compound, MessageContext context) { + World world = Minecraft.getInstance().world; if (world != null) { TileEntity tile = world.getTileEntity(new BlockPos(compound.getInteger("X"), compound.getInteger("Y"), compound.getInteger("Z"))); if (tile instanceof TileEntityBase) { @@ -64,9 +64,9 @@ public final class PacketHandler { }; public static final IDataHandler LASER_PARTICLE_HANDLER = new IDataHandler() { @Override - @SideOnly(Side.CLIENT) - public void handleData(NBTTagCompound compound, MessageContext context) { - Minecraft mc = Minecraft.getMinecraft(); + @OnlyIn(Dist.CLIENT) + public void handleData(CompoundNBT compound, MessageContext context) { + Minecraft mc = Minecraft.getInstance(); ItemStack stack = new ItemStack(compound); double inX = compound.getDouble("InX") + 0.5; @@ -88,18 +88,18 @@ public final class PacketHandler { if (tile instanceof IButtonReactor) { IButtonReactor reactor = (IButtonReactor) tile; Entity entity = world.getEntityByID(compound.getInteger("PlayerID")); - if (entity instanceof EntityPlayer) { - reactor.onButtonPressed(compound.getInteger("ButtonID"), (EntityPlayer) entity); + if (entity instanceof PlayerEntity) { + reactor.onButtonPressed(compound.getInteger("ButtonID"), (PlayerEntity) entity); } } }; public static final IDataHandler GUI_BUTTON_TO_CONTAINER_HANDLER = (compound, context) -> { World world = DimensionManager.getWorld(compound.getInteger("WorldID")); Entity entity = world.getEntityByID(compound.getInteger("PlayerID")); - if (entity instanceof EntityPlayer) { - Container container = ((EntityPlayer) entity).openContainer; + if (entity instanceof PlayerEntity) { + Container container = ((PlayerEntity) entity).openContainer; if (container instanceof IButtonReactor) { - ((IButtonReactor) container).onButtonPressed(compound.getInteger("ButtonID"), (EntityPlayer) entity); + ((IButtonReactor) container).onButtonPressed(compound.getInteger("ButtonID"), (PlayerEntity) entity); } } }; @@ -109,7 +109,7 @@ public final class PacketHandler { if (tile instanceof INumberReactor) { INumberReactor reactor = (INumberReactor) tile; - reactor.onNumberReceived(compound.getDouble("Number"), compound.getInteger("NumberID"), (EntityPlayer) world.getEntityByID(compound.getInteger("PlayerID"))); + reactor.onNumberReceived(compound.getDouble("Number"), compound.getInteger("NumberID"), (PlayerEntity) world.getEntityByID(compound.getInteger("PlayerID"))); } }; public static final IDataHandler GUI_STRING_TO_TILE_HANDLER = (compound, context) -> { @@ -118,15 +118,15 @@ public final class PacketHandler { if (tile instanceof IStringReactor) { IStringReactor reactor = (IStringReactor) tile; - reactor.onTextReceived(compound.getString("Text"), compound.getInteger("TextID"), (EntityPlayer) world.getEntityByID(compound.getInteger("PlayerID"))); + reactor.onTextReceived(compound.getString("Text"), compound.getInteger("TextID"), (PlayerEntity) world.getEntityByID(compound.getInteger("PlayerID"))); } }; public static final IDataHandler SYNC_PLAYER_DATA = new IDataHandler() { @Override - @SideOnly(Side.CLIENT) - public void handleData(NBTTagCompound compound, MessageContext context) { - NBTTagCompound dataTag = compound.getCompoundTag("Data"); - EntityPlayer player = ActuallyAdditions.PROXY.getCurrentPlayer(); + @OnlyIn(Dist.CLIENT) + public void handleData(CompoundNBT compound, MessageContext context) { + CompoundNBT dataTag = compound.getCompoundTag("Data"); + PlayerEntity player = ActuallyAdditions.PROXY.getCurrentPlayer(); if (player != null) { PlayerData.getDataFromPlayer(player).readFromNBT(dataTag, false); @@ -141,17 +141,17 @@ public final class PacketHandler { }; public static final IDataHandler PLAYER_DATA_TO_SERVER = (compound, context) -> { World world = DimensionManager.getWorld(compound.getInteger("World")); - EntityPlayer player = world.getPlayerEntityByUUID(compound.getUniqueId("UUID")); + PlayerEntity player = world.getPlayerEntityByUUID(compound.getUniqueId("UUID")); if (player != null) { PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); int type = compound.getInteger("Type"); if (type == 0) { - data.loadBookmarks(compound.getTagList("Bookmarks", 8)); + data.loadBookmarks(compound.getList("Bookmarks", 8)); } else if (type == 1) { data.didBookTutorial = compound.getBoolean("DidBookTutorial"); } else if (type == 2) { - data.loadTrials(compound.getTagList("Trials", 8)); + data.loadTrials(compound.getList("Trials", 8)); if (compound.getBoolean("Achievement")) { //TheAchievements.COMPLETE_TRIALS.get(player); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandlerHelper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandlerHelper.java index 294b5a8c4..f72d144dd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandlerHelper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandlerHelper.java @@ -16,49 +16,48 @@ import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterTrials; import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public final class PacketHandlerHelper { - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void sendButtonPacket(TileEntity tile, int buttonId) { - NBTTagCompound compound = new NBTTagCompound(); + CompoundNBT compound = new CompoundNBT(); BlockPos pos = tile.getPos(); compound.setInteger("X", pos.getX()); compound.setInteger("Y", pos.getY()); compound.setInteger("Z", pos.getZ()); compound.setInteger("WorldID", tile.getWorld().provider.getDimension()); - compound.setInteger("PlayerID", Minecraft.getMinecraft().player.getEntityId()); + compound.setInteger("PlayerID", Minecraft.getInstance().player.getEntityId()); compound.setInteger("ButtonID", buttonId); PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER)); } - public static void syncPlayerData(EntityPlayer player, boolean log) { - NBTTagCompound compound = new NBTTagCompound(); + public static void syncPlayerData(PlayerEntity player, boolean log) { + CompoundNBT compound = new CompoundNBT(); compound.setBoolean("Log", log); - NBTTagCompound data = new NBTTagCompound(); + CompoundNBT data = new CompoundNBT(); PlayerData.getDataFromPlayer(player).writeToNBT(data, false); compound.setTag("Data", data); - if (player instanceof EntityPlayerMP) { - PacketHandler.theNetwork.sendTo(new PacketServerToClient(compound, PacketHandler.SYNC_PLAYER_DATA), (EntityPlayerMP) player); + if (player instanceof ServerPlayerEntity) { + PacketHandler.theNetwork.sendTo(new PacketServerToClient(compound, PacketHandler.SYNC_PLAYER_DATA), (ServerPlayerEntity) player); } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void sendPlayerDataToServer(boolean log, int type) { - NBTTagCompound compound = new NBTTagCompound(); + CompoundNBT compound = new CompoundNBT(); compound.setBoolean("Log", log); compound.setInteger("Type", type); - EntityPlayer player = Minecraft.getMinecraft().player; + PlayerEntity player = Minecraft.getInstance().player; if (player != null) { compound.setInteger("World", player.world.provider.getDimension()); compound.setUniqueId("UUID", player.getUniqueID()); @@ -88,14 +87,14 @@ public final class PacketHandlerHelper { } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void sendNumberPacket(TileEntity tile, double number, int id) { - NBTTagCompound compound = new NBTTagCompound(); + CompoundNBT compound = new CompoundNBT(); compound.setInteger("X", tile.getPos().getX()); compound.setInteger("Y", tile.getPos().getY()); compound.setInteger("Z", tile.getPos().getZ()); compound.setInteger("WorldID", tile.getWorld().provider.getDimension()); - compound.setInteger("PlayerID", Minecraft.getMinecraft().player.getEntityId()); + compound.setInteger("PlayerID", Minecraft.getInstance().player.getEntityId()); compound.setInteger("NumberID", id); compound.setDouble("Number", number); PacketHandler.theNetwork.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_NUMBER_TO_TILE_HANDLER)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java index 53896b25f..bfde3981c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java @@ -13,24 +13,23 @@ package de.ellpeck.actuallyadditions.mod.network; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class PacketServerToClient implements IMessage { - private NBTTagCompound data; + private CompoundNBT data; private IDataHandler handler; public PacketServerToClient() { } - public PacketServerToClient(NBTTagCompound data, IDataHandler handler) { + public PacketServerToClient(CompoundNBT data, IDataHandler handler) { this.data = data; this.handler = handler; } @@ -61,9 +60,9 @@ public class PacketServerToClient implements IMessage { public static class Handler implements IMessageHandler { @Override - @SideOnly(Side.CLIENT) - public IMessage onMessage(final PacketServerToClient message, final MessageContext ctx) { - Minecraft.getMinecraft().addScheduledTask(() -> { + @OnlyIn(Dist.CLIENT) + public IMessage onMessage(PacketServerToClient message, MessageContext ctx) { + Minecraft.getInstance().addScheduledTask(() -> { if (message.data != null && message.handler != null) { message.handler.handleData(message.data, ctx); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IButtonReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IButtonReactor.java index 594504b6f..8cd749605 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IButtonReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IButtonReactor.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.network.gui; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; public interface IButtonReactor { @@ -21,5 +21,5 @@ public interface IButtonReactor { * @param buttonID The button's ID * @param player The Player pressing it */ - void onButtonPressed(int buttonID, EntityPlayer player); + void onButtonPressed(int buttonID, PlayerEntity player); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/INumberReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/INumberReactor.java index 78f05a36d..fe2d14d1f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/INumberReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/INumberReactor.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.network.gui; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; public interface INumberReactor { @@ -21,5 +21,5 @@ public interface INumberReactor { * @param id The ID (meaning the place in the GUI) of the number typed in * @param player The Player doing it */ - void onNumberReceived(double number, int id, EntityPlayer player); + void onNumberReceived(double number, int id, PlayerEntity player); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IStringReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IStringReactor.java index a86347a9e..6300ec13d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IStringReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/IStringReactor.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.network.gui; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; public interface IStringReactor { @@ -21,5 +21,5 @@ public interface IStringReactor { * @param textID The ID (meaning the place in the GUI) of the text typed in * @param player The Player doing it */ - void onTextReceived(String text, int textID, EntityPlayer player); + void onTextReceived(String text, int textID, PlayerEntity player); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java index 450d850a9..a1fa6195b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java @@ -16,9 +16,9 @@ import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.entity.Entity; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class ParticleBeam extends Particle { private final double endX; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java index f6e9cde1b..b78020c1c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java @@ -10,9 +10,6 @@ package de.ellpeck.actuallyadditions.mod.particle; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.Particle; @@ -23,10 +20,11 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL14; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class ParticleLaserItem extends Particle { private final double otherX; @@ -60,7 +58,7 @@ public class ParticleLaserItem extends Particle { if (this.otherX != 0 || this.otherY != 0 || this.otherZ != 0) { Particle fx = new ParticleLaserItem(this.world, this.otherX, this.otherY, this.otherZ, this.stack, -0.025); - Minecraft.getMinecraft().effectRenderer.addEffect(fx); + Minecraft.getInstance().effectRenderer.addEffect(fx); } } @@ -79,7 +77,9 @@ public class ParticleLaserItem extends Particle { GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_CONSTANT_COLOR, GlStateManager.SourceFactor.ONE.factor, GlStateManager.DestFactor.ZERO.factor); float ageRatio = (float) this.particleAge / (float) this.particleMaxAge; - float color = this.motionY < 0 ? 1F - ageRatio : ageRatio; + float color = this.motionY < 0 + ? 1F - ageRatio + : ageRatio; GL14.glBlendColor(color, color, color, color); AssetUtil.renderItemWithoutScrewingWithColors(this.stack); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java index 10414c6a4..f25167f03 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java @@ -10,45 +10,25 @@ package de.ellpeck.actuallyadditions.mod.proxy; -import java.util.ArrayList; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ClientRegistryHandler; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; -import de.ellpeck.actuallyadditions.mod.blocks.render.RenderBatteryBox; -import de.ellpeck.actuallyadditions.mod.blocks.render.RenderDisplayStand; -import de.ellpeck.actuallyadditions.mod.blocks.render.RenderEmpowerer; -import de.ellpeck.actuallyadditions.mod.blocks.render.RenderLaserRelay; -import de.ellpeck.actuallyadditions.mod.blocks.render.RenderReconstructorLens; -import de.ellpeck.actuallyadditions.mod.blocks.render.RenderSmileyCloud; +import de.ellpeck.actuallyadditions.mod.blocks.render.*; import de.ellpeck.actuallyadditions.mod.entity.InitEntities; import de.ellpeck.actuallyadditions.mod.entity.RenderWorm; import de.ellpeck.actuallyadditions.mod.event.ClientEvents; import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityDisplayStand; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityEmpowerer; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyAdvanced; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyExtreme; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayFluids; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItem; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist; -import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud; +import de.ellpeck.actuallyadditions.mod.tile.*; import de.ellpeck.actuallyadditions.mod.util.IColorProvidingBlock; import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.network.play.client.CPacketPlayerDigging; @@ -61,6 +41,9 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import java.util.ArrayList; +import java.util.List; + public class ClientProxy implements IProxy { private static final List COLOR_PRODIVIDING_ITEMS_FOR_REGISTERING = new ArrayList<>(); @@ -100,16 +83,16 @@ public class ClientProxy implements IProxy { for (Item item : COLOR_PRODIVIDING_ITEMS_FOR_REGISTERING) { if (item instanceof IColorProvidingItem) { - Minecraft.getMinecraft().getItemColors().registerItemColorHandler(((IColorProvidingItem) item).getItemColor(), item); + Minecraft.getInstance().getItemColors().registerItemColorHandler(((IColorProvidingItem) item).getItemColor(), item); } } for (Block block : COLOR_PRODIVIDING_BLOCKS_FOR_REGISTERING) { if (block instanceof IColorProvidingBlock) { - Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(((IColorProvidingBlock) block).getBlockColor(), block); + Minecraft.getInstance().getBlockColors().registerBlockColorHandler(((IColorProvidingBlock) block).getBlockColor(), block); } if (block instanceof IColorProvidingItem) { - Minecraft.getMinecraft().getItemColors().registerItemColorHandler(((IColorProvidingItem) block).getItemColor(), block); + Minecraft.getInstance().getItemColors().registerItemColorHandler(((IColorProvidingItem) block).getItemColor(), block); } } @@ -117,13 +100,13 @@ public class ClientProxy implements IProxy { if (world != null && pos != null) { TileEntity tileentity = world.getTileEntity(pos); if (tileentity instanceof TileEntityCompost && ((TileEntityCompost) tileentity).getCurrentDisplay().getBlock() != state.getBlock()) { - IBlockState iblockstate = ((TileEntityCompost) tileentity).getCurrentDisplay(); - return Minecraft.getMinecraft().getBlockColors().colorMultiplier(iblockstate, world, pos, tint); + BlockState iblockstate = ((TileEntityCompost) tileentity).getCurrentDisplay(); + return Minecraft.getInstance().getBlockColors().colorMultiplier(iblockstate, world, pos, tint); } } return -1; }; - Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(color, InitBlocks.blockCompost); + Minecraft.getInstance().getBlockColors().registerBlockColorHandler(color, InitBlocks.blockCompost); } @Override @@ -149,14 +132,14 @@ public class ClientProxy implements IProxy { } @Override - public EntityPlayer getCurrentPlayer() { - return Minecraft.getMinecraft().player; + public PlayerEntity getCurrentPlayer() { + return Minecraft.getInstance().player; } @Override public void sendBreakPacket(BlockPos pos) { - NetHandlerPlayClient netHandlerPlayClient = Minecraft.getMinecraft().getConnection(); + NetHandlerPlayClient netHandlerPlayClient = Minecraft.getInstance().getConnection(); assert netHandlerPlayClient != null; - netHandlerPlayClient.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK, pos, Minecraft.getMinecraft().objectMouseOver.sideHit)); + netHandlerPlayClient.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK, pos, Minecraft.getInstance().objectMouseOver.sideHit)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/IProxy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/IProxy.java index be9f5f760..557777f38 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/IProxy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/IProxy.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.proxy; import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -34,7 +34,7 @@ public interface IProxy { void addColoredBlock(Block block); - EntityPlayer getCurrentPlayer(); + PlayerEntity getCurrentPlayer(); default void sendBreakPacket(BlockPos pos) { }; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ServerProxy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ServerProxy.java index ff61b6efa..24f55c01e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ServerProxy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ServerProxy.java @@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.proxy; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -53,7 +53,7 @@ public class ServerProxy implements IProxy { } @Override - public EntityPlayer getCurrentPlayer() { + public PlayerEntity getCurrentPlayer() { return null; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/ColorLensRotator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/ColorLensRotator.java index 11392da16..93e9ad800 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/ColorLensRotator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/ColorLensRotator.java @@ -6,7 +6,7 @@ import java.util.Map; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; @@ -28,7 +28,7 @@ public class ColorLensRotator implements IColorLensChanger { } @Override - public ItemStack modifyItem(ItemStack stack, IBlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) { + public ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) { int idx = -1; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EnchBookConversion.java b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EnchBookConversion.java index 7052a3fa5..f0d5c799b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EnchBookConversion.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EnchBookConversion.java @@ -8,7 +8,7 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.init.Items; @@ -23,7 +23,7 @@ public class EnchBookConversion extends LensConversionRecipe { } @Override - public void transformHook(ItemStack stack, IBlockState state, BlockPos pos, IAtomicReconstructor tile) { + public void transformHook(ItemStack stack, BlockState state, BlockPos pos, IAtomicReconstructor tile) { for (Map.Entry e : EnchantmentHelper.getEnchantments(stack).entrySet()) { ItemStack book = new ItemStack(Items.ENCHANTED_BOOK); Map ench = ImmutableMap.of(e.getKey(), e.getValue()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java index f564c0cc0..33546a6ac 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.tile; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.energy.EnergyStorage; public class CustomEnergyStorage extends EnergyStorage { @@ -45,7 +45,9 @@ public class CustomEnergyStorage extends EnergyStorage { @Override public int receiveEnergy(int maxReceive, boolean simulate) { - if (!this.canReceive()) { return 0; } + if (!this.canReceive()) { + return 0; + } int energy = this.getEnergyStored(); int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, maxReceive)); @@ -58,7 +60,9 @@ public class CustomEnergyStorage extends EnergyStorage { @Override public int extractEnergy(int maxExtract, boolean simulate) { - if (!this.canExtract()) { return 0; } + if (!this.canExtract()) { + return 0; + } int energy = this.getEnergyStored(); int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); @@ -68,11 +72,11 @@ public class CustomEnergyStorage extends EnergyStorage { return energyExtracted; } - public void readFromNBT(NBTTagCompound compound) { + public void readFromNBT(CompoundNBT compound) { this.setEnergyStored(compound.getInteger("Energy")); } - public void writeToNBT(NBTTagCompound compound) { + public void writeToNBT(CompoundNBT compound) { compound.setInteger("Energy", this.getEnergyStored()); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java index 937193ab3..d02d6c84e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.tile; -import org.apache.commons.lang3.ArrayUtils; - import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; import de.ellpeck.actuallyadditions.mod.items.ItemDrill; @@ -19,8 +17,9 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.oredict.OreDictionary; +import org.apache.commons.lang3.ArrayUtils; public class FilterSettings { @@ -68,9 +67,13 @@ public class FilterSettings { ItemDrill.loadSlotsFromNBT(inv, slot); for (int k = 0; k < inv.getSlots(); k++) { ItemStack filterSlot = inv.getStackInSlot(k); - if (StackUtil.isValid(filterSlot) && areEqualEnough(filterSlot, stack, meta, nbt, mod, oredict)) { return whitelist; } + if (StackUtil.isValid(filterSlot) && areEqualEnough(filterSlot, stack, meta, nbt, mod, oredict)) { + return whitelist; + } } - } else if (areEqualEnough(slot, stack, meta, nbt, mod, oredict)) { return whitelist; } + } else if (areEqualEnough(slot, stack, meta, nbt, mod, oredict)) { + return whitelist; + } } } } @@ -80,7 +83,9 @@ public class FilterSettings { private static boolean areEqualEnough(ItemStack first, ItemStack second, boolean meta, boolean nbt, boolean mod, int oredict) { Item firstItem = first.getItem(); Item secondItem = second.getItem(); - if (mod && firstItem.getRegistryName().getNamespace().equals(secondItem.getRegistryName().getNamespace())) return true; + if (mod && firstItem.getRegistryName().getNamespace().equals(secondItem.getRegistryName().getNamespace())) { + return true; + } if (oredict != 0) { int[] firstIds = OreDictionary.getOreIDs(first); @@ -99,10 +104,14 @@ public class FilterSettings { for (int id : firstIds) { if (ArrayUtils.contains(secondIds, id)) { //Needs to match only one id, so return true on first match - if (oredict == 1) { return true; } + if (oredict == 1) { + return true; + } } //Needs to match every id, so just return false when no match - else if (oredict == 2) { return false; } + else if (oredict == 2) { + return false; + } } //If oredict mode 1, this will fail because nothing matched @@ -111,16 +120,20 @@ public class FilterSettings { } } - if (firstItem != secondItem) return false; + if (firstItem != secondItem) { + return false; + } boolean metaFine = !meta || first.getItemDamage() == second.getItemDamage(); boolean nbtFine = !nbt || ItemStack.areItemStackTagsEqual(first, second); - if (metaFine && nbtFine) return true; + if (metaFine && nbtFine) { + return true; + } return false; } - public void writeToNBT(NBTTagCompound tag, String name) { - NBTTagCompound compound = new NBTTagCompound(); + public void writeToNBT(CompoundNBT tag, String name) { + CompoundNBT compound = new CompoundNBT(); compound.setBoolean("Whitelist", this.isWhitelist); compound.setBoolean("Meta", this.respectMeta); compound.setBoolean("NBT", this.respectNBT); @@ -130,8 +143,8 @@ public class FilterSettings { tag.setTag(name, compound); } - public void readFromNBT(NBTTagCompound tag, String name) { - NBTTagCompound compound = tag.getCompoundTag(name); + public void readFromNBT(CompoundNBT tag, String name) { + CompoundNBT compound = tag.getCompoundTag(name); this.isWhitelist = compound.getBoolean("Whitelist"); this.respectMeta = compound.getBoolean("Meta"); this.respectNBT = compound.getBoolean("NBT"); @@ -182,7 +195,9 @@ public class FilterSettings { public boolean needsCheck() { for (int i = 0; i < this.filterInventory.getSlots(); i++) { - if (StackUtil.isValid(this.filterInventory.getStackInSlot(i))) { return true; } + if (StackUtil.isValid(this.filterInventory.getStackInSlot(i))) { + return true; + } } return this.isWhitelist; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/IEnergyDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/IEnergyDisplay.java index d601a039e..3c05fed92 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/IEnergyDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/IEnergyDisplay.java @@ -11,13 +11,13 @@ package de.ellpeck.actuallyadditions.mod.tile; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public interface IEnergyDisplay { - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) CustomEnergyStorage getEnergyStorage(); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) boolean needsHoldShift(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java index a55a04711..968ff507b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java @@ -21,9 +21,9 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.Item; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; @@ -52,7 +52,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.setInteger("CurrentTime", this.currentTime); @@ -67,7 +67,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.currentTime = compound.getInteger("CurrentTime"); @@ -102,13 +102,17 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple @Override public Lens getLens() { Item item = this.inv.getStackInSlot(0).getItem(); - if (item instanceof ILensItem) return ((ILensItem) item).getLens(); - return this.counter >= 500 ? ActuallyAdditionsAPI.lensDisruption : ActuallyAdditionsAPI.lensDefaultConversion; + if (item instanceof ILensItem) { + return ((ILensItem) item).getLens(); + } + return this.counter >= 500 + ? ActuallyAdditionsAPI.lensDisruption + : ActuallyAdditionsAPI.lensDefaultConversion; } @Override public EnumFacing getOrientation() { - IBlockState state = this.world.getBlockState(this.pos); + BlockState state = this.world.getBlockState(this.pos); return WorldUtil.getDirectionByPistonRotation(state); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java index 0ac6cb8cb..15dfd870d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -14,9 +14,9 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.util.VanillaPacketDispatcher; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; @@ -123,19 +123,19 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { } @Override - public final NBTTagCompound writeToNBT(NBTTagCompound compound) { + public final CompoundNBT writeToNBT(CompoundNBT compound) { this.writeSyncableNBT(compound, NBTType.SAVE_TILE); return compound; } @Override - public final void readFromNBT(NBTTagCompound compound) { + public final void readFromNBT(CompoundNBT compound) { this.readSyncableNBT(compound, NBTType.SAVE_TILE); } @Override public final SPacketUpdateTileEntity getUpdatePacket() { - NBTTagCompound compound = new NBTTagCompound(); + CompoundNBT compound = new CompoundNBT(); this.writeSyncableNBT(compound, NBTType.SYNC); return new SPacketUpdateTileEntity(this.pos, -1, compound); } @@ -146,25 +146,27 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { } @Override - public final NBTTagCompound getUpdateTag() { - NBTTagCompound compound = new NBTTagCompound(); + public final CompoundNBT getUpdateTag() { + CompoundNBT compound = new CompoundNBT(); this.writeSyncableNBT(compound, NBTType.SYNC); return compound; } @Override - public final void handleUpdateTag(NBTTagCompound compound) { + public final void handleUpdateTag(CompoundNBT compound) { this.readSyncableNBT(compound, NBTType.SYNC); } public final void sendUpdate() { - if (this.world != null && !this.world.isRemote) VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this); + if (this.world != null && !this.world.isRemote) { + VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this); + } /* if(this.world != null && !this.world.isRemote){ - NBTTagCompound compound = new NBTTagCompound(); + CompoundNBT compound = new CompoundNBT(); this.writeSyncableNBT(compound, NBTType.SYNC); - NBTTagCompound data = new NBTTagCompound(); + CompoundNBT data = new CompoundNBT(); data.setTag("Data", compound); data.setInteger("X", this.pos.getX()); data.setInteger("Y", this.pos.getY()); @@ -173,28 +175,36 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { }*/ } - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { - if (type != NBTType.SAVE_BLOCK) super.writeToNBT(compound); + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { + if (type != NBTType.SAVE_BLOCK) { + super.writeToNBT(compound); + } if (type == NBTType.SAVE_TILE) { compound.setBoolean("Redstone", this.isRedstonePowered); compound.setInteger("TicksElapsed", this.ticksElapsed); compound.setBoolean("StopDrop", this.stopFromDropping); - } else if (type == NBTType.SYNC && this.stopFromDropping) compound.setBoolean("StopDrop", this.stopFromDropping); + } else if (type == NBTType.SYNC && this.stopFromDropping) { + compound.setBoolean("StopDrop", this.stopFromDropping); + } if (this.isRedstoneToggle() && (type != NBTType.SAVE_BLOCK || this.isPulseMode)) { compound.setBoolean("IsPulseMode", this.isPulseMode); } } - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { - if (type != NBTType.SAVE_BLOCK) super.readFromNBT(compound); + public void readSyncableNBT(CompoundNBT compound, NBTType type) { + if (type != NBTType.SAVE_BLOCK) { + super.readFromNBT(compound); + } if (type == NBTType.SAVE_TILE) { this.isRedstonePowered = compound.getBoolean("Redstone"); this.ticksElapsed = compound.getInteger("TicksElapsed"); this.stopFromDropping = compound.getBoolean("StopDrop"); - } else if (type == NBTType.SYNC) this.stopFromDropping = compound.getBoolean("StopDrop"); + } else if (type == NBTType.SYNC) { + this.stopFromDropping = compound.getBoolean("StopDrop"); + } if (this.isRedstoneToggle()) { this.isPulseMode = compound.getBoolean("IsPulseMode"); @@ -202,7 +212,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { } @Override - public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) { + public boolean shouldRefresh(World world, BlockPos pos, BlockState oldState, BlockState newState) { return !oldState.getBlock().isAssociatedBlock(newState.getBlock()); } @@ -303,7 +313,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { this.markDirty(); } - public boolean canPlayerUse(EntityPlayer player) { + public boolean canPlayerUse(PlayerEntity player) { return player.getDistanceSq(this.getPos().getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64 && !this.isInvalid() && this.world.getTileEntity(this.pos) == this; } @@ -326,13 +336,19 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { public T getCapability(Capability capability, EnumFacing facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { IItemHandler handler = this.getItemHandler(facing); - if (handler != null) { return (T) handler; } + if (handler != null) { + return (T) handler; + } } else if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { IFluidHandler tank = this.getFluidHandler(facing); - if (tank != null) { return (T) tank; } + if (tank != null) { + return (T) tank; + } } else if (capability == CapabilityEnergy.ENERGY) { IEnergyStorage storage = this.getEnergyStorage(facing); - if (storage != null) { return (T) storage; } + if (storage != null) { + return (T) storage; + } } return super.getCapability(capability, facing); } @@ -375,4 +391,4 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { */ SAVE_BLOCK } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java index 4a35e7fe7..0f17cfb9e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java @@ -10,9 +10,6 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.ArrayList; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; @@ -22,12 +19,15 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.IPlantable; import net.minecraftforge.energy.IEnergyStorage; +import java.util.ArrayList; +import java.util.List; + public class TileEntityBioReactor extends TileEntityInventoryBase implements ISharingEnergyProvider { public final CustomEnergyStorage storage = new CustomEnergyStorage(200000, 0, 800); @@ -48,7 +48,9 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements ISh Item item = stack.getItem(); if (isValid(item)) { return true; - } else if (item instanceof ItemBlock) { return isValid(Block.getBlockFromItem(item)); } + } else if (item instanceof ItemBlock) { + return isValid(Block.getBlockFromItem(item)); + } } return false; } @@ -106,7 +108,7 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements ISh } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); @@ -116,7 +118,7 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements ISh } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java index 3b381b2a6..2ec53e093 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java @@ -15,10 +15,10 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; @@ -39,7 +39,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase { } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.setInteger("CurrentTime", this.currentTime); @@ -47,7 +47,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase { } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.currentTime = compound.getInteger("CurrentTime"); @@ -79,7 +79,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase { private void doWork() { EnumFacing side = WorldUtil.getDirectionByPistonRotation(this.world.getBlockState(this.pos)); BlockPos breakCoords = this.pos.offset(side); - IBlockState stateToBreak = this.world.getBlockState(breakCoords); + BlockState stateToBreak = this.world.getBlockState(breakCoords); Block blockToBreak = stateToBreak.getBlock(); if (!this.isPlacer && blockToBreak != Blocks.AIR && !(blockToBreak instanceof BlockLiquid) && !(blockToBreak instanceof IFluidBlock) && stateToBreak.getBlockHardness(this.world, breakCoords) >= 0.0F) { @@ -96,7 +96,9 @@ public class TileEntityBreaker extends TileEntityInventoryBase { } } else if (this.isPlacer) { int slot = StackUtil.findFirstFilled(this.inv); - if (slot == -1) return; + if (slot == -1) { + return; + } this.inv.setStackInSlot(slot, WorldUtil.useItemAtSide(side, this.world, this.pos, this.inv.getStackInSlot(slot))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java index ec9a1839f..395229c67 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java @@ -18,13 +18,12 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class TileEntityCanolaPress extends TileEntityInventoryBase implements ISharingFluidHandler { @@ -47,23 +46,23 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IS super(1, "canolaPress"); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getTankScaled(int i) { return this.tank.getFluidAmount() * i / this.tank.getCapacity(); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getProcessScaled(int i) { return this.currentProcessTime * i / TIME; } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getEnergyScaled(int i) { return this.storage.getEnergyStored() * i / this.storage.getMaxEnergyStored(); } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { compound.setInteger("ProcessTime", this.currentProcessTime); } @@ -73,7 +72,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IS } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { this.currentProcessTime = compound.getInteger("ProcessTime"); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java index be4707f9f..7ddaa3590 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java @@ -15,13 +15,12 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.EnumFacing; import net.minecraftforge.energy.IEnergyStorage; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class TileEntityCoalGenerator extends TileEntityInventoryBase implements ISharingEnergyProvider { @@ -39,18 +38,18 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements super(1, "coalGenerator"); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getEnergyScaled(int i) { return this.storage.getEnergyStored() * i / this.storage.getMaxEnergyStored(); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getBurningScaled(int i) { return this.currentBurnTime * i / this.maxBurnTime; } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { compound.setInteger("BurnTime", this.currentBurnTime); compound.setInteger("MaxBurnTime", this.maxBurnTime); @@ -60,7 +59,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { this.currentBurnTime = compound.getInteger("BurnTime"); this.maxBurnTime = compound.getInteger("MaxBurnTime"); @@ -125,7 +124,9 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements @Override public IRemover getRemover() { return (slot, automation) -> { - if (!automation) return true; + if (!automation) { + return true; + } return TileEntityFurnace.getItemBurnTime(this.inv.getStackInSlot(0)) <= 0; }; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java index 07ec5c5d7..a887bc976 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java @@ -20,17 +20,16 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.Util; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.SoundCategory; import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.oredict.OreIngredient; public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements IButtonReactor, ISharingFluidHandler { @@ -67,28 +66,28 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements super(11, "coffeeMachine"); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getCoffeeScaled(int i) { return this.coffeeCacheAmount * i / COFFEE_CACHE_MAX_AMOUNT; } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getWaterScaled(int i) { return this.tank.getFluidAmount() * i / this.tank.getCapacity(); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getEnergyScaled(int i) { return this.storage.getEnergyStored() * i / this.storage.getMaxEnergyStored(); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getBrewScaled(int i) { return this.brewTime * i / TIME_USED; } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); this.tank.writeToNBT(compound); @@ -99,7 +98,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); this.tank.readFromNBT(compound); @@ -185,7 +184,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements } @Override - public void onButtonPressed(int buttonID, EntityPlayer player) { + public void onButtonPressed(int buttonID, PlayerEntity player) { if (buttonID == 0 && this.brewTime <= 0) { this.brew(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java index 802bcd961..cb7d387d5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java @@ -16,10 +16,10 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; public class TileEntityCompost extends TileEntityInventoryBase { @@ -35,14 +35,16 @@ public class TileEntityCompost extends TileEntityInventoryBase { public static CompostRecipe getRecipeForInput(ItemStack input) { if (StackUtil.isValid(input)) { for (CompostRecipe recipe : ActuallyAdditionsAPI.COMPOST_RECIPES) { - if (recipe.matches(input)) return recipe; + if (recipe.matches(input)) { + return recipe; + } } } return null; } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.setInteger("ConversionTime", this.conversionTime); @@ -55,12 +57,14 @@ public class TileEntityCompost extends TileEntityInventoryBase { } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.conversionTime = compound.getInteger("ConversionTime"); } - if (type == NBTType.SYNC) this.world.markBlockRangeForRenderUpdate(this.pos, this.pos.up()); + if (type == NBTType.SYNC) { + this.world.markBlockRangeForRenderUpdate(this.pos, this.pos.up()); + } } @Override @@ -70,7 +74,9 @@ public class TileEntityCompost extends TileEntityInventoryBase { boolean theFlag = this.conversionTime > 0; ItemStack input = this.inv.getStackInSlot(0); if (StackUtil.isValid(input)) { - if (this.recipe == null || !this.recipe.matches(input)) this.recipe = getRecipeForInput(input); + if (this.recipe == null || !this.recipe.matches(input)) { + this.recipe = getRecipeForInput(input); + } if (this.recipe != null) { this.conversionTime++; if (this.conversionTime >= COMPOST_TIME_TICKS) { @@ -101,23 +107,34 @@ public class TileEntityCompost extends TileEntityInventoryBase { return (slot, automation) -> getRecipeForInput(this.inv.getStackInSlot(slot)) == null; } - public IBlockState getCurrentDisplay() { + public BlockState getCurrentDisplay() { ItemStack input = this.inv.getStackInSlot(0); CompostRecipe displayRecipe = this.recipe; - if (displayRecipe == null || !displayRecipe.matches(input)) displayRecipe = getRecipeForInput(input); - - if (displayRecipe == null) for (CompostRecipe r : ActuallyAdditionsAPI.COMPOST_RECIPES) { - if (ItemUtil.areItemsEqual(input, r.getOutput(), true)) return r.getOutputDisplay(); - else if (r.getInput().apply(input)) return r.getInputDisplay(); + if (displayRecipe == null || !displayRecipe.matches(input)) { + displayRecipe = getRecipeForInput(input); } - if (displayRecipe != null) return displayRecipe.getInputDisplay(); + if (displayRecipe == null) { + for (CompostRecipe r : ActuallyAdditionsAPI.COMPOST_RECIPES) { + if (ItemUtil.areItemsEqual(input, r.getOutput(), true)) { + return r.getOutputDisplay(); + } else if (r.getInput().apply(input)) { + return r.getInputDisplay(); + } + } + } + + if (displayRecipe != null) { + return displayRecipe.getInputDisplay(); + } return Blocks.AIR.getDefaultState(); } public float getHeight() { ItemStack input = this.inv.getStackInSlot(0); - if (input.isEmpty()) return 0; + if (input.isEmpty()) { + return 0; + } return (float) input.getCount() / input.getMaxStackSize(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java index 07734cb8c..ffed11a17 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java @@ -14,9 +14,9 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; @@ -35,7 +35,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase { } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); if (type != NBTType.SAVE_BLOCK) { @@ -44,7 +44,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase { } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); if (type != NBTType.SAVE_BLOCK) { @@ -75,12 +75,12 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase { private void doWork() { if (this.storage.getEnergyStored() >= ENERGY_USE * RANGE) { - IBlockState state = this.world.getBlockState(this.pos); + BlockState state = this.world.getBlockState(this.pos); EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(state); for (int i = 0; i < RANGE; i++) { BlockPos coordsBlock = this.pos.offset(sideToManipulate, i + 1); - IBlockState breakState = this.world.getBlockState(coordsBlock); + BlockState breakState = this.world.getBlockState(coordsBlock); Block blockToBreak = breakState.getBlock(); if (blockToBreak != null && !this.world.isAirBlock(coordsBlock) && this.world.getBlockState(coordsBlock).getBlockHardness(this.world, coordsBlock) > -1.0F) { NonNullList drops = NonNullList.create(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java index 6057499b4..ab08001c9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java @@ -16,7 +16,7 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraftforge.energy.IEnergyStorage; @@ -58,13 +58,13 @@ public class TileEntityDisplayStand extends TileEntityInventoryBase implements I } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); } @@ -74,7 +74,9 @@ public class TileEntityDisplayStand extends TileEntityInventoryBase implements I return (IDisplayStandItem) item; } else if (item instanceof ItemBlock) { Block block = Block.getBlockFromItem(item); - if (block instanceof IDisplayStandItem) { return (IDisplayStandItem) block; } + if (block instanceof IDisplayStandItem) { + return (IDisplayStandItem) block; + } } return null; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java index e7cb15f6b..92dbde3e7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java @@ -12,9 +12,9 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; public class TileEntityDropper extends TileEntityInventoryBase { @@ -25,7 +25,7 @@ public class TileEntityDropper extends TileEntityInventoryBase { } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.setInteger("CurrentTime", this.currentTime); @@ -33,7 +33,7 @@ public class TileEntityDropper extends TileEntityInventoryBase { } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.currentTime = compound.getInteger("CurrentTime"); @@ -60,7 +60,7 @@ public class TileEntityDropper extends TileEntityInventoryBase { private void doWork() { ItemStack theoreticalRemove = this.removeFromInventory(false); if (StackUtil.isValid(theoreticalRemove)) { - IBlockState state = this.world.getBlockState(this.pos); + BlockState state = this.world.getBlockState(this.pos); ItemStack drop = theoreticalRemove.copy(); drop.setCount(1); WorldUtil.dropItemAtSide(WorldUtil.getDirectionByPistonRotation(state), this.world, this.pos, drop); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java index 2c9d1144f..7a42683d3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java @@ -10,24 +10,23 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Nullable; - import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.BlockPos; import net.minecraft.world.WorldServer; +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.List; + public class TileEntityEmpowerer extends TileEntityInventoryBase { public int processTime; @@ -52,15 +51,20 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { } public static boolean isPossibleInput(ItemStack stack) { - for (EmpowererRecipe r : ActuallyAdditionsAPI.EMPOWERER_RECIPES) - if (r.getInput().apply(stack)) return true; + for (EmpowererRecipe r : ActuallyAdditionsAPI.EMPOWERER_RECIPES) { + if (r.getInput().apply(stack)) { + return true; + } + } return false; } @Nullable public static EmpowererRecipe findMatchingRecipe(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) { for (EmpowererRecipe r : ActuallyAdditionsAPI.EMPOWERER_RECIPES) { - if (r.matches(base, stand1, stand2, stand3, stand4)) return r; + if (r.matches(base, stand1, stand2, stand3, stand4)) { + return r; + } } return null; } @@ -79,7 +83,9 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { boolean hasPower = true; for (TileEntityDisplayStand stand : stands) { - if (stand.storage.getEnergyStored() < recipe.getEnergyPerStand() / recipe.getTime()) hasPower = false; + if (stand.storage.getEnergyStored() < recipe.getEnergyPerStand() / recipe.getTime()) { + hasPower = false; + } } if (hasPower) { @@ -130,15 +136,18 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { EnumFacing facing = EnumFacing.HORIZONTALS[i]; BlockPos offset = this.pos.offset(facing, 3); TileEntity tile = this.world.getTileEntity(offset); - if (tile instanceof TileEntityDisplayStand) stands[i] = (TileEntityDisplayStand) tile; - else return null; + if (tile instanceof TileEntityDisplayStand) { + stands[i] = (TileEntityDisplayStand) tile; + } else { + return null; + } } return stands; } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type == NBTType.SAVE_TILE) { compound.setInteger("ProcessTime", this.processTime); @@ -149,7 +158,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type == NBTType.SAVE_TILE) { this.processTime = compound.getInteger("ProcessTime"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java index af2afe57e..94c2fb0a1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; @@ -29,13 +29,13 @@ public class TileEntityEnergizer extends TileEntityInventoryBase { } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { this.storage.writeToNBT(compound); super.writeSyncableNBT(compound, type); } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { this.storage.readFromNBT(compound); super.readSyncableNBT(compound, type); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java index dee07658c..9fc552746 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java @@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.energy.CapabilityEnergy; @@ -29,13 +29,13 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements ISha } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { this.storage.writeToNBT(compound); super.writeSyncableNBT(compound, type); } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { this.storage.readFromNBT(compound); super.readSyncableNBT(compound, type); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java index 961e9b8e5..81a54998a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java @@ -10,10 +10,6 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.farmer.FarmerResult; import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; @@ -24,14 +20,18 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.BlockHorizontal; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.energy.IEnergyStorage; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer { private static final List SORTED_FARMER_BEHAVIORS = new ArrayList<>(); @@ -48,7 +48,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.setInteger("WaitTime", this.waitTime); @@ -61,7 +61,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.waitTime = compound.getInteger("WaitTime"); @@ -83,10 +83,12 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer if (this.waitTime <= 0) { int area = ConfigIntValues.FARMER_AREA.getValue(); - if (area % 2 == 0) area++; + if (area % 2 == 0) { + area++; + } int radius = area / 2; - IBlockState state = this.world.getBlockState(this.pos); + BlockState state = this.world.getBlockState(this.pos); BlockPos center = this.pos.offset(state.getValue(BlockHorizontal.FACING), radius + 1); BlockPos query = center.add(this.checkX, 0, this.checkY); @@ -122,20 +124,26 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer private void checkBehaviors(BlockPos query) { - if (!sorted) sort(); + if (!sorted) { + sort(); + } for (IFarmerBehavior behavior : SORTED_FARMER_BEHAVIORS) { FarmerResult harvestResult = behavior.tryHarvestPlant(this.world, query, this); - if (harvestResult == FarmerResult.STOP_PROCESSING) return; + if (harvestResult == FarmerResult.STOP_PROCESSING) { + return; + } for (int i = 0; i < 6; i++) { //Process seed slots only ItemStack stack = this.inv.getStackInSlot(i); - IBlockState state = this.world.getBlockState(query); + BlockState state = this.world.getBlockState(query); if (StackUtil.isValid(stack) && state.getBlock().isReplaceable(this.world, query)) { FarmerResult plantResult = behavior.tryPlantSeed(stack, this.world, query, this); if (plantResult == FarmerResult.SUCCESS) { this.inv.getStackInSlot(i).shrink(1); return; - } else if (plantResult == FarmerResult.STOP_PROCESSING) return; + } else if (plantResult == FarmerResult.STOP_PROCESSING) { + return; + } } } @@ -159,7 +167,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer @Override public EnumFacing getOrientation() { - IBlockState state = this.world.getBlockState(this.pos); + BlockState state = this.world.getBlockState(this.pos); return WorldUtil.getDirectionByPistonRotation(state); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java index b43499b00..c8bc05059 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java @@ -10,20 +10,20 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.List; -import java.util.Optional; - import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.MathHelper; +import java.util.List; +import java.util.Optional; + public class TileEntityFeeder extends TileEntityInventoryBase { public static final int THRESHOLD = 30; @@ -42,7 +42,7 @@ public class TileEntityFeeder extends TileEntityInventoryBase { } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); compound.setInteger("Timer", this.currentTimer); if (type == NBTType.SYNC) { @@ -51,7 +51,7 @@ public class TileEntityFeeder extends TileEntityInventoryBase { } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.currentTimer = compound.getInteger("Timer"); if (type == NBTType.SYNC) { @@ -63,7 +63,9 @@ public class TileEntityFeeder extends TileEntityInventoryBase { public void updateEntity() { super.updateEntity(); this.currentTimer = MathHelper.clamp(++this.currentTimer, 0, 100); - if (this.world.isRemote) return; + if (this.world.isRemote) { + return; + } int range = 5; ItemStack stack = this.inv.getStackInSlot(0); if (!stack.isEmpty() && this.currentTimer >= TIME) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java index 2827558f0..187dd9c46 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java @@ -12,14 +12,13 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.util.Util; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.templates.FluidHandlerFluidMap; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class TileEntityFermentingBarrel extends TileEntityBase implements ISharingFluidHandler { @@ -58,20 +57,20 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { compound.setInteger("ProcessTime", this.currentProcessTime); this.canolaTank.writeToNBT(compound); - NBTTagCompound tag = new NBTTagCompound(); + CompoundNBT tag = new CompoundNBT(); this.oilTank.writeToNBT(tag); compound.setTag("OilTank", tag); super.writeSyncableNBT(compound, type); } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { this.currentProcessTime = compound.getInteger("ProcessTime"); this.canolaTank.readFromNBT(compound); - NBTTagCompound tag = compound.getCompoundTag("OilTank"); + CompoundNBT tag = compound.getCompoundTag("OilTank"); if (tag != null) { this.oilTank.readFromNBT(tag); } @@ -116,17 +115,17 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari return (int) calc; } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getProcessScaled(int i) { return this.currentProcessTime * i / PROCESS_TIME; } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getOilTankScaled(int i) { return this.oilTank.getFluidAmount() * i / this.oilTank.getCapacity(); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getCanolaTankScaled(int i) { return this.canolaTank.getFluidAmount() * i / this.canolaTank.getCapacity(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java index 6593f1158..2e73a1042 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java @@ -10,17 +10,14 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.ArrayList; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.network.gui.INumberReactor; import net.minecraft.entity.item.EntityFireworkRocket; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.init.Items; import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.WeightedRandom; import net.minecraft.util.math.BlockPos; @@ -28,6 +25,9 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.energy.IEnergyStorage; +import java.util.ArrayList; +import java.util.List; + public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisplay, INumberReactor { public static final int USE_PER_SHOT = 500; @@ -52,7 +52,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); @@ -73,7 +73,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); @@ -94,44 +94,44 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp } @Override - public void onNumberReceived(double number, int id, EntityPlayer player) { + public void onNumberReceived(double number, int id, PlayerEntity player) { switch (id) { - case 0: - this.intValuePlay = (int) number; - break; - case 1: - this.chargeAmount = (int) number; - break; - case 2: - this.flightTime = (int) number; - break; - case 3: - this.trailOrFlickerChance = (float) number; - break; - case 4: - this.flickerChance = (float) number; - break; - case 5: - this.colorAmount = (int) number; - break; - case 6: - this.typeChance0 = (float) number; - break; - case 7: - this.typeChance1 = (float) number; - break; - case 8: - this.typeChance2 = (float) number; - break; - case 9: - this.typeChance3 = (float) number; - break; - case 10: - this.typeChance4 = (float) number; - break; - case 11: - this.areaOfEffect = (int) number; - break; + case 0: + this.intValuePlay = (int) number; + break; + case 1: + this.chargeAmount = (int) number; + break; + case 2: + this.flightTime = (int) number; + break; + case 3: + this.trailOrFlickerChance = (float) number; + break; + case 4: + this.flickerChance = (float) number; + break; + case 5: + this.colorAmount = (int) number; + break; + case 6: + this.typeChance0 = (float) number; + break; + case 7: + this.typeChance1 = (float) number; + break; + case 8: + this.typeChance2 = (float) number; + break; + case 9: + this.typeChance3 = (float) number; + break; + case 10: + this.typeChance4 = (float) number; + break; + case 11: + this.areaOfEffect = (int) number; + break; } this.sendUpdate(); @@ -158,16 +158,16 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp } private ItemStack makeFirework() { - NBTTagList list = new NBTTagList(); + ListNBT list = new ListNBT(); for (int i = 0; i < this.getRandomWithPlay(this.chargeAmount); i++) { list.appendTag(this.makeFireworkCharge()); } - NBTTagCompound compound1 = new NBTTagCompound(); + CompoundNBT compound1 = new CompoundNBT(); compound1.setTag("Explosions", list); compound1.setByte("Flight", (byte) this.getRandomWithPlay(this.flightTime)); - NBTTagCompound compound = new NBTTagCompound(); + CompoundNBT compound = new CompoundNBT(); compound.setTag("Fireworks", compound1); ItemStack firework = new ItemStack(Items.FIREWORKS); @@ -176,8 +176,8 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp return firework; } - private NBTTagCompound makeFireworkCharge() { - NBTTagCompound compound = new NBTTagCompound(); + private CompoundNBT makeFireworkCharge() { + CompoundNBT compound = new CompoundNBT(); if (this.world.rand.nextFloat() <= this.trailOrFlickerChance) { if (this.world.rand.nextFloat() <= this.flickerChance) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java index 27d060cf3..831d6bec7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java @@ -10,13 +10,11 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.world.WorldServer; @@ -25,6 +23,8 @@ import net.minecraft.world.storage.loot.LootTableList; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; +import java.util.List; + public class TileEntityFishingNet extends TileEntityBase { public int timeUntilNextDrop; @@ -34,7 +34,7 @@ public class TileEntityFishingNet extends TileEntityBase { } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop); @@ -42,7 +42,7 @@ public class TileEntityFishingNet extends TileEntityBase { } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop"); @@ -88,7 +88,9 @@ public class TileEntityFishingNet extends TileEntityBase { for (int i = 0; i < cap.getSlots(); i++) { stack = cap.insertItem(i, stack, false); - if (!StackUtil.isValid(stack)) { return StackUtil.getEmpty(); } + if (!StackUtil.isValid(stack)) { + return StackUtil.getEmpty(); + } } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java index 47edf2a6f..9e5a4ab17 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java @@ -14,10 +14,10 @@ import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.SoundCategory; @@ -67,11 +67,11 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing } private void doWork() { - IBlockState state = this.world.getBlockState(this.pos); + BlockState state = this.world.getBlockState(this.pos); EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(state); BlockPos coordsBlock = this.pos.offset(sideToManipulate); - IBlockState stateToBreak = this.world.getBlockState(coordsBlock); + BlockState stateToBreak = this.world.getBlockState(coordsBlock); Block blockToBreak = stateToBreak.getBlock(); if (!this.isPlacer && blockToBreak != null && blockToBreak.getMetaFromState(stateToBreak) == 0 && Util.BUCKET <= this.tank.getCapacity() - this.tank.getFluidAmount()) { if (blockToBreak instanceof IFluidBlock && ((IFluidBlock) blockToBreak).getFluid() != null) { @@ -129,7 +129,7 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.setInteger("CurrentTime", this.currentTime); @@ -138,7 +138,7 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.currentTime = compound.getInteger("CurrentTime"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java index 3e55daa21..27b77c035 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java @@ -17,11 +17,11 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraftforge.energy.IEnergyStorage; @@ -76,7 +76,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.setInteger("FirstSmeltTime", this.firstSmeltTime); @@ -87,7 +87,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.firstSmeltTime = compound.getInteger("FirstSmeltTime"); @@ -138,15 +138,21 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements this.secondSmeltTime = 0; } - IBlockState currState = this.world.getBlockState(this.pos); + BlockState currState = this.world.getBlockState(this.pos); boolean current = currState.getValue(BlockFurnaceDouble.IS_ON); boolean changeTo = current; - if (lastSmelted != smelted) changeTo = smelted; - if (this.isRedstonePowered) changeTo = true; - if (!smelted && !this.isRedstonePowered) changeTo = false; + if (this.lastSmelted != smelted) { + changeTo = smelted; + } + if (this.isRedstonePowered) { + changeTo = true; + } + if (!smelted && !this.isRedstonePowered) { + changeTo = false; + } if (changeTo != current) { - world.setBlockState(this.pos, currState.withProperty(BlockFurnaceDouble.IS_ON, changeTo)); + this.world.setBlockState(this.pos, currState.withProperty(BlockFurnaceDouble.IS_ON, changeTo)); } this.lastSmelted = smelted; @@ -174,7 +180,9 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) { ItemStack output = FurnaceRecipes.instance().getSmeltingResult(this.inv.getStackInSlot(theInput)); if (StackUtil.isValid(output)) { - if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || this.inv.getStackInSlot(theOutput).isItemEqual(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount()) { return true; } + if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || this.inv.getStackInSlot(theOutput).isItemEqual(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount()) { + return true; + } } } @@ -201,7 +209,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements } @Override - public void onButtonPressed(int buttonID, EntityPlayer player) { + public void onButtonPressed(int buttonID, PlayerEntity player) { if (buttonID == 0) { this.isAutoSplit = !this.isAutoSplit; this.markDirty(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java index c9d572919..10af532f9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java @@ -10,8 +10,8 @@ package de.ellpeck.actuallyadditions.mod.tile; -import net.minecraft.block.state.IBlockState; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.block.state.BlockState; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -28,13 +28,13 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEn } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); } @@ -61,7 +61,7 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEn for (int y = 1; y <= this.world.getHeight() - this.pos.getY(); y++) { if (power > 0) { BlockPos pos = this.pos.up(y); - IBlockState state = this.world.getBlockState(pos); + BlockState state = this.world.getBlockState(pos); if (state.getMaterial().isOpaque()) { power = 0; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGiantChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGiantChest.java index cd9920b0b..5e1e13d5e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGiantChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGiantChest.java @@ -14,8 +14,8 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.util.AwfulUtil; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ResourceLocation; import net.minecraft.world.WorldServer; import net.minecraft.world.storage.loot.ILootContainer; @@ -35,7 +35,7 @@ public class TileEntityGiantChest extends TileEntityInventoryBase implements IBu } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (this.lootTable != null) { @@ -44,7 +44,7 @@ public class TileEntityGiantChest extends TileEntityInventoryBase implements IBu } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (compound.hasKey("LootTable")) { @@ -53,7 +53,7 @@ public class TileEntityGiantChest extends TileEntityInventoryBase implements IBu } @Override - public void onButtonPressed(int buttonID, EntityPlayer player) { + public void onButtonPressed(int buttonID, PlayerEntity player) { if (player != null && this.pos != null) { GuiHandler.GuiTypes type; @@ -74,7 +74,7 @@ public class TileEntityGiantChest extends TileEntityInventoryBase implements IBu return this.lootTable; } - public void fillWithLoot(EntityPlayer player) { + public void fillWithLoot(PlayerEntity player) { if (this.lootTable != null && !this.world.isRemote && this.world instanceof WorldServer) { LootTable table = this.world.getLootTableManager().getLootTableFromLocation(this.lootTable); this.lootTable = null; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java index 22662fec1..a61a688cd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java @@ -19,10 +19,10 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.Util; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.SoundCategory; import net.minecraftforge.energy.IEnergyStorage; @@ -57,7 +57,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { compound.setInteger("FirstCrushTime", this.firstCrushTime); compound.setInteger("SecondCrushTime", this.secondCrushTime); @@ -68,7 +68,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { this.firstCrushTime = compound.getInteger("FirstCrushTime"); this.secondCrushTime = compound.getInteger("SecondCrushTime"); @@ -132,15 +132,21 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } } - IBlockState currState = this.world.getBlockState(this.pos); + BlockState currState = this.world.getBlockState(this.pos); boolean current = currState.getValue(BlockFurnaceDouble.IS_ON); boolean changeTo = current; - if (lastCrushed != crushed) changeTo = crushed; - if (this.isRedstonePowered) changeTo = true; - if (!crushed && !this.isRedstonePowered) changeTo = false; + if (this.lastCrushed != crushed) { + changeTo = crushed; + } + if (this.isRedstonePowered) { + changeTo = true; + } + if (!crushed && !this.isRedstonePowered) { + changeTo = false; + } if (changeTo != current) { - world.setBlockState(this.pos, currState.withProperty(BlockFurnaceDouble.IS_ON, changeTo)); + this.world.setBlockState(this.pos, currState.withProperty(BlockFurnaceDouble.IS_ON, changeTo)); } this.lastCrushed = crushed; @@ -171,7 +177,9 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput) { if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) { CrusherRecipe recipe = CrusherRecipeRegistry.getRecipeFromInput(this.inv.getStackInSlot(theInput)); - if (recipe == null) return false; + if (recipe == null) { + return false; + } ItemStack outputOne = recipe.getOutputOne(); ItemStack outputTwo = recipe.getOutputTwo(); if (StackUtil.isValid(outputOne)) { @@ -181,19 +189,25 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto if (StackUtil.isValid(outputTwo) && outputTwo.getItemDamage() == Util.WILDCARD) { outputTwo.setItemDamage(0); } - if ((!StackUtil.isValid(this.inv.getStackInSlot(theFirstOutput)) || this.inv.getStackInSlot(theFirstOutput).isItemEqual(outputOne) && this.inv.getStackInSlot(theFirstOutput).getCount() <= this.inv.getStackInSlot(theFirstOutput).getMaxStackSize() - outputOne.getCount()) && (!StackUtil.isValid(outputTwo) || !StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput)) || this.inv.getStackInSlot(theSecondOutput).isItemEqual(outputTwo) && this.inv.getStackInSlot(theSecondOutput).getCount() <= this.inv.getStackInSlot(theSecondOutput).getMaxStackSize() - outputTwo.getCount())) { return true; } + if ((!StackUtil.isValid(this.inv.getStackInSlot(theFirstOutput)) || this.inv.getStackInSlot(theFirstOutput).isItemEqual(outputOne) && this.inv.getStackInSlot(theFirstOutput).getCount() <= this.inv.getStackInSlot(theFirstOutput).getMaxStackSize() - outputOne.getCount()) && (!StackUtil.isValid(outputTwo) || !StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput)) || this.inv.getStackInSlot(theSecondOutput).isItemEqual(outputTwo) && this.inv.getStackInSlot(theSecondOutput).getCount() <= this.inv.getStackInSlot(theSecondOutput).getMaxStackSize() - outputTwo.getCount())) { + return true; + } } } return false; } private int getMaxCrushTime() { - return this.isDouble ? 150 : 100; + return this.isDouble + ? 150 + : 100; } public void finishCrushing(int theInput, int theFirstOutput, int theSecondOutput) { CrusherRecipe recipe = CrusherRecipeRegistry.getRecipeFromInput(this.inv.getStackInSlot(theInput)); - if (recipe == null) return; + if (recipe == null) { + return; + } ItemStack outputOne = recipe.getOutputOne(); if (StackUtil.isValid(outputOne)) { if (outputOne.getItemDamage() == Util.WILDCARD) { @@ -237,7 +251,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } @Override - public void onButtonPressed(int buttonID, EntityPlayer player) { + public void onButtonPressed(int buttonID, PlayerEntity player) { if (buttonID == 0) { this.isAutoSplit = !this.isAutoSplit; this.markDirty(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java index 2374fc118..565e27dc2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java @@ -10,19 +10,19 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.ArrayList; - import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockMagma; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.block.state.BlockState; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraftforge.energy.IEnergyStorage; +import java.util.ArrayList; + public class TileEntityHeatCollector extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay { public static final int ENERGY_PRODUCE = 40; @@ -36,7 +36,7 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); @@ -46,7 +46,7 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); @@ -63,7 +63,7 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE if (ENERGY_PRODUCE <= this.storage.getMaxEnergyStored() - this.storage.getEnergyStored()) { for (int i = 1; i <= 5; i++) { BlockPos coords = this.pos.offset(WorldUtil.getDirectionBySidesInOrder(i)); - IBlockState state = this.world.getBlockState(coords); + BlockState state = this.world.getBlockState(coords); Block block = state.getBlock(); if (block != null && this.world.getBlockState(coords).getMaterial() == Material.LAVA && block.getMetaFromState(state) == 0 || this.world.getBlockState(coords).getBlock() instanceof BlockMagma) { blocksAround.add(i); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java index 795adc1b3..7655740e4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java @@ -10,11 +10,6 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.cyclops.commoncapabilities.capability.itemhandler.SlotlessItemHandlerConfig; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.INumberReactor; @@ -23,14 +18,18 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; +import org.cyclops.commoncapabilities.capability.itemhandler.SlotlessItemHandlerConfig; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class TileEntityInputter extends TileEntityInventoryBase implements IButtonReactor, INumberReactor { @@ -64,7 +63,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt } @Override - public void onNumberReceived(double number, int textID, EntityPlayer player) { + public void onNumberReceived(double number, int textID, PlayerEntity player) { int text = (int) number; if (text != -1) { @@ -87,7 +86,9 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt private boolean newPulling() { for (EnumFacing side : this.placeToPull.keySet()) { - WorldUtil.doItemInteraction(this.placeToPull.get(side), this.wrapper, Integer.MAX_VALUE, this.slotToPullStart, this.slotToPullEnd, 0, 1, !this.isAdvanced ? null : this.leftFilter); + WorldUtil.doItemInteraction(this.placeToPull.get(side), this.wrapper, Integer.MAX_VALUE, this.slotToPullStart, this.slotToPullEnd, 0, 1, !this.isAdvanced + ? null + : this.leftFilter); if (this.placeToPull instanceof TileEntityItemViewer) { break; @@ -132,8 +133,9 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt if (tile != null) { for (EnumFacing facing : EnumFacing.values()) { IItemHandler normal = null; - if (tile.getClass() == TileEntityFurnace.class) normal = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); - else if (tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing)) { + if (tile.getClass() == TileEntityFurnace.class) { + normal = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); + } else if (tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing)) { normal = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing); } @@ -197,7 +199,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt } @Override - public void onButtonPressed(int buttonID, EntityPlayer player) { + public void onButtonPressed(int buttonID, PlayerEntity player) { this.leftFilter.onButtonPressed(buttonID); this.rightFilter.onButtonPressed(buttonID); @@ -240,7 +242,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.setInteger("SideToPut", this.sideToPut); @@ -256,7 +258,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { this.sideToPut = compound.getInteger("SideToPut"); this.slotToPutStart = compound.getInteger("SlotToPut"); @@ -315,4 +317,4 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt public IRemover getRemover() { return (slot, automation) -> !automation || slot == 0; } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java index 730b3defc..9395b50c0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java @@ -15,8 +15,8 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.util.EnumFacing; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; @@ -31,12 +31,12 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { this.inv = new TileStackHandler(slots); } - public static void saveSlots(IItemHandler slots, NBTTagCompound compound) { + public static void saveSlots(IItemHandler slots, CompoundNBT compound) { if (slots != null && slots.getSlots() > 0) { - NBTTagList tagList = new NBTTagList(); + ListNBT tagList = new ListNBT(); for (int i = 0; i < slots.getSlots(); i++) { ItemStack slot = slots.getStackInSlot(i); - NBTTagCompound tagCompound = new NBTTagCompound(); + CompoundNBT tagCompound = new CompoundNBT(); if (StackUtil.isValid(slot)) { slot.writeToNBT(tagCompound); } @@ -46,18 +46,20 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { } } - public static void loadSlots(IItemHandlerModifiable slots, NBTTagCompound compound) { + public static void loadSlots(IItemHandlerModifiable slots, CompoundNBT compound) { if (slots != null && slots.getSlots() > 0) { - NBTTagList tagList = compound.getTagList("Items", 10); + ListNBT tagList = compound.getList("Items", 10); for (int i = 0; i < slots.getSlots(); i++) { - NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); - slots.setStackInSlot(i, tagCompound != null && tagCompound.hasKey("id") ? new ItemStack(tagCompound) : StackUtil.getEmpty()); + CompoundNBT tagCompound = tagList.getCompound(i); + slots.setStackInSlot(i, tagCompound != null && tagCompound.hasKey("id") + ? new ItemStack(tagCompound) + : StackUtil.getEmpty()); } } } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type == NBTType.SAVE_TILE || type == NBTType.SYNC && this.shouldSyncSlots()) { saveSlots(this.inv, compound); @@ -100,7 +102,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type == NBTType.SAVE_TILE || type == NBTType.SYNC && this.shouldSyncSlots()) { loadSlots(this.inv, compound); @@ -133,5 +135,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { super.onContentsChanged(slot); TileEntityInventoryBase.this.markDirty(); } - }; + } + + ; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java index a879289aa..4b9318fbc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java @@ -10,11 +10,6 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.tuple.Pair; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; @@ -22,13 +17,16 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.fml.common.registry.ForgeRegistries; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; +import org.apache.commons.lang3.tuple.Pair; + +import java.util.ArrayList; +import java.util.List; public class TileEntityItemRepairer extends TileEntityInventoryBase { @@ -53,7 +51,9 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase { String reg = item.getRegistryName().toString(); if (reg != null) { for (String strg : ConfigStringListValues.REPAIRER_EXTRA_WHITELIST.getValue()) { - if (reg.equals(strg)) { return true; } + if (reg.equals(strg)) { + return true; + } } } } @@ -63,7 +63,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase { } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { compound.setInteger("NextRepairTick", this.nextRepairTick); } @@ -72,7 +72,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase { } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { this.nextRepairTick = compound.getInteger("NextRepairTick"); } @@ -101,7 +101,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase { if (input.hasTagCompound()) { //TiCon un-break tools if ("tconstruct".equalsIgnoreCase(input.getItem().getRegistryName().getNamespace())) { - NBTTagCompound stats = input.getTagCompound().getCompoundTag("Stats"); + CompoundNBT stats = input.getTagCompound().getCompoundTag("Stats"); stats.removeTag("Broken"); } } @@ -118,13 +118,15 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase { } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getEnergyScaled(int i) { return this.storage.getEnergyStored() * i / this.storage.getMaxEnergyStored(); } public int getItemDamageToScale(int i) { - if (StackUtil.isValid(this.inv.getStackInSlot(SLOT_INPUT))) { return (this.inv.getStackInSlot(SLOT_INPUT).getMaxDamage() - this.inv.getStackInSlot(SLOT_INPUT).getItemDamage()) * i / this.inv.getStackInSlot(SLOT_INPUT).getMaxDamage(); } + if (StackUtil.isValid(this.inv.getStackInSlot(SLOT_INPUT))) { + return (this.inv.getStackInSlot(SLOT_INPUT).getMaxDamage() - this.inv.getStackInSlot(SLOT_INPUT).getItemDamage()) * i / this.inv.getStackInSlot(SLOT_INPUT).getMaxDamage(); + } return 0; } @@ -157,8 +159,9 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase { ActuallyAdditions.LOGGER.error("Invalid item in repair blacklist: " + s); continue; } - if (split.length == 1) BLACKLIST.add(Pair.of(item, 0)); - else if (split.length == 2) { + if (split.length == 1) { + BLACKLIST.add(Pair.of(item, 0)); + } else if (split.length == 2) { BLACKLIST.add(Pair.of(item, Integer.parseInt(split[1]))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java index 8384c4aed..f333bbe02 100755 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java @@ -10,15 +10,6 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.cyclops.commoncapabilities.api.capability.itemhandler.ISlotlessItemHandler; -import org.cyclops.commoncapabilities.capability.itemhandler.SlotlessItemHandlerConfig; - import de.ellpeck.actuallyadditions.api.laser.Network; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.network.PacketHandler; @@ -27,15 +18,19 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.compat.CommonCapsUtil; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.IItemHandler; +import org.cyclops.commoncapabilities.api.capability.itemhandler.ISlotlessItemHandler; +import org.cyclops.commoncapabilities.capability.itemhandler.SlotlessItemHandlerConfig; + +import java.util.*; public class TileEntityItemViewer extends TileEntityBase { @@ -59,7 +54,9 @@ public class TileEntityItemViewer extends TileEntityBase { @Override public ItemStack getStackInSlot(int slot) { IItemHandlerInfo handler = TileEntityItemViewer.this.getSwitchedIndexHandler(slot); - if (handler != null && handler.isLoaded()) { return handler.handler.getStackInSlot(handler.switchedIndex); } + if (handler != null && handler.isLoaded()) { + return handler.handler.getStackInSlot(handler.switchedIndex); + } return StackUtil.getEmpty(); } @@ -128,7 +125,9 @@ public class TileEntityItemViewer extends TileEntityBase { if (ActuallyAdditions.commonCapsLoaded) { if (capability == SlotlessItemHandlerConfig.CAPABILITY) { Object handler = this.itemHandler.getSlotlessHandler(); - if (handler != null) { return (T) handler; } + if (handler != null) { + return (T) handler; + } } } return super.getCapability(capability, facing); @@ -141,7 +140,7 @@ public class TileEntityItemViewer extends TileEntityBase { public void doItemParticle(ItemStack stack, BlockPos input, BlockPos output) { if (!this.world.isRemote) { - NBTTagCompound compound = new NBTTagCompound(); + CompoundNBT compound = new CompoundNBT(); stack.writeToNBT(compound); compound.setDouble("InX", input.getX()); @@ -153,10 +152,10 @@ public class TileEntityItemViewer extends TileEntityBase { compound.setDouble("OutZ", output.getZ()); int rangeSq = 16 * 16; - for (EntityPlayer player : this.world.playerEntities) { - if (player instanceof EntityPlayerMP) { + for (PlayerEntity player : this.world.playerEntities) { + if (player instanceof ServerPlayerEntity) { if (player.getDistanceSq(input) <= rangeSq || player.getDistanceSq(output) <= rangeSq) { - PacketHandler.theNetwork.sendTo(new PacketServerToClient(compound, PacketHandler.LASER_PARTICLE_HANDLER), (EntityPlayerMP) player); + PacketHandler.theNetwork.sendTo(new PacketServerToClient(compound, PacketHandler.LASER_PARTICLE_HANDLER), (ServerPlayerEntity) player); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewerHopping.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewerHopping.java index db6bfc7ce..c14c88514 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewerHopping.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewerHopping.java @@ -20,7 +20,7 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; import net.minecraft.block.BlockHopper; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -113,7 +113,7 @@ public class TileEntityItemViewerHopping extends TileEntityItemViewer { this.handlerToPullFrom = new SlotlessableItemHandlerWrapper(normal, slotless); } - IBlockState state = this.world.getBlockState(this.pos); + BlockState state = this.world.getBlockState(this.pos); EnumFacing facing = state.getValue(BlockHopper.FACING); BlockPos toPos = this.pos.offset(facing); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java index b79c8d5cf..44bc63426 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java @@ -18,14 +18,13 @@ import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.misc.apiimpl.ConnectionPair; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import io.netty.util.internal.ConcurrentSet; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.items.IItemHandler; public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { @@ -45,17 +44,17 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type == NBTType.SYNC) { ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(this.pos, this.world); - NBTTagList list = compound.getTagList("Connections", 10); + ListNBT list = compound.getList("Connections", 10); if (!list.isEmpty()) { - for (int i = 0; i < list.tagCount(); i++) { + for (int i = 0; i < list.size(); i++) { ConnectionPair pair = new ConnectionPair(); - pair.readFromNBT(list.getCompoundTagAt(i)); + pair.readFromNBT(list.getCompound(i)); ActuallyAdditionsAPI.connectionHandler.addConnection(pair.getPositions()[0], pair.getPositions()[1], this.type, this.world, pair.doesSuppressRender()); } } @@ -63,16 +62,16 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type == NBTType.SYNC) { - NBTTagList list = new NBTTagList(); + ListNBT list = new ListNBT(); ConcurrentSet connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(this.pos, this.world); if (connections != null && !connections.isEmpty()) { for (IConnectionPair pair : connections) { - NBTTagCompound tag = new NBTTagCompound(); + CompoundNBT tag = new CompoundNBT(); pair.writeToNBT(tag); list.appendTag(tag); } @@ -110,10 +109,10 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void renderParticles(){ if(this.world.rand.nextInt(8) == 0){ - EntityPlayer player = Minecraft.getMinecraft().player; + PlayerEntity player = Minecraft.getInstance().player; if(player != null){ PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); WrenchMode mode = WrenchMode.values()[data.theCompound.getInteger("LaserWrenchMode")]; @@ -149,7 +148,7 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public AxisAlignedBB getRenderBoundingBox() { return INFINITE_EXTENT_AABB; } @@ -173,11 +172,11 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public abstract String getExtraDisplayString(); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public abstract String getCompassDisplayString(); - public abstract void onCompassAction(EntityPlayer player); + public abstract void onCompassAction(PlayerEntity player); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java index 0d95f4dc4..e57434a36 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java @@ -10,11 +10,6 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - import de.ellpeck.actuallyadditions.api.laser.IConnectionPair; import de.ellpeck.actuallyadditions.api.laser.LaserType; import de.ellpeck.actuallyadditions.api.laser.Network; @@ -22,8 +17,8 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -31,8 +26,12 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { @@ -45,7 +44,7 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { super(name, LaserType.ENERGY); for (int i = 0; i < this.energyStorages.length; i++) { - final EnumFacing facing = EnumFacing.values()[i]; + EnumFacing facing = EnumFacing.values()[i]; this.energyStorages[i] = new IEnergyStorage() { @Override @@ -98,7 +97,9 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { @Override public IEnergyStorage getEnergyStorage(EnumFacing facing) { - return this.energyStorages[facing == null ? 0 : facing.ordinal()]; + return this.energyStorages[facing == null + ? 0 + : facing.ordinal()]; } @Override @@ -215,7 +216,9 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { } //If everything that could be transmitted was transmitted - if (transmitted >= maxTransfer) { return transmitted; } + if (transmitted >= maxTransfer) { + return transmitted; + } } } } @@ -227,7 +230,9 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { } private int calcDeduction(int theoreticalReceived, double highestLoss) { - return ConfigBoolValues.LASER_RELAY_LOSS.isEnabled() ? MathHelper.ceil(theoreticalReceived * (highestLoss / 100)) : 0; + return ConfigBoolValues.LASER_RELAY_LOSS.isEnabled() + ? MathHelper.ceil(theoreticalReceived * (highestLoss / 100)) + : 0; } public int getEnergyCap() { @@ -239,24 +244,24 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getExtraDisplayString() { return StringUtil.localize("info." + ActuallyAdditions.MODID + ".laserRelay.energy.extra") + ": " + TextFormatting.DARK_RED + StringUtil.localize(this.mode.name) + TextFormatting.RESET; } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getCompassDisplayString() { return TextFormatting.GREEN + StringUtil.localize("info." + ActuallyAdditions.MODID + ".laserRelay.energy.display"); } @Override - public void onCompassAction(EntityPlayer player) { + public void onCompassAction(PlayerEntity player) { this.mode = this.mode.getNext(); } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { @@ -265,7 +270,7 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java index b3c82c6da..acd200106 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java @@ -10,12 +10,6 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - import de.ellpeck.actuallyadditions.api.laser.IConnectionPair; import de.ellpeck.actuallyadditions.api.laser.LaserType; import de.ellpeck.actuallyadditions.api.laser.Network; @@ -23,8 +17,8 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy.Mode; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -33,8 +27,13 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { @@ -46,7 +45,7 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { super("laserRelayFluids", LaserType.FLUID); for (int i = 0; i < this.fluidHandlers.length; i++) { - final EnumFacing facing = EnumFacing.values()[i]; + EnumFacing facing = EnumFacing.values()[i]; this.fluidHandlers[i] = new IFluidHandler() { @Override public IFluidTankProperties[] getTankProperties() { @@ -122,7 +121,9 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { @Override public IFluidHandler getFluidHandler(EnumFacing facing) { - return this.fluidHandlers[facing == null ? 0 : facing.ordinal()]; + return this.fluidHandlers[facing == null + ? 0 + : facing.ordinal()]; } private int transmitFluid(EnumFacing from, FluidStack stack, boolean doFill) { @@ -203,7 +204,9 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { } //If everything that could be transmitted was transmitted - if (transmitted >= stack.amount) { return transmitted; } + if (transmitted >= stack.amount) { + return transmitted; + } } } } @@ -215,24 +218,24 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getExtraDisplayString() { return StringUtil.localize("info." + ActuallyAdditions.MODID + ".laserRelay.fluid.extra") + ": " + TextFormatting.DARK_RED + StringUtil.localize(this.mode.name) + TextFormatting.RESET; } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getCompassDisplayString() { return TextFormatting.GREEN + StringUtil.localize("info." + ActuallyAdditions.MODID + ".laserRelay.energy.display"); } @Override - public void onCompassAction(EntityPlayer player) { + public void onCompassAction(PlayerEntity player) { this.mode = this.mode.getNext(); } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { @@ -241,7 +244,7 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java index 1e5e8dc68..71a697a85 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java @@ -10,15 +10,6 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import org.cyclops.commoncapabilities.capability.itemhandler.SlotlessItemHandlerConfig; - import de.ellpeck.actuallyadditions.api.laser.IConnectionPair; import de.ellpeck.actuallyadditions.api.laser.LaserType; import de.ellpeck.actuallyadditions.api.laser.Network; @@ -27,17 +18,20 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewer.GenericItemHan import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; +import org.cyclops.commoncapabilities.capability.itemhandler.SlotlessItemHandlerConfig; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; public class TileEntityLaserRelayItem extends TileEntityLaserRelay { @@ -139,7 +133,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay { } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.setInteger("Priority", this.priority); @@ -147,19 +141,19 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getExtraDisplayString() { return StringUtil.localize("info." + ActuallyAdditions.MODID + ".laserRelay.item.extra") + ": " + TextFormatting.DARK_RED + this.getPriority() + TextFormatting.RESET; } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public String getCompassDisplayString() { return TextFormatting.GREEN + StringUtil.localize("info." + ActuallyAdditions.MODID + ".laserRelay.item.display.1") + "\n" + StringUtil.localize("info." + ActuallyAdditions.MODID + ".laserRelay.item.display.2"); } @Override - public void onCompassAction(EntityPlayer player) { + public void onCompassAction(PlayerEntity player) { if (player.isSneaking()) { this.priority--; } else { @@ -168,7 +162,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay { } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.priority = compound.getInteger("Priority"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java index 26400564b..d3ed92fed 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java @@ -17,9 +17,9 @@ import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.items.IItemHandler; public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem implements IButtonReactor { @@ -38,11 +38,13 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem @Override public boolean isWhitelisted(ItemStack stack, boolean output) { - return output ? this.rightFilter.check(stack) : this.leftFilter.check(stack); + return output + ? this.rightFilter.check(stack) + : this.leftFilter.check(stack); } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); this.leftFilter.writeToNBT(compound, "LeftFilter"); @@ -50,7 +52,7 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.leftFilter.readFromNBT(compound, "LeftFilter"); @@ -58,7 +60,7 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem } @Override - public void onButtonPressed(int buttonID, EntityPlayer player) { + public void onButtonPressed(int buttonID, PlayerEntity player) { this.leftFilter.onButtonPressed(buttonID); this.rightFilter.onButtonPressed(buttonID); if (buttonID == 2) { @@ -83,7 +85,9 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem } private void addWhitelistSmart(boolean output, ItemStack stack) { - FilterSettings usedSettings = output ? this.rightFilter : this.leftFilter; + FilterSettings usedSettings = output + ? this.rightFilter + : this.leftFilter; ItemStack copy = stack.copy(); copy.setCount(1); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java index 9ddf1b666..33736ae72 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java @@ -14,9 +14,9 @@ import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraftforge.energy.IEnergyStorage; @@ -36,7 +36,7 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); if (type != NBTType.SAVE_BLOCK) { @@ -45,7 +45,7 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); if (type != NBTType.SAVE_BLOCK) { @@ -76,14 +76,18 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I public int isMultiblock() { BlockPos thisPos = this.pos; - BlockPos[] positions = new BlockPos[] { thisPos.add(1, 1, 0), thisPos.add(-1, 1, 0), thisPos.add(0, 1, 1), thisPos.add(0, 1, -1) }; + BlockPos[] positions = new BlockPos[]{thisPos.add(1, 1, 0), thisPos.add(-1, 1, 0), thisPos.add(0, 1, 1), thisPos.add(0, 1, -1)}; if (WorldUtil.hasBlocksInPlacesGiven(positions, InitBlocks.blockMisc, TheMiscBlocks.LAVA_FACTORY_CASE.ordinal(), this.world)) { BlockPos pos = thisPos.up(); - IBlockState state = this.world.getBlockState(pos); + BlockState state = this.world.getBlockState(pos); Block block = state.getBlock(); - if (block == Blocks.LAVA || block == Blocks.FLOWING_LAVA) { return HAS_LAVA; } - if (block == null || this.world.isAirBlock(pos)) { return HAS_AIR; } + if (block == Blocks.LAVA || block == Blocks.FLOWING_LAVA) { + return HAS_LAVA; + } + if (block == null || this.world.isAirBlock(pos)) { + return HAS_AIR; + } } return NOT_MULTI; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java index 7c03a8d04..d323c3e24 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java @@ -10,19 +10,19 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import net.minecraft.block.Block; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraftforge.energy.IEnergyStorage; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + public class TileEntityLeafGenerator extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay { public final CustomEnergyStorage storage = new CustomEnergyStorage(35000, 0, 450); @@ -34,13 +34,13 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); } @@ -81,7 +81,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE this.storage.receiveEnergyInternal(energyProduced, false); - AssetUtil.spawnLaserWithTimeServer(this.world, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[] { 62F / 255F, 163F / 255F, 74F / 255F }, 25, 0, 0.075F, 0.8F); + AssetUtil.spawnLaserWithTimeServer(this.world, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F / 255F, 163F / 255F, 74F / 255F}, 25, 0, 0.075F, 0.8F); } } } else { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java index 17249b6fe..1a29a7511 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java @@ -19,10 +19,10 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.state.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; @@ -55,7 +55,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); if (type != NBTType.SAVE_BLOCK) { @@ -69,7 +69,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); if (type != NBTType.SAVE_BLOCK) { @@ -120,11 +120,13 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR } private boolean mine() { - int actualUse = ENERGY_USE_PER_BLOCK * (this.onlyMineOres ? 3 : 1); + int actualUse = ENERGY_USE_PER_BLOCK * (this.onlyMineOres + ? 3 + : 1); if (this.storage.getEnergyStored() >= actualUse) { BlockPos pos = new BlockPos(this.pos.getX() + this.checkX, this.checkY, this.pos.getZ() + this.checkZ); - IBlockState state = this.world.getBlockState(pos); + BlockState state = this.world.getBlockState(pos); Block block = state.getBlock(); ItemStack stack = block.getPickBlock(state, new RayTraceResult(Type.BLOCK, new Vec3d(0, 0, 0), EnumFacing.DOWN, pos), this.world, pos, FakePlayerFactory.getMinecraft((WorldServer) this.world)); if (!block.isAir(this.world.getBlockState(pos), this.world, pos)) { @@ -164,13 +166,17 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR int[] ids = OreDictionary.getOreIDs(stack); for (int id : ids) { String name = OreDictionary.getOreName(id); - if (name.startsWith("ore") || name.startsWith("denseore")) { return true; } + if (name.startsWith("ore") || name.startsWith("denseore")) { + return true; + } } String reg = block.getRegistryName().toString(); if (!reg.isEmpty()) { for (String string : ConfigStringListValues.MINER_EXTRA_WHITELIST.getValue()) { - if (reg.equals(string)) { return true; } + if (reg.equals(string)) { + return true; + } } } } @@ -182,14 +188,16 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR } private void shootParticles(int endX, int endY, int endZ) { - AssetUtil.spawnLaserWithTimeServer(this.world, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[] { 65F / 255F, 150F / 255F, 2F / 255F }, 10, 120, 0.1F, 0.8F); + AssetUtil.spawnLaserWithTimeServer(this.world, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{65F / 255F, 150F / 255F, 2F / 255F}, 10, 120, 0.1F, 0.8F); } private boolean isBlacklisted(Block block) { String reg = block.getRegistryName().toString(); if (!reg.isEmpty()) { for (String string : ConfigStringListValues.MINER_BLACKLIST.getValue()) { - if (reg.equals(string)) { return true; } + if (reg.equals(string)) { + return true; + } } } return false; @@ -201,7 +209,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR } @Override - public void onButtonPressed(int buttonID, EntityPlayer player) { + public void onButtonPressed(int buttonID, PlayerEntity player) { if (buttonID == 0) { this.onlyMineOres = !this.onlyMineOres; this.sendUpdate(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java index efa538591..a2117dff9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.recipe.OilGenRecipe; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues; import de.ellpeck.actuallyadditions.mod.util.Util; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.energy.IEnergyStorage; @@ -22,8 +22,7 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class TileEntityOilGenerator extends TileEntityBase implements ISharingEnergyProvider, ISharingFluidHandler { @@ -38,7 +37,9 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn @Override public boolean canFillFluidType(FluidStack stack) { - Fluid fluid = stack == null ? null : stack.getFluid(); + Fluid fluid = stack == null + ? null + : stack.getFluid(); return fluid != null && getRecipeForFluid(fluid.getName()) != null; } }; @@ -59,13 +60,15 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn private static OilGenRecipe getRecipeForFluid(String fluidName) { if (fluidName != null) { for (OilGenRecipe recipe : ActuallyAdditionsAPI.OIL_GENERATOR_RECIPES) { - if (recipe != null && fluidName.equals(recipe.fluidName)) { return recipe; } + if (recipe != null && fluidName.equals(recipe.fluidName)) { + return recipe; + } } } return null; } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getBurningScaled(int i) { return this.currentBurnTime * i / this.maxBurnTime; } @@ -74,13 +77,15 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn FluidStack stack = this.tank.getFluid(); if (stack != null) { Fluid fluid = stack.getFluid(); - if (fluid != null) { return getRecipeForFluid(fluid.getName()); } + if (fluid != null) { + return getRecipeForFluid(fluid.getName()); + } } return null; } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { compound.setInteger("BurnTime", this.currentBurnTime); compound.setInteger("CurrentEnergy", this.currentEnergyProduce); @@ -92,7 +97,7 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { this.currentBurnTime = compound.getInteger("BurnTime"); this.currentEnergyProduce = compound.getInteger("CurrentEnergy"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java index 50a9547e6..f8bd2d8dd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java @@ -19,9 +19,9 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.NonNullList; @@ -47,7 +47,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.setInteger("Range", this.range); @@ -63,7 +63,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { int x = compound.getInteger("xOfTileStored"); @@ -144,7 +144,9 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements } } else { int theSlot = StackUtil.findFirstFilled(this.inv); - if (theSlot == -1) return; + if (theSlot == -1) { + return; + } this.inv.setStackInSlot(theSlot, WorldUtil.useItemAtSide(WorldUtil.getDirectionBySidesInOrder(this.side), this.world, this.boundPosition, this.inv.getStackInSlot(theSlot))); } } @@ -210,7 +212,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements } @Override - public void onButtonPressed(int buttonID, EntityPlayer player) { + public void onButtonPressed(int buttonID, PlayerEntity player) { if (this.side + 1 >= EnumFacing.values().length) { this.side = 0; } else { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java index f4a2c1257..532bfe23b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java @@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import java.util.Arrays; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; @@ -33,7 +33,7 @@ public class TileEntityPhantomRedstoneface extends TileEntityPhantomface { public void updateEntity() { if (!this.world.isRemote) { if (this.isBoundThingInRange()) { - IBlockState boundState = this.world.getBlockState(this.boundPosition); + BlockState boundState = this.world.getBlockState(this.boundPosition); if (boundState != null) { Block boundBlock = boundState.getBlock(); if (boundBlock != null) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java index 619406ded..d13d2e1d4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java @@ -14,16 +14,15 @@ import de.ellpeck.actuallyadditions.api.tile.IPhantomTile; import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.block.state.BlockState; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public abstract class TileEntityPhantomface extends TileEntityInventoryBase implements IPhantomTile { @@ -54,7 +53,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { compound.setInteger("Range", this.range); @@ -67,7 +66,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { int x = compound.getInteger("xOfTileStored"); @@ -115,7 +114,9 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl protected void onUpdateSent() { this.rangeBefore = this.range; this.boundPosBefore = this.boundPosition; - this.boundBlockBefore = this.boundPosition == null ? null : this.world.getBlockState(this.boundPosition).getBlock(); + this.boundBlockBefore = this.boundPosition == null + ? null + : this.world.getBlockState(this.boundPosition).getBlock(); if (this.boundPosition != null) { this.world.notifyNeighborsOfStateChange(this.pos, this.world.getBlockState(this.boundPosition).getBlock(), false); @@ -137,7 +138,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl return false; } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void renderParticles() { if (this.world.rand.nextInt(2) == 0) { double d1 = this.boundPosition.getY() + this.world.rand.nextFloat(); @@ -183,7 +184,9 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl public boolean hasCapability(Capability capability, EnumFacing facing) { if (this.isBoundThingInRange() && this.isCapabilitySupported(capability)) { TileEntity tile = this.world.getTileEntity(this.getBoundPosition()); - if (tile != null) { return tile.hasCapability(capability, facing); } + if (tile != null) { + return tile.hasCapability(capability, facing); + } } return super.hasCapability(capability, facing); } @@ -192,7 +195,9 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl public T getCapability(Capability capability, EnumFacing facing) { if (this.isBoundThingInRange() && this.isCapabilitySupported(capability)) { TileEntity tile = this.world.getTileEntity(this.getBoundPosition()); - if (tile != null) { return tile.getCapability(capability, facing); } + if (tile != null) { + return tile.getCapability(capability, facing); + } } return super.getCapability(capability, facing); } @@ -201,9 +206,11 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl public int getComparatorStrength() { if (this.isBoundThingInRange()) { BlockPos pos = this.getBoundPosition(); - IBlockState state = this.world.getBlockState(pos); + BlockState state = this.world.getBlockState(pos); - if (state.hasComparatorInputOverride()) { return state.getComparatorInputOverride(this.world, pos); } + if (state.hasComparatorInputOverride()) { + return state.getComparatorInputOverride(this.world, pos); + } } return 0; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java index cfba2d526..78904143d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java @@ -10,18 +10,18 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.UUID; - import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.wrapper.PlayerInvWrapper; +import java.util.UUID; + public class TileEntityPlayerInterface extends TileEntityBase implements IEnergyDisplay { public static final int DEFAULT_RANGE = 32; @@ -29,7 +29,7 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy public UUID connectedPlayer; public String playerName; private IItemHandler playerHandler; - private EntityPlayer oldPlayer; + private PlayerEntity oldPlayer; private int oldEnergy; private int range; @@ -37,11 +37,13 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy super("playerInterface"); } - private EntityPlayer getPlayer() { + private PlayerEntity getPlayer() { if (this.connectedPlayer != null) { - EntityPlayer player = this.world.getPlayerEntityByUUID(this.connectedPlayer); + PlayerEntity player = this.world.getPlayerEntityByUUID(this.connectedPlayer); if (player != null) { - if (player.getDistance(this.pos.getX(), this.pos.getY(), this.pos.getZ()) <= this.range) { return player; } + if (player.getDistance(this.pos.getX(), this.pos.getY(), this.pos.getZ()) <= this.range) { + return player; + } } } return null; @@ -49,12 +51,14 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy @Override public IItemHandler getItemHandler(EnumFacing facing) { - EntityPlayer player = this.getPlayer(); + PlayerEntity player = this.getPlayer(); if (this.oldPlayer != player) { this.oldPlayer = player; - this.playerHandler = player == null ? null : new PlayerInvWrapper(player.inventory); + this.playerHandler = player == null + ? null + : new PlayerInvWrapper(player.inventory); } return this.playerHandler; @@ -68,7 +72,7 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy this.range = TileEntityPhantomface.upgradeRange(DEFAULT_RANGE, this.world, this.pos); - EntityPlayer player = this.getPlayer(); + PlayerEntity player = this.getPlayer(); if (player != null) { for (int i = 0; i < player.inventory.getSizeInventory(); i++) { if (this.storage.getEnergyStored() > 0) { @@ -105,7 +109,7 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); @@ -116,7 +120,7 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java index a510eaf4f..dad9d91b6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java @@ -10,20 +10,20 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.ArrayList; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.WorldServer; +import java.util.ArrayList; +import java.util.List; + public class TileEntityRangedCollector extends TileEntityInventoryBase implements IButtonReactor { public static final int RANGE = 6; @@ -34,14 +34,14 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); this.filter.writeToNBT(compound, "Filter"); } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.filter.readFromNBT(compound, "Filter"); @@ -93,7 +93,7 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement } @Override - public void onButtonPressed(int buttonID, EntityPlayer player) { + public void onButtonPressed(int buttonID, PlayerEntity player) { this.filter.onButtonPressed(buttonID); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java index e5445b14f..cadaad41a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java @@ -10,13 +10,13 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.EnumFacing; import net.minecraftforge.energy.IEnergyStorage; +import java.util.ArrayList; +import java.util.List; + public class TileEntityShockSuppressor extends TileEntityBase implements IEnergyDisplay { public static final List SUPPRESSORS = new ArrayList<>(); @@ -65,13 +65,13 @@ public class TileEntityShockSuppressor extends TileEntityBase implements IEnergy } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); this.storage.writeToNBT(compound); } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.storage.readFromNBT(compound); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java index d12a69b4e..70d39d002 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java @@ -11,8 +11,8 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.network.gui.IStringReactor; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.nbt.CompoundNBT; public class TileEntitySmileyCloud extends TileEntityBase implements IStringReactor { @@ -24,7 +24,7 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); if (this.name != null && type != NBTType.SAVE_BLOCK) { compound.setString("Name", this.name); @@ -32,7 +32,7 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); if (type != NBTType.SAVE_BLOCK) { this.name = compound.getString("Name"); @@ -43,7 +43,9 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac public void updateEntity() { super.updateEntity(); if (!this.world.isRemote) { - boolean nameChanged = this.name != null ? !this.name.equals(this.nameBefore) : this.nameBefore != null; + boolean nameChanged = this.name != null + ? !this.name.equals(this.nameBefore) + : this.nameBefore != null; if (nameChanged && this.sendUpdateWithInterval()) { this.nameBefore = this.name; this.markDirty(); @@ -52,7 +54,7 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac } @Override - public void onTextReceived(String text, int textID, EntityPlayer player) { + public void onTextReceived(String text, int textID, PlayerEntity player) { this.name = text; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java index 193c62fe9..0c98176a3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java @@ -10,8 +10,6 @@ package de.ellpeck.actuallyadditions.mod.tile; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.ItemSolidifiedExperience; @@ -19,12 +17,14 @@ import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.entity.item.EntityXPOrb; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.MathHelper; +import java.util.List; + public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor { private static final int[] XP_MAP = new int[256]; @@ -35,7 +35,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } } - private final int[] buttonAmounts = new int[] { 1, 5, 10, 20, 30, 40, 50, 64, -999 }; + private final int[] buttonAmounts = new int[]{1, 5, 10, 20, 30, 40, 50, 64, -999}; public int amount; private int lastAmount; private int singlePointAmount; @@ -49,8 +49,12 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I */ public static int getExperienceForLevel(int level) { - if (level >= 0 && level < XP_MAP.length) { return XP_MAP[level]; } - if (level >= 21863) { return Integer.MAX_VALUE; } + if (level >= 0 && level < XP_MAP.length) { + return XP_MAP[level]; + } + if (level >= 21863) { + return Integer.MAX_VALUE; + } return getExperienceForLevelImpl(level); } @@ -58,7 +62,9 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I int res = 0; for (int i = 0; i < level; i++) { res += getXpBarCapacity(i); - if (res < 0) { return Integer.MAX_VALUE; } + if (res < 0) { + return Integer.MAX_VALUE; + } } return res; } @@ -66,13 +72,17 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I public static int getXpBarCapacity(int level) { if (level >= 30) { return 112 + (level - 30) * 9; - } else if (level >= 15) { return 37 + (level - 15) * 5; } + } else if (level >= 15) { + return 37 + (level - 15) * 5; + } return 7 + level * 2; } public static int getLevelForExperience(int experience) { for (int i = 0; i < XP_MAP.length; i++) { - if (XP_MAP[i] > experience) { return i - 1; } + if (XP_MAP[i] > experience) { + return i - 1; + } } int i = XP_MAP.length; while (getExperienceForLevel(i) <= experience) { @@ -81,11 +91,11 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I return i - 1; } - public static int getPlayerXP(EntityPlayer player) { + public static int getPlayerXP(PlayerEntity player) { return (int) (getExperienceForLevel(player.experienceLevel) + player.experience * player.xpBarCap()); } - public static void addPlayerXP(EntityPlayer player, int amount) { + public static void addPlayerXP(PlayerEntity player, int amount) { int experience = Math.max(0, getPlayerXP(player) + amount); player.experienceTotal = experience; player.experienceLevel = getLevelForExperience(experience); @@ -94,14 +104,14 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } @Override - public void writeSyncableNBT(NBTTagCompound compound, NBTType type) { + public void writeSyncableNBT(CompoundNBT compound, NBTType type) { super.writeSyncableNBT(compound, type); compound.setInteger("Amount", this.amount); compound.setInteger("SinglePointAmount", this.singlePointAmount); } @Override - public void readSyncableNBT(NBTTagCompound compound, NBTType type) { + public void readSyncableNBT(CompoundNBT compound, NBTType type) { super.readSyncableNBT(compound, type); this.amount = compound.getInteger("Amount"); this.singlePointAmount = compound.getInteger("SinglePointAmount"); @@ -114,7 +124,9 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I if (this.amount > 0) { ItemStack stack = this.inv.getStackInSlot(0); if (stack.isEmpty()) { - int toSet = this.amount > 64 ? 64 : this.amount; + int toSet = this.amount > 64 + ? 64 + : this.amount; this.inv.setStackInSlot(0, new ItemStack(InitItems.itemSolidifiedExperience, toSet)); this.amount -= toSet; this.markDirty(); @@ -169,16 +181,20 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I @Override public void markDirty() { - if (this.amount < 0) this.amount = Integer.MAX_VALUE; //don't u go negative on me weird number + if (this.amount < 0) { + this.amount = Integer.MAX_VALUE; //don't u go negative on me weird number + } super.markDirty(); } @Override - public void onButtonPressed(int buttonID, EntityPlayer player) { + public void onButtonPressed(int buttonID, PlayerEntity player) { if (buttonID < this.buttonAmounts.length) { int playerXP = getPlayerXP(player); if (playerXP > 0) { - int xp = this.buttonAmounts[buttonID] == -999 ? playerXP / ItemSolidifiedExperience.SOLID_XP_AMOUNT : this.buttonAmounts[buttonID]; + int xp = this.buttonAmounts[buttonID] == -999 + ? playerXP / ItemSolidifiedExperience.SOLID_XP_AMOUNT + : this.buttonAmounts[buttonID]; if (this.amount < Integer.MAX_VALUE - xp && playerXP >= ItemSolidifiedExperience.SOLID_XP_AMOUNT * xp) { addPlayerXP(player, -(ItemSolidifiedExperience.SOLID_XP_AMOUNT * xp)); if (!this.world.isRemote) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java index 609f2edfc..1f3688b0f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java @@ -15,13 +15,12 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.text.ITextComponent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public class UpdateChecker { @@ -41,11 +40,11 @@ public class UpdateChecker { } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) @SubscribeEvent(receiveCanceled = true) public void onTick(TickEvent.ClientTickEvent event) { - if (Minecraft.getMinecraft().player != null) { - EntityPlayer player = Minecraft.getMinecraft().player; + if (Minecraft.getInstance().player != null) { + PlayerEntity player = Minecraft.getInstance().player; if (UpdateChecker.checkFailed) { player.sendMessage(ITextComponent.Serializer.jsonToComponent(StringUtil.localize("info." + ActuallyAdditions.MODID + ".update.failed"))); } else if (UpdateChecker.needsUpdateNotify) { @@ -53,7 +52,9 @@ public class UpdateChecker { player.sendMessage(ITextComponent.Serializer.jsonToComponent(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".update.versionCompare", ActuallyAdditions.VERSION, UpdateChecker.updateVersionString))); player.sendMessage(ITextComponent.Serializer.jsonToComponent(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".update.buttons", UpdateChecker.CHANGELOG_LINK, UpdateChecker.DOWNLOAD_LINK))); } - if (threadFinished) MinecraftForge.EVENT_BUS.unregister(this); + if (threadFinished) { + MinecraftForge.EVENT_BUS.unregister(this); + } } } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java index 75a6103de..ac243cf37 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java @@ -10,24 +10,20 @@ package de.ellpeck.actuallyadditions.mod.util; -import org.lwjgl.opengl.GL11; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.network.PacketHandler; import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient; import de.ellpeck.actuallyadditions.mod.particle.ParticleBeam; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager.DestFactor; import net.minecraft.client.renderer.GlStateManager.SourceFactor; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.RenderItem; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; @@ -36,7 +32,7 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; @@ -44,8 +40,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.fml.common.network.NetworkRegistry; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; +import org.lwjgl.opengl.GL11; public final class AssetUtil { @@ -62,29 +58,29 @@ public final class AssetUtil { return getGuiLocation("booklet/" + file); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, String text) { font.drawString(text, xSize / 2 - font.getStringWidth(text) / 2, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, TileEntityBase tile) { displayNameString(font, xSize, yPositionOfMachineText, StringUtil.localize(tile.getNameForTranslation())); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void renderBlockInWorld(Block block, int meta) { renderItemInWorld(new ItemStack(block, 1, meta)); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void renderItemInWorld(ItemStack stack) { if (StackUtil.isValid(stack)) { GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.pushAttrib(); RenderHelper.enableStandardItemLighting(); - Minecraft.getMinecraft().getRenderItem().renderItem(stack, TransformType.FIXED); + Minecraft.getInstance().getRenderItem().renderItem(stack, TransformType.FIXED); RenderHelper.disableStandardItemLighting(); GlStateManager.popAttrib(); GlStateManager.enableLighting(); @@ -92,24 +88,24 @@ public final class AssetUtil { } } - @SideOnly(Side.CLIENT) - public static void renderStateInWorld(IBlockState state, IBlockAccess world, BlockPos pos, float brightness) { - Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state); + @OnlyIn(Dist.CLIENT) + public static void renderStateInWorld(BlockState state, IBlockAccess world, BlockPos pos, float brightness) { + Minecraft.getInstance().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + IBakedModel model = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState(state); GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); - int i = Minecraft.getMinecraft().getBlockColors().colorMultiplier(state, world, pos, 0); + int i = Minecraft.getInstance().getBlockColors().colorMultiplier(state, world, pos, 0); float r = (i >> 16 & 255) / 255F; float g = (i >> 8 & 255) / 255F; float b = (i & 255) / 255F; - Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(state, model, brightness, r, g, b); + Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(state, model, brightness, r, g, b); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void renderItemWithoutScrewingWithColors(ItemStack stack) { if (StackUtil.isValid(stack)) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); RenderItem renderer = mc.getRenderItem(); TextureManager manager = mc.getTextureManager(); @@ -131,7 +127,7 @@ public final class AssetUtil { } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void renderStackToGui(ItemStack stack, int x, int y, float scale) { GlStateManager.pushMatrix(); GlStateManager.enableBlend(); @@ -142,11 +138,11 @@ public final class AssetUtil { GlStateManager.translate(x, y, 0); GlStateManager.scale(scale, scale, scale); - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); boolean flagBefore = mc.fontRenderer.getUnicodeFlag(); mc.fontRenderer.setUnicodeFlag(false); - Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0); - Minecraft.getMinecraft().getRenderItem().renderItemOverlayIntoGUI(mc.fontRenderer, stack, 0, 0, null); + Minecraft.getInstance().getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0); + Minecraft.getInstance().getRenderItem().renderItemOverlayIntoGUI(mc.fontRenderer, stack, 0, 0, null); mc.fontRenderer.setUnicodeFlag(flagBefore); RenderHelper.disableStandardItemLighting(); @@ -154,7 +150,7 @@ public final class AssetUtil { } //Copied from Gui.class and changed - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void drawHorizontalGradientRect(int left, int top, int right, int bottom, int startColor, int endColor, float zLevel) { float f = (startColor >> 24 & 255) / 255.0F; float f1 = (startColor >> 16 & 255) / 255.0F; @@ -183,16 +179,16 @@ public final class AssetUtil { GlStateManager.enableTexture2D(); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void renderNameTag(String tag, double x, double y, double z) { - FontRenderer fontrenderer = Minecraft.getMinecraft().fontRenderer; + FontRenderer fontrenderer = Minecraft.getInstance().fontRenderer; float f = 1.6F; float f1 = 0.016666668F * f; GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); GL11.glNormal3f(0.0F, 1.0F, 0.0F); - GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(-Minecraft.getInstance().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(Minecraft.getInstance().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-f1, -f1, f1); GlStateManager.disableLighting(); GlStateManager.depthMask(false); @@ -223,7 +219,7 @@ public final class AssetUtil { public static void spawnLaserWithTimeServer(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha) { if (!world.isRemote) { - NBTTagCompound data = new NBTTagCompound(); + CompoundNBT data = new CompoundNBT(); data.setDouble("StartX", startX); data.setDouble("StartY", startY); data.setDouble("StartZ", startZ); @@ -241,9 +237,9 @@ public final class AssetUtil { } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void spawnLaserWithTimeClient(double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); if (mc.player.getDistance(startX, startY, startZ) <= 64 || mc.player.getDistance(endX, endY, endZ) <= 64) { Particle fx = new ParticleBeam(mc.world, startX, startY, startZ, endX, endY, endZ, color, maxAge, rotationTime, size, alpha); @@ -253,11 +249,11 @@ public final class AssetUtil { //Thanks to feldim2425 for this. //I can't do rendering code. Ever. - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void renderLaser(double firstX, double firstY, double firstZ, double secondX, double secondY, double secondZ, double rotationTime, float alpha, double beamWidth, float[] color) { Tessellator tessy = Tessellator.getInstance(); BufferBuilder render = tessy.getBuffer(); - World world = Minecraft.getMinecraft().world; + World world = Minecraft.getInstance().world; float r = color[0]; float g = color[1]; @@ -267,7 +263,9 @@ public final class AssetUtil { Vec3d vec2 = new Vec3d(secondX, secondY, secondZ); Vec3d combinedVec = vec2.subtract(vec1); - double rot = rotationTime > 0 ? 360D * (world.getTotalWorldTime() % rotationTime / rotationTime) : 0; + double rot = rotationTime > 0 + ? 360D * (world.getTotalWorldTime() % rotationTime / rotationTime) + : 0; double pitch = Math.atan2(combinedVec.y, Math.sqrt(combinedVec.x * combinedVec.x + combinedVec.z * combinedVec.z)); double yaw = Math.atan2(-combinedVec.z, combinedVec.x); @@ -288,7 +286,7 @@ public final class AssetUtil { /*if(r != r2 || g != g2 || b != b2){ render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); - Minecraft.getMinecraft().renderEngine.bindTexture(ClientUtil.LIGHT_BEAM_GRADIENT); + Minecraft.getInstance().renderEngine.bindTexture(ClientUtil.LIGHT_BEAM_GRADIENT); render.pos(length, -beamWidth, beamWidth).tex(0, 0).color(r, g, b, alpha).endVertex(); render.pos(length, beamWidth, beamWidth).tex(0, 1).color(r, g, b, alpha).endVertex(); @@ -369,8 +367,12 @@ public final class AssetUtil { } public static float[] getWheelColor(float pos) { - if (pos < 85.0f) { return new float[] { pos * 3.0F, 255.0f - pos * 3.0f, 0.0f }; } - if (pos < 170.0f) { return new float[] { 255.0f - (pos -= 85.0f) * 3.0f, 0.0f, pos * 3.0f }; } - return new float[] { 0.0f, (pos -= 170.0f) * 3.0f, 255.0f - pos * 3.0f }; + if (pos < 85.0f) { + return new float[]{pos * 3.0F, 255.0f - pos * 3.0f, 0.0f}; + } + if (pos < 170.0f) { + return new float[]{255.0f - (pos -= 85.0f) * 3.0f, 0.0f, pos * 3.0f}; + } + return new float[]{0.0f, (pos -= 170.0f) * 3.0f, 255.0f - pos * 3.0f}; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/FluidStateMapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/FluidStateMapper.java index 9d1a79549..7a9a65d0c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/FluidStateMapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/FluidStateMapper.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.util; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.StateMapperBase; @@ -19,12 +19,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; /** * (Excerpted from Tinkers' Construct with permission, thanks guys!) */ -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class FluidStateMapper extends StateMapperBase implements ItemMeshDefinition { public final Fluid fluid; @@ -37,7 +37,7 @@ public class FluidStateMapper extends StateMapperBase implements ItemMeshDefinit } @Override - protected ModelResourceLocation getModelResourceLocation(IBlockState state) { + protected ModelResourceLocation getModelResourceLocation(BlockState state) { return this.location; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/IColorProvidingBlock.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/IColorProvidingBlock.java index 40543780d..837cceae4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/IColorProvidingBlock.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/IColorProvidingBlock.java @@ -12,11 +12,11 @@ package de.ellpeck.actuallyadditions.mod.util; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public interface IColorProvidingBlock { - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) IBlockColor getBlockColor(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/IColorProvidingItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/IColorProvidingItem.java index 33562842d..b7ebe6a9b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/IColorProvidingItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/IColorProvidingItem.java @@ -12,11 +12,11 @@ package de.ellpeck.actuallyadditions.mod.util; import net.minecraft.client.renderer.color.IItemColor; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public interface IColorProvidingItem { - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) IItemColor getItemColor(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java index e4f877184..c58188b21 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java @@ -10,9 +10,6 @@ package de.ellpeck.actuallyadditions.mod.util; -import java.util.Arrays; -import java.util.List; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.RegistryHandler; import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase; @@ -20,15 +17,18 @@ import de.ellpeck.actuallyadditions.mod.creative.CreativeTab; import de.ellpeck.actuallyadditions.mod.util.compat.IMCHandler; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.EnumHand; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; +import net.minecraft.util.Hand; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.ForgeRegistries; +import java.util.Arrays; +import java.util.List; + public final class ItemUtil { public static Item getItemFromName(String name) { @@ -44,7 +44,9 @@ public final class ItemUtil { itemBlock.setRegistryName(block.getRegistryName()); RegistryHandler.ITEMS_TO_REGISTER.add(itemBlock); - block.setCreativeTab(addTab ? CreativeTab.INSTANCE : null); + block.setCreativeTab(addTab + ? CreativeTab.INSTANCE + : null); IMCHandler.doBlockIMC(block); @@ -59,7 +61,9 @@ public final class ItemUtil { item.setRegistryName(ActuallyAdditions.MODID, name); RegistryHandler.ITEMS_TO_REGISTER.add(item); - item.setCreativeTab(addTab ? CreativeTab.INSTANCE : null); + item.setCreativeTab(addTab + ? CreativeTab.INSTANCE + : null); IMCHandler.doItemIMC(item); @@ -79,7 +83,9 @@ public final class ItemUtil { public static int getPlaceAt(List list, ItemStack stack, boolean checkWildcard) { if (list != null && list.size() > 0) { for (int i = 0; i < list.size(); i++) { - if (!StackUtil.isValid(stack) && !StackUtil.isValid(list.get(i)) || areItemsEqual(stack, list.get(i), checkWildcard)) { return i; } + if (!StackUtil.isValid(stack) && !StackUtil.isValid(list.get(i)) || areItemsEqual(stack, list.get(i), checkWildcard)) { + return i; + } } } return -1; @@ -103,21 +109,23 @@ public final class ItemUtil { } public static boolean hasEnchantment(ItemStack stack, Enchantment e) { - NBTTagList ench = stack.getEnchantmentTagList(); + ListNBT ench = stack.getEnchantmentTagList(); if (ench != null) { - for (int i = 0; i < ench.tagCount(); i++) { - short id = ench.getCompoundTagAt(i).getShort("id"); - if (id == Enchantment.getEnchantmentID(e)) { return true; } + for (int i = 0; i < ench.size(); i++) { + short id = ench.getCompound(i).getShort("id"); + if (id == Enchantment.getEnchantmentID(e)) { + return true; + } } } return false; } public static void removeEnchantment(ItemStack stack, Enchantment e) { - NBTTagList ench = stack.getEnchantmentTagList(); + ListNBT ench = stack.getEnchantmentTagList(); if (ench != null) { - for (int i = 0; i < ench.tagCount(); i++) { - short id = ench.getCompoundTagAt(i).getShort("id"); + for (int i = 0; i < ench.size(); i++) { + short id = ench.getCompound(i).getShort("id"); if (id == Enchantment.getEnchantmentID(e)) { ench.removeTag(i); } @@ -136,13 +144,13 @@ public final class ItemUtil { return stack.hasTagCompound() && stack.getTagCompound().getBoolean("IsEnabled"); } - public static void changeEnabled(EntityPlayer player, EnumHand hand) { + public static void changeEnabled(PlayerEntity player, Hand hand) { changeEnabled(player.getHeldItem(hand)); } public static void changeEnabled(ItemStack stack) { if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); } boolean isEnabled = isEnabled(stack); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java index c9ae2ed82..6b9e4052f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java @@ -10,31 +10,31 @@ package de.ellpeck.actuallyadditions.mod.util; -import java.util.Collection; -import java.util.List; - -import org.cyclops.commoncapabilities.api.capability.itemhandler.ISlotlessItemHandler; - -import de.ellpeck.actuallyadditions.api.misc.IDisableableItem; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraftforge.items.IItemHandler; +import org.cyclops.commoncapabilities.api.capability.itemhandler.ISlotlessItemHandler; + +import java.util.Collection; +import java.util.List; public final class StackUtil { /** * Pretty much just a check for {@link ItemStack#isEmpty()} but exists in case Mojang does some more refactoring. + * * @param stack The stack + * * @return If the stack is not empty, or if it's an IDisableableItem, if its enabled. */ public static boolean isValid(ItemStack stack) { - if (stack == null) AwfulUtil.callTheFuckinPolice("Null ItemStack detected", stack); - Item i = stack.getItem(); - if (i instanceof IDisableableItem) return !((IDisableableItem) i).isDisabled(); - return !stack.isEmpty(); + return stack != null && !stack.isEmpty(); + // if (stack == null) AwfulUtil.callTheFuckinPolice("Null ItemStack detected", stack); + // Item i = stack.getItem(); + // if (i instanceof IDisableableItem) return !((IDisableableItem) i).isDisabled(); + // return !stack.isEmpty(); } /** @@ -46,7 +46,9 @@ public final class StackUtil { /** * A helper method to make NonNullLists with empty fill. + * * @param size How big the list will be. + * * @return A {@link NonNullList} with the same size as provided. */ public static NonNullList makeList(int size) { @@ -55,21 +57,30 @@ public final class StackUtil { /** * Checks if a collection of stacks are empty, as {@link Collection#isEmpty()} does not care about empty stacks. + * * @param stacks Some ItemStacks + * * @return If all stacks in the collection return true for {@link ItemStack#isEmpty()} */ public static boolean isEmpty(Collection stacks) { - if (stacks.isEmpty()) return true; - for (ItemStack s : stacks) - if (!s.isEmpty()) return false; + if (stacks.isEmpty()) { + return true; + } + for (ItemStack s : stacks) { + if (!s.isEmpty()) { + return false; + } + } return true; } /** * Checks if all provided itemstacks will fit in the AA handler. Use addAll below to actually add the stacks. This is strictly a check function. - * @param inv The AA Item handler - * @param stacks The stacks to add + * + * @param inv The AA Item handler + * @param stacks The stacks to add * @param fromAutomation If these stacks are coming from a pipe or other external source, or internally, like from the TE's update() method. + * * @return If all stacks fit fully. If even one item would not fit, the method returns false. */ public static boolean canAddAll(ItemStackHandlerAA inv, List stacks, boolean fromAutomation) { @@ -78,17 +89,22 @@ public final class StackUtil { for (ItemStack s : stacks) { for (int i = 0; i < dummy.getSlots(); i++) { s = dummy.insertItem(i, s, false, fromAutomation); - if (s.isEmpty()) break; + if (s.isEmpty()) { + break; + } + } + if (s.isEmpty()) { + counter++; } - if (s.isEmpty()) counter++; } return counter == stacks.size(); } /** * Adds all itemstacks in a list to an AA item handler. Must be an AA item handler to support the automation bool. - * @param inv The AA Item handler - * @param stacks The stacks to add + * + * @param inv The AA Item handler + * @param stacks The stacks to add * @param fromAutomation If these stacks are coming from a pipe or other external source, or internally, like from the TE's update() method. */ public static void addAll(ItemStackHandlerAA inv, List stacks, boolean fromAutomation) { @@ -96,18 +112,22 @@ public final class StackUtil { for (ItemStack s : stacks) { for (int i = 0; i < slotMax; i++) { s = inv.insertItem(i, s, false, fromAutomation); - if (s.isEmpty()) break; + if (s.isEmpty()) { + break; + } } } } /** * Checks if all provided itemstacks will fit in the AA handler. Use addAll below to actually add the stacks. This is strictly a check function. - * @param inv The AA Item handler - * @param stacks The stacks to add - * @param slot The starting slot. - * @param endSlot The ending slot, exclusive. + * + * @param inv The AA Item handler + * @param stacks The stacks to add + * @param slot The starting slot. + * @param endSlot The ending slot, exclusive. * @param fromAutomation If these stacks are coming from a pipe or other external source, or internally, like from the TE's update() method. + * * @return If all stacks fit fully. If even one item would not fit, the method returns false. */ public static boolean canAddAll(ItemStackHandlerAA inv, List stacks, int slot, int endSlot, boolean fromAutomation) { @@ -116,38 +136,49 @@ public final class StackUtil { for (ItemStack s : stacks) { for (int i = 0; i < dummy.getSlots(); i++) { s = dummy.insertItem(i, s, false, fromAutomation); - if (s.isEmpty()) break; + if (s.isEmpty()) { + break; + } + } + if (s.isEmpty()) { + counter++; } - if (s.isEmpty()) counter++; } return counter == stacks.size(); } /** * Adds all itemstacks in a list to an AA item handler. Must be an AA item handler to support the automation bool. - * @param inv The AA Item handler - * @param stacks The stacks to add - * @param slot The starting slot. - * @param endSlot The ending slot, exclusive. + * + * @param inv The AA Item handler + * @param stacks The stacks to add + * @param slot The starting slot. + * @param endSlot The ending slot, exclusive. * @param fromAutomation If these stacks are coming from a pipe or other external source, or internally, like from the TE's update() method. */ public static void addAll(ItemStackHandlerAA inv, List stacks, int slot, int endSlot, boolean fromAutomation) { for (ItemStack s : stacks) { for (int i = slot; i < endSlot; i++) { s = inv.insertItem(i, s, false, fromAutomation); - if (s.isEmpty()) break; + if (s.isEmpty()) { + break; + } } } } /** * Util method to find the first filled item in a handler. Searches from slot 0 to the end. + * * @param inv The IItemHandler to search. + * * @return The first filled slot, or -1 if all slots are empty. */ public static int findFirstFilled(IItemHandler inv) { for (int i = 0; i < inv.getSlots(); i++) { - if (!inv.getStackInSlot(i).isEmpty()) return i; + if (!inv.getStackInSlot(i).isEmpty()) { + return i; + } } return -1; } @@ -174,28 +205,36 @@ public final class StackUtil { public static ItemStack shrinkForContainer(ItemStack s, int i) { ItemStack sc = s.copy(); s.shrink(i); - if (s.isEmpty()) return sc.getItem().getContainerItem(sc); + if (s.isEmpty()) { + return sc.getItem().getContainerItem(sc); + } return s; } /** * Interaction method for working with Common Capabilities. - * @param wrapper The wrapper holding at least one instance - * @param stack The stack to insert. Should not be empty. - * @param simulate If this is a simulation + * + * @param wrapper The wrapper holding at least one instance + * @param stack The stack to insert. Should not be empty. + * @param simulate If this is a simulation * @param slotStart Start range - * @param slotEnd End range + * @param slotEnd End range + * * @return The remainder that was not inserted. */ public static ItemStack insertItem(SlotlessableItemHandlerWrapper wrapper, ItemStack stack, boolean simulate, int slotStart, int slotEnd) { - if (stack.isEmpty()) return stack; + if (stack.isEmpty()) { + return stack; + } ItemStack remain = stack.copy(); if (ActuallyAdditions.commonCapsLoaded) { Object handler = wrapper.getSlotlessHandler(); if (handler instanceof ISlotlessItemHandler) { remain = ((ISlotlessItemHandler) handler).insertItem(remain, simulate); - if (!ItemStack.areItemStacksEqual(remain, stack)) return remain; + if (!ItemStack.areItemStacksEqual(remain, stack)) { + return remain; + } } } @@ -215,8 +254,9 @@ public final class StackUtil { */ public static ItemStackHandlerAA testDummy(ItemStackHandlerAA inv, int slot, int endSlot) { NonNullList stacks = NonNullList.withSize(endSlot - slot, getEmpty()); - for (int i = slot; i < endSlot; i++) + for (int i = slot; i < endSlot; i++) { stacks.set(i - slot, inv.getStackInSlot(i).copy()); + } return new ItemStackHandlerAA(stacks, inv.getAcceptor(), inv.getRemover()); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java index 0ab74e0e4..9000a794d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java @@ -20,7 +20,7 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; import net.minecraft.util.text.translation.LanguageMap; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public final class StringUtil { @@ -32,7 +32,7 @@ public final class StringUtil { /** * Localizes a given String */ - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static String localize(String text) { return I18n.format(text); } @@ -40,7 +40,7 @@ public final class StringUtil { /** * Localizes a given formatted String with the given Replacements */ - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static String localizeFormatted(String text, Object... replace) { return I18n.format(text, replace); } @@ -50,7 +50,7 @@ public final class StringUtil { return net.minecraft.util.text.translation.I18n.translateToLocal(langKey); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow) { List list = renderer.listFormattedStringToWidth(strg, width); for (int i = 0; i < list.size(); i++) { @@ -59,7 +59,7 @@ public final class StringUtil { } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void renderScaledAsciiString(FontRenderer font, String text, float x, float y, int color, boolean shadow, float scale) { GlStateManager.pushMatrix(); GlStateManager.scale(scale, scale, scale); @@ -72,7 +72,7 @@ public final class StringUtil { GlStateManager.popMatrix(); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void renderSplitScaledAsciiString(FontRenderer font, String text, int x, int y, int color, boolean shadow, float scale, int length) { List lines = font.listFormattedStringToWidth(text, (int) (length / scale)); for (int i = 0; i < lines.size(); i++) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java index 2bc923da9..e5f75609f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java @@ -1,6 +1,6 @@ package de.ellpeck.actuallyadditions.mod.util; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.server.management.PlayerChunkMapEntry; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; @@ -14,15 +14,20 @@ public final class VanillaPacketDispatcher { WorldServer world = (WorldServer) tile.getWorld(); PlayerChunkMapEntry entry = world.getPlayerChunkMap().getEntry(tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4); - if (entry == null) return; + if (entry == null) { + return; + } - for (EntityPlayerMP player : entry.getWatchingPlayers()) + for (ServerPlayerEntity player : entry.getWatchingPlayers()) { player.connection.sendPacket(tile.getUpdatePacket()); + } } public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) { TileEntity tile = world.getTileEntity(pos); - if (tile != null) dispatchTEToNearbyPlayers(tile); + if (tile != null) { + dispatchTEToNearbyPlayers(tile); + } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java index fe033f8ab..d39584ddb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java @@ -10,27 +10,23 @@ package de.ellpeck.actuallyadditions.mod.util; -import java.util.ArrayList; - -import org.cyclops.commoncapabilities.api.capability.itemhandler.ISlotlessItemHandler; - import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; import net.minecraft.block.Block; import net.minecraft.block.BlockDirectional; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.BlockState; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.network.play.server.SPacketBlockChange; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -51,6 +47,9 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandler; +import org.cyclops.commoncapabilities.api.capability.itemhandler.ISlotlessItemHandler; + +import java.util.ArrayList; public final class WorldUtil { @@ -120,7 +119,9 @@ public final class WorldUtil { public static void doEnergyInteraction(TileEntity tileFrom, TileEntity tileTo, EnumFacing sideTo, int maxTransfer) { if (maxTransfer > 0) { - EnumFacing opp = sideTo == null ? null : sideTo.getOpposite(); + EnumFacing opp = sideTo == null + ? null + : sideTo.getOpposite(); IEnergyStorage handlerFrom = tileFrom.getCapability(CapabilityEnergy.ENERGY, sideTo); IEnergyStorage handlerTo = tileTo.getCapability(CapabilityEnergy.ENERGY, opp); if (handlerFrom != null && handlerTo != null) { @@ -155,12 +156,15 @@ public final class WorldUtil { * @param block The Block * @param meta The Meta * @param world The World + * * @return Is every block present? */ public static boolean hasBlocksInPlacesGiven(BlockPos[] positions, Block block, int meta, World world) { for (BlockPos pos : positions) { - IBlockState state = world.getBlockState(pos); - if (!(state.getBlock() == block && block.getMetaFromState(state) == meta)) { return false; } + BlockState state = world.getBlockState(pos); + if (!(state.getBlock() == block && block.getMetaFromState(state) == meta)) { + return false; + } } return true; } @@ -168,7 +172,7 @@ public final class WorldUtil { public static ItemStack useItemAtSide(EnumFacing side, World world, BlockPos pos, ItemStack stack) { if (world instanceof WorldServer && StackUtil.isValid(stack) && pos != null) { BlockPos offsetPos = pos.offset(side); - IBlockState state = world.getBlockState(offsetPos); + BlockState state = world.getBlockState(offsetPos); Block block = state.getBlock(); boolean replaceable = block.isReplaceable(world, offsetPos); @@ -181,19 +185,23 @@ public final class WorldUtil { //Plants if (replaceable && stack.getItem() instanceof IPlantable) { if (((IPlantable) stack.getItem()).getPlant(world, offsetPos).getBlock().canPlaceBlockAt(world, offsetPos)) { - if (world.setBlockState(offsetPos, ((IPlantable) stack.getItem()).getPlant(world, offsetPos), 2)) return StackUtil.shrink(stack, 1); + if (world.setBlockState(offsetPos, ((IPlantable) stack.getItem()).getPlant(world, offsetPos), 2)) { + return StackUtil.shrink(stack, 1); + } } } //Everything else try { FakePlayer fake = FakePlayerFactory.getMinecraft((WorldServer) world); - if (fake.connection == null) fake.connection = new NetHandlerSpaghettiServer(fake); + if (fake.connection == null) { + fake.connection = new NetHandlerSpaghettiServer(fake); + } ItemStack heldBefore = fake.getHeldItemMainhand(); - setHandItemWithoutAnnoyingSound(fake, EnumHand.MAIN_HAND, stack.copy()); - fake.interactionManager.processRightClickBlock(fake, world, fake.getHeldItemMainhand(), EnumHand.MAIN_HAND, offsetPos, side.getOpposite(), 0.5F, 0.5F, 0.5F); - ItemStack result = fake.getHeldItem(EnumHand.MAIN_HAND); - setHandItemWithoutAnnoyingSound(fake, EnumHand.MAIN_HAND, heldBefore); + setHandItemWithoutAnnoyingSound(fake, Hand.MAIN_HAND, stack.copy()); + fake.interactionManager.processRightClickBlock(fake, world, fake.getHeldItemMainhand(), Hand.MAIN_HAND, offsetPos, side.getOpposite(), 0.5F, 0.5F, 0.5F); + ItemStack result = fake.getHeldItem(Hand.MAIN_HAND); + setHandItemWithoutAnnoyingSound(fake, Hand.MAIN_HAND, heldBefore); return result; } catch (Exception e) { ActuallyAdditions.LOGGER.error("Something that places Blocks at " + offsetPos.getX() + ", " + offsetPos.getY() + ", " + offsetPos.getZ() + " in World " + world.provider.getDimension() + " threw an Exception! Don't let that happen again!", e); @@ -217,22 +225,22 @@ public final class WorldUtil { public static EnumFacing getDirectionBySidesInOrder(int side) { switch (side) { - case 0: - return EnumFacing.UP; - case 1: - return EnumFacing.DOWN; - case 2: - return EnumFacing.NORTH; - case 3: - return EnumFacing.EAST; - case 4: - return EnumFacing.SOUTH; - default: - return EnumFacing.WEST; + case 0: + return EnumFacing.UP; + case 1: + return EnumFacing.DOWN; + case 2: + return EnumFacing.NORTH; + case 3: + return EnumFacing.EAST; + case 4: + return EnumFacing.SOUTH; + default: + return EnumFacing.WEST; } } - public static EnumFacing getDirectionByPistonRotation(IBlockState state) { + public static EnumFacing getDirectionByPistonRotation(BlockState state) { return state.getValue(BlockDirectional.FACING); } @@ -245,11 +253,11 @@ public final class WorldUtil { return blocks; } - public static RayTraceResult getNearestPositionWithAir(World world, EntityPlayer player, int reach) { + public static RayTraceResult getNearestPositionWithAir(World world, PlayerEntity player, int reach) { return getMovingObjectPosWithReachDistance(world, player, reach, false, false, true); } - private static RayTraceResult getMovingObjectPosWithReachDistance(World world, EntityPlayer player, double distance, boolean p1, boolean p2, boolean p3) { + private static RayTraceResult getMovingObjectPosWithReachDistance(World world, PlayerEntity player, double distance, boolean p1, boolean p2, boolean p3) { float f = player.rotationPitch; float f1 = player.rotationYaw; double d0 = player.posX; @@ -266,18 +274,18 @@ public final class WorldUtil { return world.rayTraceBlocks(vec3, vec31, p1, p2, p3); } - public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, EntityPlayer player) { + public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player) { return getNearestBlockWithDefaultReachDistance(world, player, false, true, false); } - public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, EntityPlayer player, boolean stopOnLiquids, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock) { - return getMovingObjectPosWithReachDistance(world, player, player.getEntityAttribute(EntityPlayer.REACH_DISTANCE).getAttributeValue(), stopOnLiquids, ignoreBlockWithoutBoundingBox, returnLastUncollidableBlock); + public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player, boolean stopOnLiquids, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock) { + return getMovingObjectPosWithReachDistance(world, player, player.getEntityAttribute(PlayerEntity.REACH_DISTANCE).getAttributeValue(), stopOnLiquids, ignoreBlockWithoutBoundingBox, returnLastUncollidableBlock); } - public static void setHandItemWithoutAnnoyingSound(EntityPlayer player, EnumHand hand, ItemStack stack) { - if (hand == EnumHand.MAIN_HAND) { + public static void setHandItemWithoutAnnoyingSound(PlayerEntity player, Hand hand, ItemStack stack) { + if (hand == Hand.MAIN_HAND) { player.inventory.mainInventory.set(player.inventory.currentItem, stack); - } else if (hand == EnumHand.OFF_HAND) { + } else if (hand == Hand.OFF_HAND) { player.inventory.offHandInventory.set(0, stack); } } @@ -288,24 +296,28 @@ public final class WorldUtil { FakePlayer fake = FakePlayerFactory.getMinecraft((WorldServer) world); BlockPos tePos = caller.getPos(); fake.setPosition(tePos.getX() + 0.5, tePos.getY() + 0.5, tePos.getZ() + 0.5); - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); BreakEvent event = new BreakEvent(world, pos, state, fake); - if (!MinecraftForge.EVENT_BUS.post(event)) { return ForgeEventFactory.fireBlockHarvesting(drops, world, pos, state, 0, 1, false, fake); } + if (!MinecraftForge.EVENT_BUS.post(event)) { + return ForgeEventFactory.fireBlockHarvesting(drops, world, pos, state, 0, 1, false, fake); + } } return 0F; } /** * Tries to break a block as if this player had broken it. This is a complex operation. - * @param stack The player's current held stack, main hand. - * @param world The player's world. + * + * @param stack The player's current held stack, main hand. + * @param world The player's world. * @param player The player that is breaking this block. - * @param pos The pos to break. + * @param pos The pos to break. + * * @return If the break was successful. */ - public static boolean breakExtraBlock(ItemStack stack, World world, EntityPlayer player, BlockPos pos) { - IBlockState state = world.getBlockState(pos); + public static boolean breakExtraBlock(ItemStack stack, World world, PlayerEntity player, BlockPos pos) { + BlockState state = world.getBlockState(pos); Block block = state.getBlock(); if (player.capabilities.isCreativeMode) { @@ -315,7 +327,7 @@ public final class WorldUtil { // send update to client if (!world.isRemote) { - ((EntityPlayerMP) player).connection.sendPacket(new SPacketBlockChange(world, pos)); + ((ServerPlayerEntity) player).connection.sendPacket(new SPacketBlockChange(world, pos)); } return true; } @@ -326,8 +338,10 @@ public final class WorldUtil { // server sided handling if (!world.isRemote) { // send the blockbreak event - int xp = ForgeHooks.onBlockBreakEvent(world, ((EntityPlayerMP) player).interactionManager.getGameType(), (EntityPlayerMP) player, pos); - if (xp == -1) return false; + int xp = ForgeHooks.onBlockBreakEvent(world, ((ServerPlayerEntity) player).interactionManager.getGameType(), (ServerPlayerEntity) player, pos); + if (xp == -1) { + return false; + } TileEntity tileEntity = world.getTileEntity(pos); if (block.removedByPlayer(state, world, pos, player, true)) { // boolean is if block can be harvested, checked above @@ -337,7 +351,7 @@ public final class WorldUtil { } // always send block update to client - ((EntityPlayerMP) player).connection.sendPacket(new SPacketBlockChange(world, pos)); + ((ServerPlayerEntity) player).connection.sendPacket(new SPacketBlockChange(world, pos)); return true; } // client sided handling diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatFastBench.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatFastBench.java index f1f0db33f..a0a6c4650 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatFastBench.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatFastBench.java @@ -1,28 +1,28 @@ package de.ellpeck.actuallyadditions.mod.util.compat; import net.minecraft.client.gui.Gui; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Container; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; import shadows.fastbench.gui.ContainerFastBench; import shadows.fastbench.gui.GuiFastBench; public class CompatFastBench { - public static Container getFastBenchContainer(EntityPlayer p, World world) { + public static Container getFastBenchContainer(PlayerEntity p, World world) { return new ContainerFastBench(p, world, BlockPos.ORIGIN) { @Override - public boolean canInteractWith(EntityPlayer playerIn) { + public boolean canInteractWith(PlayerEntity playerIn) { return true; } }; } - @SideOnly(Side.CLIENT) - public static Gui getFastBenchGui(EntityPlayer p, World world) { + @OnlyIn(Dist.CLIENT) + public static Gui getFastBenchGui(PlayerEntity p, World world) { return new GuiFastBench(p.inventory, world, BlockPos.ORIGIN); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatUtil.java index fa72ad19a..2986913da 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/compat/CompatUtil.java @@ -11,40 +11,46 @@ package de.ellpeck.actuallyadditions.mod.util.compat; import net.minecraft.client.gui.inventory.GuiCrafting; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.ContainerWorkbench; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.event.FMLInterModComms; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.relauncher.OnlyIn; public final class CompatUtil { static boolean fb = Loader.isModLoaded("fastbench"); - @SideOnly(Side.CLIENT) - public static Object getCrafterGuiElement(EntityPlayer player, World world, int x, int y, int z) { - if (fb) return CompatFastBench.getFastBenchGui(player, world); + @OnlyIn(Dist.CLIENT) + public static Object getCrafterGuiElement(PlayerEntity player, World world, int x, int y, int z) { + if (fb) { + return CompatFastBench.getFastBenchGui(player, world); + } return new GuiCrafting(player.inventory, world, new BlockPos(x, y, z)); } - public static Object getCrafterContainerElement(EntityPlayer player, World world, int x, int y, int z) { - if (fb) return CompatFastBench.getFastBenchContainer(player, world); + public static Object getCrafterContainerElement(PlayerEntity player, World world, int x, int y, int z) { + if (fb) { + return CompatFastBench.getFastBenchContainer(player, world); + } return new ContainerWorkbench(player.inventory, world, new BlockPos(x, y, z)) { @Override - public boolean canInteractWith(EntityPlayer playerIn) { + public boolean canInteractWith(PlayerEntity playerIn) { return true; } }; } public static void registerCraftingTweaks() { - NBTTagCompound t = new NBTTagCompound(); - if (fb) t.setString("ContainerClass", "de.ellpeck.actuallyadditions.mod.util.compat.CompatFastBench$1"); - else t.setString("ContainerClass", "de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil$1"); + CompoundNBT t = new CompoundNBT(); + if (fb) { + t.setString("ContainerClass", "de.ellpeck.actuallyadditions.mod.util.compat.CompatFastBench$1"); + } else { + t.setString("ContainerClass", "de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil$1"); + } FMLInterModComms.sendMessage("craftingtweaks", "RegisterProvider", t); } }