diff --git a/.github/CONTRIBUTING b/.github/CONTRIBUTING old mode 100644 new mode 100755 diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml old mode 100644 new mode 100755 diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md old mode 100644 new mode 100755 diff --git a/.github/PULL_REQUEST_TEMPLATE b/.github/PULL_REQUEST_TEMPLATE old mode 100644 new mode 100755 diff --git a/.github/workflows/translation.yml b/.github/workflows/translation.yml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.phraseapp.yml b/.phraseapp.yml old mode 100644 new mode 100755 diff --git a/.pullapprove.yml b/.pullapprove.yml old mode 100644 new mode 100755 diff --git a/.travis.yml b/.travis.yml old mode 100644 new mode 100755 diff --git a/ABOUT.md b/ABOUT.md old mode 100644 new mode 100755 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/build.gradle b/build.gradle old mode 100644 new mode 100755 index 9f9b6642212..9c82b4303aa --- a/build.gradle +++ b/build.gradle @@ -128,7 +128,7 @@ minecraft { workingDirectory project.file('runClient') // Recommended logging data for a userdev environment - //property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + property 'forge.logging.markers', 'SCAN' // Recommended logging level for the console property 'forge.logging.console.level', 'info' diff --git a/build.properties b/build.properties old mode 100644 new mode 100755 diff --git a/config/PMD/pmd.xml b/config/PMD/pmd.xml old mode 100644 new mode 100755 diff --git a/config/checkstyle/checkstyle-noframes-sorted.xsl b/config/checkstyle/checkstyle-noframes-sorted.xsl old mode 100644 new mode 100755 diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml old mode 100644 new mode 100755 diff --git a/crowdin.yml b/crowdin.yml old mode 100644 new mode 100755 diff --git a/documentation/eclipse/checkstyle.MD b/documentation/eclipse/checkstyle.MD old mode 100644 new mode 100755 diff --git a/documentation/eclipse/log4j2.xml b/documentation/eclipse/log4j2.xml old mode 100644 new mode 100755 diff --git a/documentation/eclipse/logging.MD b/documentation/eclipse/logging.MD old mode 100644 new mode 100755 diff --git a/documentation/eclipse/setup.MD b/documentation/eclipse/setup.MD old mode 100644 new mode 100755 diff --git a/documentation/formatter/intellij/Minecolonies.xml b/documentation/formatter/intellij/Minecolonies.xml old mode 100644 new mode 100755 diff --git a/documentation/inspections/Minecolonies.xml b/documentation/inspections/Minecolonies.xml old mode 100644 new mode 100755 diff --git a/documentation/sonar/suppressing.MD b/documentation/sonar/suppressing.MD old mode 100644 new mode 100755 diff --git a/gradle.properties b/gradle.properties old mode 100644 new mode 100755 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar old mode 100644 new mode 100755 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties old mode 100644 new mode 100755 diff --git a/gradlew.bat b/gradlew.bat old mode 100644 new mode 100755 diff --git a/resources/minecolonies.png b/resources/minecolonies.png old mode 100644 new mode 100755 diff --git a/runData/config/fml.toml b/runData/config/fml.toml old mode 100644 new mode 100755 diff --git a/scripts/server.properties b/scripts/server.properties old mode 100644 new mode 100755 diff --git a/scripts/users.json b/scripts/users.json old mode 100644 new mode 100755 diff --git a/settings.gradle b/settings.gradle old mode 100644 new mode 100755 diff --git a/sonar.json b/sonar.json old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/IMinecoloniesAPI.java b/src/api/java/com/minecolonies/api/IMinecoloniesAPI.java old mode 100644 new mode 100755 index dfb57f941dc..0d1c080c0fc --- a/src/api/java/com/minecolonies/api/IMinecoloniesAPI.java +++ b/src/api/java/com/minecolonies/api/IMinecoloniesAPI.java @@ -22,7 +22,8 @@ public interface IMinecoloniesAPI { - static IMinecoloniesAPI getInstance() { + static IMinecoloniesAPI getInstance() + { return MinecoloniesAPIProxy.getInstance(); } diff --git a/src/api/java/com/minecolonies/api/MinecoloniesAPIProxy.java b/src/api/java/com/minecolonies/api/MinecoloniesAPIProxy.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/AbstractCriterionTrigger.java b/src/api/java/com/minecolonies/api/advancements/AbstractCriterionTrigger.java old mode 100644 new mode 100755 index 3c7a8ed8747..a23ea767b2e --- a/src/api/java/com/minecolonies/api/advancements/AbstractCriterionTrigger.java +++ b/src/api/java/com/minecolonies/api/advancements/AbstractCriterionTrigger.java @@ -13,9 +13,9 @@ public abstract class AbstractCriterionTrigger, U extends ICriterionInstance> implements ICriterionTrigger { - private final ResourceLocation id; + private final ResourceLocation id; private final Function createNew; - private final Map listeners = Maps.newHashMap(); + private final Map listeners = Maps.newHashMap(); protected AbstractCriterionTrigger(ResourceLocation id, Function createNew) { diff --git a/src/api/java/com/minecolonies/api/advancements/AdvancementTriggers.java b/src/api/java/com/minecolonies/api/advancements/AdvancementTriggers.java old mode 100644 new mode 100755 index c0eb5163c41..7337d21e603 --- a/src/api/java/com/minecolonies/api/advancements/AdvancementTriggers.java +++ b/src/api/java/com/minecolonies/api/advancements/AdvancementTriggers.java @@ -13,15 +13,15 @@ public class AdvancementTriggers { - public static final PlaceSupplyTrigger PLACE_SUPPLY = new PlaceSupplyTrigger(); - public static final PlaceStructureTrigger PLACE_STRUCTURE = new PlaceStructureTrigger(); - public static final CreateBuildRequestTrigger CREATE_BUILD_REQUEST = new CreateBuildRequestTrigger(); - public static final OpenGuiWindowTrigger OPEN_GUI_WINDOW = new OpenGuiWindowTrigger(); - public static final ClickGuiButtonTrigger CLICK_GUI_BUTTON = new ClickGuiButtonTrigger(); - public static final CitizenEatFoodTrigger CITIZEN_EAT_FOOD = new CitizenEatFoodTrigger(); - public static final BuildingAddRecipeTrigger BUILDING_ADD_RECIPE = new BuildingAddRecipeTrigger(); + public static final PlaceSupplyTrigger PLACE_SUPPLY = new PlaceSupplyTrigger(); + public static final PlaceStructureTrigger PLACE_STRUCTURE = new PlaceStructureTrigger(); + public static final CreateBuildRequestTrigger CREATE_BUILD_REQUEST = new CreateBuildRequestTrigger(); + public static final OpenGuiWindowTrigger OPEN_GUI_WINDOW = new OpenGuiWindowTrigger(); + public static final ClickGuiButtonTrigger CLICK_GUI_BUTTON = new ClickGuiButtonTrigger(); + public static final CitizenEatFoodTrigger CITIZEN_EAT_FOOD = new CitizenEatFoodTrigger(); + public static final BuildingAddRecipeTrigger BUILDING_ADD_RECIPE = new BuildingAddRecipeTrigger(); public static final CompleteBuildRequestTrigger COMPLETE_BUILD_REQUEST = new CompleteBuildRequestTrigger(); - public static final ColonyPopulationTrigger COLONY_POPULATION = new ColonyPopulationTrigger(); + public static final ColonyPopulationTrigger COLONY_POPULATION = new ColonyPopulationTrigger(); public static void preInit() { @@ -35,5 +35,4 @@ public static void preInit() CriteriaTriggers.register(COMPLETE_BUILD_REQUEST); CriteriaTriggers.register(COLONY_POPULATION); } - } diff --git a/src/api/java/com/minecolonies/api/advancements/CriterionListeners.java b/src/api/java/com/minecolonies/api/advancements/CriterionListeners.java old mode 100644 new mode 100755 index 65d8846340f..f687700c1ca --- a/src/api/java/com/minecolonies/api/advancements/CriterionListeners.java +++ b/src/api/java/com/minecolonies/api/advancements/CriterionListeners.java @@ -12,7 +12,7 @@ public class CriterionListeners { - private final PlayerAdvancements playerAdvancements; + private final PlayerAdvancements playerAdvancements; private final Set> listeners = Sets.newHashSet(); public CriterionListeners(PlayerAdvancements playerAdvancements) diff --git a/src/api/java/com/minecolonies/api/advancements/building_add_recipe/BuildingAddRecipeCriterionInstance.java b/src/api/java/com/minecolonies/api/advancements/building_add_recipe/BuildingAddRecipeCriterionInstance.java old mode 100644 new mode 100755 index 2c550e0806b..1f6fe7c5622 --- a/src/api/java/com/minecolonies/api/advancements/building_add_recipe/BuildingAddRecipeCriterionInstance.java +++ b/src/api/java/com/minecolonies/api/advancements/building_add_recipe/BuildingAddRecipeCriterionInstance.java @@ -9,7 +9,7 @@ public class BuildingAddRecipeCriterionInstance extends CriterionInstance { private ItemPredicate[] outputItemPredicates; - private int craftingSize = -1; + private int craftingSize = -1; public BuildingAddRecipeCriterionInstance() { diff --git a/src/api/java/com/minecolonies/api/advancements/building_add_recipe/BuildingAddRecipeListeners.java b/src/api/java/com/minecolonies/api/advancements/building_add_recipe/BuildingAddRecipeListeners.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/building_add_recipe/BuildingAddRecipeTrigger.java b/src/api/java/com/minecolonies/api/advancements/building_add_recipe/BuildingAddRecipeTrigger.java old mode 100644 new mode 100755 index 8c4bb66f9ee..934dff2838d --- a/src/api/java/com/minecolonies/api/advancements/building_add_recipe/BuildingAddRecipeTrigger.java +++ b/src/api/java/com/minecolonies/api/advancements/building_add_recipe/BuildingAddRecipeTrigger.java @@ -11,7 +11,6 @@ import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.NotNull; - public class BuildingAddRecipeTrigger extends AbstractCriterionTrigger { public BuildingAddRecipeTrigger() diff --git a/src/api/java/com/minecolonies/api/advancements/citizen_eat_food/CitizenEatFoodCriterionInstance.java b/src/api/java/com/minecolonies/api/advancements/citizen_eat_food/CitizenEatFoodCriterionInstance.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/citizen_eat_food/CitizenEatFoodListeners.java b/src/api/java/com/minecolonies/api/advancements/citizen_eat_food/CitizenEatFoodListeners.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/citizen_eat_food/CitizenEatFoodTrigger.java b/src/api/java/com/minecolonies/api/advancements/citizen_eat_food/CitizenEatFoodTrigger.java old mode 100644 new mode 100755 index 3835023b9aa..4dcac7ab8d4 --- a/src/api/java/com/minecolonies/api/advancements/citizen_eat_food/CitizenEatFoodTrigger.java +++ b/src/api/java/com/minecolonies/api/advancements/citizen_eat_food/CitizenEatFoodTrigger.java @@ -10,7 +10,6 @@ import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.NotNull; - public class CitizenEatFoodTrigger extends AbstractCriterionTrigger { public CitizenEatFoodTrigger() diff --git a/src/api/java/com/minecolonies/api/advancements/click_gui_button/ClickGuiButtonCriterionInstance.java b/src/api/java/com/minecolonies/api/advancements/click_gui_button/ClickGuiButtonCriterionInstance.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/click_gui_button/ClickGuiButtonListeners.java b/src/api/java/com/minecolonies/api/advancements/click_gui_button/ClickGuiButtonListeners.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/click_gui_button/ClickGuiButtonTrigger.java b/src/api/java/com/minecolonies/api/advancements/click_gui_button/ClickGuiButtonTrigger.java old mode 100644 new mode 100755 index 13fde6c72e8..cab9972ea47 --- a/src/api/java/com/minecolonies/api/advancements/click_gui_button/ClickGuiButtonTrigger.java +++ b/src/api/java/com/minecolonies/api/advancements/click_gui_button/ClickGuiButtonTrigger.java @@ -9,7 +9,6 @@ import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.NotNull; - public class ClickGuiButtonTrigger extends AbstractCriterionTrigger { public ClickGuiButtonTrigger() diff --git a/src/api/java/com/minecolonies/api/advancements/colony_population/ColonyPopulationCriterionInstance.java b/src/api/java/com/minecolonies/api/advancements/colony_population/ColonyPopulationCriterionInstance.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/colony_population/ColonyPopulationListeners.java b/src/api/java/com/minecolonies/api/advancements/colony_population/ColonyPopulationListeners.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/colony_population/ColonyPopulationTrigger.java b/src/api/java/com/minecolonies/api/advancements/colony_population/ColonyPopulationTrigger.java old mode 100644 new mode 100755 index 298c4895f52..448d66a6f15 --- a/src/api/java/com/minecolonies/api/advancements/colony_population/ColonyPopulationTrigger.java +++ b/src/api/java/com/minecolonies/api/advancements/colony_population/ColonyPopulationTrigger.java @@ -9,7 +9,6 @@ import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.NotNull; - public class ColonyPopulationTrigger extends AbstractCriterionTrigger { public ColonyPopulationTrigger() diff --git a/src/api/java/com/minecolonies/api/advancements/complete_build_request/CompleteBuildRequestCriterionInstance.java b/src/api/java/com/minecolonies/api/advancements/complete_build_request/CompleteBuildRequestCriterionInstance.java old mode 100644 new mode 100755 index 9fe16e2357c..69dc9070250 --- a/src/api/java/com/minecolonies/api/advancements/complete_build_request/CompleteBuildRequestCriterionInstance.java +++ b/src/api/java/com/minecolonies/api/advancements/complete_build_request/CompleteBuildRequestCriterionInstance.java @@ -7,9 +7,9 @@ public class CompleteBuildRequestCriterionInstance extends CriterionInstance { - private String hutName; + private String hutName; private StructureName structureName; - private int level = -1; + private int level = -1; public CompleteBuildRequestCriterionInstance() { diff --git a/src/api/java/com/minecolonies/api/advancements/complete_build_request/CompleteBuildRequestListeners.java b/src/api/java/com/minecolonies/api/advancements/complete_build_request/CompleteBuildRequestListeners.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/complete_build_request/CompleteBuildRequestTrigger.java b/src/api/java/com/minecolonies/api/advancements/complete_build_request/CompleteBuildRequestTrigger.java old mode 100644 new mode 100755 index a89ad4a4e9d..f63f685104b --- a/src/api/java/com/minecolonies/api/advancements/complete_build_request/CompleteBuildRequestTrigger.java +++ b/src/api/java/com/minecolonies/api/advancements/complete_build_request/CompleteBuildRequestTrigger.java @@ -10,7 +10,6 @@ import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.NotNull; - public class CompleteBuildRequestTrigger extends AbstractCriterionTrigger { public CompleteBuildRequestTrigger() diff --git a/src/api/java/com/minecolonies/api/advancements/create_build_request/CreateBuildRequestCriterionInstance.java b/src/api/java/com/minecolonies/api/advancements/create_build_request/CreateBuildRequestCriterionInstance.java old mode 100644 new mode 100755 index f412189fdef..38071821c73 --- a/src/api/java/com/minecolonies/api/advancements/create_build_request/CreateBuildRequestCriterionInstance.java +++ b/src/api/java/com/minecolonies/api/advancements/create_build_request/CreateBuildRequestCriterionInstance.java @@ -7,9 +7,9 @@ public class CreateBuildRequestCriterionInstance extends CriterionInstance { - private String hutName; + private String hutName; private StructureName structureName; - private int level = -1; + private int level = -1; public CreateBuildRequestCriterionInstance() { diff --git a/src/api/java/com/minecolonies/api/advancements/create_build_request/CreateBuildRequestListeners.java b/src/api/java/com/minecolonies/api/advancements/create_build_request/CreateBuildRequestListeners.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/create_build_request/CreateBuildRequestTrigger.java b/src/api/java/com/minecolonies/api/advancements/create_build_request/CreateBuildRequestTrigger.java old mode 100644 new mode 100755 index 62788bc085e..4385f8dba50 --- a/src/api/java/com/minecolonies/api/advancements/create_build_request/CreateBuildRequestTrigger.java +++ b/src/api/java/com/minecolonies/api/advancements/create_build_request/CreateBuildRequestTrigger.java @@ -10,7 +10,6 @@ import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.NotNull; - public class CreateBuildRequestTrigger extends AbstractCriterionTrigger { public CreateBuildRequestTrigger() diff --git a/src/api/java/com/minecolonies/api/advancements/open_gui_window/OpenGuiWindowCriterionInstance.java b/src/api/java/com/minecolonies/api/advancements/open_gui_window/OpenGuiWindowCriterionInstance.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/open_gui_window/OpenGuiWindowListeners.java b/src/api/java/com/minecolonies/api/advancements/open_gui_window/OpenGuiWindowListeners.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/open_gui_window/OpenGuiWindowTrigger.java b/src/api/java/com/minecolonies/api/advancements/open_gui_window/OpenGuiWindowTrigger.java old mode 100644 new mode 100755 index 49af405118f..dc8a0273924 --- a/src/api/java/com/minecolonies/api/advancements/open_gui_window/OpenGuiWindowTrigger.java +++ b/src/api/java/com/minecolonies/api/advancements/open_gui_window/OpenGuiWindowTrigger.java @@ -9,7 +9,6 @@ import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.NotNull; - public class OpenGuiWindowTrigger extends AbstractCriterionTrigger { public OpenGuiWindowTrigger() diff --git a/src/api/java/com/minecolonies/api/advancements/place_structure/PlaceStructureCriterionInstance.java b/src/api/java/com/minecolonies/api/advancements/place_structure/PlaceStructureCriterionInstance.java old mode 100644 new mode 100755 index 3b1a712d0cb..f4a76df1b7a --- a/src/api/java/com/minecolonies/api/advancements/place_structure/PlaceStructureCriterionInstance.java +++ b/src/api/java/com/minecolonies/api/advancements/place_structure/PlaceStructureCriterionInstance.java @@ -7,7 +7,7 @@ public class PlaceStructureCriterionInstance extends CriterionInstance { - private String hutName; + private String hutName; private StructureName structureName; public PlaceStructureCriterionInstance() diff --git a/src/api/java/com/minecolonies/api/advancements/place_structure/PlaceStructureListeners.java b/src/api/java/com/minecolonies/api/advancements/place_structure/PlaceStructureListeners.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/place_structure/PlaceStructureTrigger.java b/src/api/java/com/minecolonies/api/advancements/place_structure/PlaceStructureTrigger.java old mode 100644 new mode 100755 index 11ffdae986a..08d8f04a5ad --- a/src/api/java/com/minecolonies/api/advancements/place_structure/PlaceStructureTrigger.java +++ b/src/api/java/com/minecolonies/api/advancements/place_structure/PlaceStructureTrigger.java @@ -10,7 +10,6 @@ import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.NotNull; - public class PlaceStructureTrigger extends AbstractCriterionTrigger { public PlaceStructureTrigger() diff --git a/src/api/java/com/minecolonies/api/advancements/place_supply/PlaceSupplyCriterionInstance.java b/src/api/java/com/minecolonies/api/advancements/place_supply/PlaceSupplyCriterionInstance.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/place_supply/PlaceSupplyListeners.java b/src/api/java/com/minecolonies/api/advancements/place_supply/PlaceSupplyListeners.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/advancements/place_supply/PlaceSupplyTrigger.java b/src/api/java/com/minecolonies/api/advancements/place_supply/PlaceSupplyTrigger.java old mode 100644 new mode 100755 index e6f4238c123..65cc7dbee1f --- a/src/api/java/com/minecolonies/api/advancements/place_supply/PlaceSupplyTrigger.java +++ b/src/api/java/com/minecolonies/api/advancements/place_supply/PlaceSupplyTrigger.java @@ -8,7 +8,6 @@ import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.NotNull; - public class PlaceSupplyTrigger extends AbstractCriterionTrigger { public PlaceSupplyTrigger() diff --git a/src/api/java/com/minecolonies/api/blocks/AbstractBlockBarrel.java b/src/api/java/com/minecolonies/api/blocks/AbstractBlockBarrel.java old mode 100644 new mode 100755 index dc18578a423..6681f96c018 --- a/src/api/java/com/minecolonies/api/blocks/AbstractBlockBarrel.java +++ b/src/api/java/com/minecolonies/api/blocks/AbstractBlockBarrel.java @@ -15,7 +15,7 @@ public abstract class AbstractBlockBarrel> exte /** * The position it faces. */ - public static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING; + public static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING; public AbstractBlockBarrel(final Properties properties) { @@ -28,7 +28,7 @@ public static BlockState changeStateOverFullness(@NotNull final AbstractTileEnti * 12.8 -> the number of items needed to go up on a state (having 6 filling states) * So items/12.8 -> meta of the state we should get */ - BarrelType type = BarrelType.byMetadata((int) Math.round(te.getItems()/12.8)); + BarrelType type = BarrelType.byMetadata((int) Math.round(te.getItems() / 12.8)); /* * We check if the barrel is marked as empty but it have items inside. If so, means that it @@ -36,7 +36,7 @@ public static BlockState changeStateOverFullness(@NotNull final AbstractTileEnti * knows it have some items inside */ - if(type.equals(BarrelType.ZERO) && te.getItems() > 0) + if (type.equals(BarrelType.ZERO) && te.getItems() > 0) { type = BarrelType.TWENTY; } @@ -44,7 +44,7 @@ else if (te.getItems() == AbstractTileEntityBarrel.MAX_ITEMS) { type = BarrelType.WORKING; } - if(te.isDone()) + if (te.isDone()) { type = BarrelType.DONE; } diff --git a/src/api/java/com/minecolonies/api/blocks/AbstractBlockHut.java b/src/api/java/com/minecolonies/api/blocks/AbstractBlockHut.java old mode 100644 new mode 100755 index 1c2bc177f8c..d7740ec10f0 --- a/src/api/java/com/minecolonies/api/blocks/AbstractBlockHut.java +++ b/src/api/java/com/minecolonies/api/blocks/AbstractBlockHut.java @@ -221,11 +221,11 @@ public void onBlockPlacedBy(@NotNull final World worldIn, @NotNull final BlockPo final TileEntity tileEntity = worldIn.getTileEntity(pos); if (tileEntity instanceof TileEntityColonyBuilding) { - if (((TileEntityColonyBuilding) tileEntity).getBuildingName() != getBuildingEntry().getRegistryName()) + @NotNull final TileEntityColonyBuilding hut = (TileEntityColonyBuilding) tileEntity; + if (hut.getBuildingName() != getBuildingEntry().getRegistryName()) { - ((TileEntityColonyBuilding) tileEntity).registryName = getBuildingEntry().getRegistryName(); + hut.registryName = getBuildingEntry().getRegistryName(); } - @NotNull final AbstractTileEntityColonyBuilding hut = (AbstractTileEntityColonyBuilding) tileEntity; @Nullable final IColony colony = IColonyManager.getInstance().getColonyByPosFromWorld(worldIn, hut.getPosition()); if (colony != null) diff --git a/src/api/java/com/minecolonies/api/blocks/AbstractBlockMinecolonies.java b/src/api/java/com/minecolonies/api/blocks/AbstractBlockMinecolonies.java old mode 100644 new mode 100755 index 9c6984abd02..61a05b80f63 --- a/src/api/java/com/minecolonies/api/blocks/AbstractBlockMinecolonies.java +++ b/src/api/java/com/minecolonies/api/blocks/AbstractBlockMinecolonies.java @@ -27,6 +27,7 @@ public B registerBlock(final IForgeRegistry registry) registry.register(this); return (B) this; } + /** * Registery block at gameregistry. * diff --git a/src/api/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesContainer.java b/src/api/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesContainer.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesFalling.java b/src/api/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesFalling.java old mode 100644 new mode 100755 index f2a9eb36aaf..311be40144f --- a/src/api/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesFalling.java +++ b/src/api/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesFalling.java @@ -2,7 +2,8 @@ import com.minecolonies.api.blocks.interfaces.IBlockMinecolonies; import com.minecolonies.api.util.constant.Suppression; -import net.minecraft.block.*; +import net.minecraft.block.Block; +import net.minecraft.block.FallingBlock; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraftforge.registries.IForgeRegistry; @@ -27,6 +28,7 @@ public B registerBlock(final IForgeRegistry registry) registry.register(this); return (B) this; } + /** * Registery block at gameregistry. * diff --git a/src/api/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesHorizontal.java b/src/api/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesHorizontal.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesRack.java b/src/api/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesRack.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/blocks/ModBlocks.java b/src/api/java/com/minecolonies/api/blocks/ModBlocks.java old mode 100644 new mode 100755 index dbed6246144..f610118502a --- a/src/api/java/com/minecolonies/api/blocks/ModBlocks.java +++ b/src/api/java/com/minecolonies/api/blocks/ModBlocks.java @@ -5,8 +5,7 @@ import org.jetbrains.annotations.NotNull; /** - * Class to create the modBlocks. - * References to the blocks can be made here + * Class to create the modBlocks. References to the blocks can be made here *

* We disabled the following finals since we are neither able to mark the items as final, nor do we want to provide public accessors. */ @@ -67,13 +66,13 @@ public final class ModBlocks * Utility blocks. */ public static AbstractBlockMinecoloniesConstructionTape> blockConstructionTape; - public static AbstractBlockMinecoloniesRack> blockRack; - public static AbstractBlockMinecolonies> blockWayPoint; - public static AbstractBlockBarrel> blockBarrel; - public static AbstractBlockMinecoloniesHorizontal> blockDecorationPlaceholder; - public static AbstractBlockMinecoloniesDefault> blockScarecrow; - public static AbstractBlockMinecolonies> blockBarracksTowerSubstitution; - public static AbstractBlockMinecolonies> blockCompostedDirt; + public static AbstractBlockMinecoloniesRack> blockRack; + public static AbstractBlockMinecolonies> blockWayPoint; + public static AbstractBlockBarrel> blockBarrel; + public static AbstractBlockMinecoloniesHorizontal> blockDecorationPlaceholder; + public static AbstractBlockMinecoloniesDefault> blockScarecrow; + public static AbstractBlockMinecolonies> blockBarracksTowerSubstitution; + public static AbstractBlockMinecolonies> blockCompostedDirt; /** * Private constructor to hide the implicit public one. @@ -127,6 +126,7 @@ public static AbstractBlockHut[] getHuts() blockHutTavern, blockHutRabbitHutch, blockHutConcreteMixer, - blockHutBeekeeper}; + blockHutBeekeeper, + blockHutFlorist}; } } diff --git a/src/api/java/com/minecolonies/api/blocks/decorative/AbstractBlockMinecoloniesConstructionTape.java b/src/api/java/com/minecolonies/api/blocks/decorative/AbstractBlockMinecoloniesConstructionTape.java old mode 100644 new mode 100755 index d2cf27a0954..bfcd549a40a --- a/src/api/java/com/minecolonies/api/blocks/decorative/AbstractBlockMinecoloniesConstructionTape.java +++ b/src/api/java/com/minecolonies/api/blocks/decorative/AbstractBlockMinecoloniesConstructionTape.java @@ -17,15 +17,16 @@ import net.minecraft.world.IBlockReader; import org.jetbrains.annotations.NotNull; -public abstract class AbstractBlockMinecoloniesConstructionTape> extends AbstractBlockMinecoloniesFalling implements IWaterLoggable +public abstract class AbstractBlockMinecoloniesConstructionTape> extends AbstractBlockMinecoloniesFalling + implements IWaterLoggable { - public static final BooleanProperty NORTH = SixWayBlock.NORTH; - public static final BooleanProperty EAST = SixWayBlock.EAST; - public static final BooleanProperty SOUTH = SixWayBlock.SOUTH; - public static final BooleanProperty WEST = SixWayBlock.WEST; + public static final BooleanProperty NORTH = SixWayBlock.NORTH; + public static final BooleanProperty EAST = SixWayBlock.EAST; + public static final BooleanProperty SOUTH = SixWayBlock.SOUTH; + public static final BooleanProperty WEST = SixWayBlock.WEST; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - protected VoxelShape[] shapes = new VoxelShape[]{}; + protected VoxelShape[] shapes = new VoxelShape[] {}; private final Object2IntMap stateShapeMap = new Object2IntOpenHashMap<>(); @@ -61,16 +62,24 @@ protected int getIndex(BlockState state) return this.stateShapeMap.computeIntIfAbsent(state, (computeState) -> { int i = 0; if (computeState.get(NORTH)) + { i |= getMask(Direction.NORTH); + } if (computeState.get(EAST)) + { i |= getMask(Direction.EAST); + } if (computeState.get(SOUTH)) + { i |= getMask(Direction.SOUTH); + } if (computeState.get(WEST)) + { i |= getMask(Direction.WEST); + } return i; }); @@ -90,32 +99,34 @@ protected VoxelShape[] makeShapes(float nodeWidth, float limbWidth, float nodeHe float limbStart = 8.0F - limbWidth; float limbEnd = 8.0F + limbWidth; - VoxelShape node = Block.makeCuboidShape(nodeStart, 0.0F, nodeStart, nodeEnd, nodeHeight, nodeEnd); - VoxelShape north = Block.makeCuboidShape(limbStart, limbBase, 0.0F, limbEnd, limbTop, limbEnd); + VoxelShape node = Block.makeCuboidShape(nodeStart, 0.0F, nodeStart, nodeEnd, nodeHeight, nodeEnd); + VoxelShape north = Block.makeCuboidShape(limbStart, limbBase, 0.0F, limbEnd, limbTop, limbEnd); VoxelShape south = Block.makeCuboidShape(limbStart, limbBase, limbStart, limbEnd, limbTop, 16.0D); - VoxelShape west = Block.makeCuboidShape(0.0F, limbBase, limbStart, limbEnd, limbTop, limbEnd); - VoxelShape east = Block.makeCuboidShape(limbStart, limbBase, limbStart, 16.0D, limbTop, limbEnd); + VoxelShape west = Block.makeCuboidShape(0.0F, limbBase, limbStart, limbEnd, limbTop, limbEnd); + VoxelShape east = Block.makeCuboidShape(limbStart, limbBase, limbStart, 16.0D, limbTop, limbEnd); VoxelShape cornernw = VoxelShapes.or(north, east); VoxelShape cornerse = VoxelShapes.or(south, west); // All 16 possible block combinations, in a specific index to be retrieved by getIndex VoxelShape[] avoxelshape = new VoxelShape[] - { - VoxelShapes.empty(), south, west, cornerse, north, - VoxelShapes.or(south, north), - VoxelShapes.or(west, north), - VoxelShapes.or(cornerse,north), east, - VoxelShapes.or(south, east), - VoxelShapes.or(west, east), - VoxelShapes.or(cornerse,east), cornernw, - VoxelShapes.or(south, cornernw), - VoxelShapes.or(west, cornernw), - VoxelShapes.or(cornerse,cornernw) - }; + { + VoxelShapes.empty(), south, west, cornerse, north, + VoxelShapes.or(south, north), + VoxelShapes.or(west, north), + VoxelShapes.or(cornerse, north), east, + VoxelShapes.or(south, east), + VoxelShapes.or(west, east), + VoxelShapes.or(cornerse, east), cornernw, + VoxelShapes.or(south, cornernw), + VoxelShapes.or(west, cornernw), + VoxelShapes.or(cornerse, cornernw) + }; // Combine the arm voxel shapes with the main node for all combinations - for(int i = 0; i < 16; ++i) + for (int i = 0; i < 16; ++i) + { avoxelshape[i] = VoxelShapes.or(node, avoxelshape[i]); + } return avoxelshape; } diff --git a/src/api/java/com/minecolonies/api/blocks/huts/AbstractBlockMinecoloniesDefault.java b/src/api/java/com/minecolonies/api/blocks/huts/AbstractBlockMinecoloniesDefault.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/blocks/interfaces/IBlockMinecolonies.java b/src/api/java/com/minecolonies/api/blocks/interfaces/IBlockMinecolonies.java old mode 100644 new mode 100755 index 07dc75dfd00..f9ce4b2bb0c --- a/src/api/java/com/minecolonies/api/blocks/interfaces/IBlockMinecolonies.java +++ b/src/api/java/com/minecolonies/api/blocks/interfaces/IBlockMinecolonies.java @@ -17,7 +17,7 @@ public interface IBlockMinecolonies> /** * Registery block at gameregistry. * - * @param registry the registry to use. + * @param registry the registry to use. * @param properties the item properties. */ void registerBlockItem(final IForgeRegistry registry, final Item.Properties properties); diff --git a/src/api/java/com/minecolonies/api/blocks/interfaces/IRSComponentBlock.java b/src/api/java/com/minecolonies/api/blocks/interfaces/IRSComponentBlock.java old mode 100644 new mode 100755 index 03db12d7486..cb60f4daa72 --- a/src/api/java/com/minecolonies/api/blocks/interfaces/IRSComponentBlock.java +++ b/src/api/java/com/minecolonies/api/blocks/interfaces/IRSComponentBlock.java @@ -2,7 +2,7 @@ /** * Empty interface that indicates the Block is actually just a single block, not a building with an schematic. - * + *

* Originally intended for detecting Stash and Postbox instances */ public interface IRSComponentBlock diff --git a/src/api/java/com/minecolonies/api/blocks/types/BarrelType.java b/src/api/java/com/minecolonies/api/blocks/types/BarrelType.java old mode 100644 new mode 100755 index e8954e34b7a..7937df9706e --- a/src/api/java/com/minecolonies/api/blocks/types/BarrelType.java +++ b/src/api/java/com/minecolonies/api/blocks/types/BarrelType.java @@ -13,7 +13,8 @@ public enum BarrelType implements IStringSerializable EIGHTY(4, "80perc", MaterialColor.WOOD), HUNDRED(5, "100perc", MaterialColor.WOOD), WORKING(6, "working", MaterialColor.WOOD), - DONE(7, "done", MaterialColor.WOOD),; + DONE(7, "done", MaterialColor.WOOD), + ; private static final BarrelType[] META_LOOKUP = new BarrelType[values().length]; static @@ -23,9 +24,9 @@ public enum BarrelType implements IStringSerializable META_LOOKUP[enumtype.getMetadata()] = enumtype; } } - private final int meta; - private final String name; - private final String unlocalizedName; + private final int meta; + private final String name; + private final String unlocalizedName; private final MaterialColor mapColor; @@ -57,6 +58,7 @@ public enum BarrelType implements IStringSerializable /** * Returns a type by a given metadata + * * @param meta the metadata * @return the type */ diff --git a/src/api/java/com/minecolonies/api/blocks/types/RackType.java b/src/api/java/com/minecolonies/api/blocks/types/RackType.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/client/render/modeltype/AmazonModel.java b/src/api/java/com/minecolonies/api/client/render/modeltype/AmazonModel.java old mode 100644 new mode 100755 index 0efdc0295fa..500aba01b80 --- a/src/api/java/com/minecolonies/api/client/render/modeltype/AmazonModel.java +++ b/src/api/java/com/minecolonies/api/client/render/modeltype/AmazonModel.java @@ -11,6 +11,7 @@ public class AmazonModel extends BipedModel extends BipedModel< { /** * Create a model of a specific size. + * * @param size the size. */ public EgyptianModel(final float size) diff --git a/src/api/java/com/minecolonies/api/client/render/modeltype/IModelType.java b/src/api/java/com/minecolonies/api/client/render/modeltype/IModelType.java old mode 100644 new mode 100755 index 62341bc1118..09e7c167567 --- a/src/api/java/com/minecolonies/api/client/render/modeltype/IModelType.java +++ b/src/api/java/com/minecolonies/api/client/render/modeltype/IModelType.java @@ -1,17 +1,17 @@ package com.minecolonies.api.client.render.modeltype; import com.minecolonies.api.entity.citizen.AbstractEntityCitizen; - import net.minecraft.util.ResourceLocation; /** - * Defines a model type and its textures. - * Use the {@link com.minecolonies.api.client.render.modeltype.registry.IModelTypeRegistry} to register it, together with a Citizen model for both male and female. + * Defines a model type and its textures. Use the {@link com.minecolonies.api.client.render.modeltype.registry.IModelTypeRegistry} to register it, together with a Citizen model for + * both male and female. */ public interface IModelType { /** * The name of the model type. + * * @return The name. */ String getName(); diff --git a/src/api/java/com/minecolonies/api/client/render/modeltype/ISimpleModelType.java b/src/api/java/com/minecolonies/api/client/render/modeltype/ISimpleModelType.java old mode 100644 new mode 100755 index 43910b4cdbd..07d6df0cd34 --- a/src/api/java/com/minecolonies/api/client/render/modeltype/ISimpleModelType.java +++ b/src/api/java/com/minecolonies/api/client/render/modeltype/ISimpleModelType.java @@ -2,7 +2,6 @@ import com.minecolonies.api.entity.citizen.AbstractEntityCitizen; import com.minecolonies.api.util.constant.Constants; - import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.NotNull; @@ -10,7 +9,8 @@ import static com.minecolonies.api.entity.citizen.AbstractEntityCitizen.DATA_STYLE; import static com.minecolonies.api.entity.citizen.AbstractEntityCitizen.DATA_TEXTURE_SUFFIX; -public interface ISimpleModelType extends IModelType { +public interface ISimpleModelType extends IModelType +{ /** * Base folder for textures. @@ -21,10 +21,9 @@ public interface ISimpleModelType extends IModelType { * Default folder. */ String DEFAULT_FOLDER = "default/"; - + /** - * The base name of the texture. - * Is by default appended by a random textureId as well as the render info. + * The base name of the texture. Is by default appended by a random textureId as well as the render info. * * @return The base file name. */ @@ -38,8 +37,8 @@ public interface ISimpleModelType extends IModelType { int getNumTextures(); /** - * Method used to get the path to the texture every time it is updated on the entity. - * By default this uses the textureBase + sex marker + randomly assigned texture index + metadata as a format. + * Method used to get the path to the texture every time it is updated on the entity. By default this uses the textureBase + sex marker + randomly assigned texture index + + * metadata as a format. * * @param entityCitizen The citizen in question to get the path. * @return The path to the citizen. @@ -48,7 +47,9 @@ default ResourceLocation getTexture(@NotNull final AbstractEntityCitizen entityC { String folder = DEFAULT_FOLDER; final int moddedTextureId = (entityCitizen.getTextureId() % getNumTextures()) + 1; - final String textureIdentifier = getTextureBase() + (entityCitizen.isFemale() ? "female" : "male") + moddedTextureId + entityCitizen.getRenderMetadata() + entityCitizen.getDataManager().get(DATA_TEXTURE_SUFFIX); + final String textureIdentifier = + getTextureBase() + (entityCitizen.isFemale() ? "female" : "male") + moddedTextureId + entityCitizen.getRenderMetadata() + entityCitizen.getDataManager() + .get(DATA_TEXTURE_SUFFIX); //TODO: We have to add style tags to the townhalls that will be used for this in the future. // - This will then become a switch case statement for this sake diff --git a/src/api/java/com/minecolonies/api/client/render/modeltype/NorsemenModel.java b/src/api/java/com/minecolonies/api/client/render/modeltype/NorsemenModel.java old mode 100644 new mode 100755 index 53ca52112f4..5dd3ef567ed --- a/src/api/java/com/minecolonies/api/client/render/modeltype/NorsemenModel.java +++ b/src/api/java/com/minecolonies/api/client/render/modeltype/NorsemenModel.java @@ -10,6 +10,7 @@ public class NorsemenModel extends BipedModel { /** * Create a model of a specific size. + * * @param size the size. */ public NorsemenModel(final float size) diff --git a/src/api/java/com/minecolonies/api/client/render/modeltype/registry/IModelTypeRegistry.java b/src/api/java/com/minecolonies/api/client/render/modeltype/registry/IModelTypeRegistry.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/ColonyProgressType.java b/src/api/java/com/minecolonies/api/colony/ColonyProgressType.java old mode 100644 new mode 100755 index 6f08d9b0418..b0123bc8d02 --- a/src/api/java/com/minecolonies/api/colony/ColonyProgressType.java +++ b/src/api/java/com/minecolonies/api/colony/ColonyProgressType.java @@ -25,5 +25,4 @@ public enum ColonyProgressType TEN_CITIZENS_SPAWNED, TWENTY_BUILDING_LEVELS, NOT_ENOUGH_JOBS; - } \ No newline at end of file diff --git a/src/api/java/com/minecolonies/coremod/colony/ColonyState.java b/src/api/java/com/minecolonies/api/colony/ColonyState.java similarity index 91% rename from src/api/java/com/minecolonies/coremod/colony/ColonyState.java rename to src/api/java/com/minecolonies/api/colony/ColonyState.java index 0b0ec57aaf8..db3543788d4 100644 --- a/src/api/java/com/minecolonies/coremod/colony/ColonyState.java +++ b/src/api/java/com/minecolonies/api/colony/ColonyState.java @@ -1,4 +1,4 @@ -package com.minecolonies.coremod.colony; +package com.minecolonies.api.colony; import com.minecolonies.api.entity.ai.statemachine.states.IAIState; diff --git a/src/api/java/com/minecolonies/api/colony/CompactColonyReference.java b/src/api/java/com/minecolonies/api/colony/CompactColonyReference.java old mode 100644 new mode 100755 index 3691762d985..30a7ed6db5a --- a/src/api/java/com/minecolonies/api/colony/CompactColonyReference.java +++ b/src/api/java/com/minecolonies/api/colony/CompactColonyReference.java @@ -10,22 +10,22 @@ public class CompactColonyReference /** * The name of the colony. */ - public final String name; + public final String name; /** * The position of the colony. */ - public final BlockPos center; + public final BlockPos center; /** * The id of the colony. */ - public final int id; + public final int id; /** * If it has a townhall or not. */ - public final boolean hasTownHall; + public final boolean hasTownHall; /** * The dimension the colony is in. @@ -34,11 +34,12 @@ public class CompactColonyReference /** * Create a new compact colony object. - * @param name the name of the colony. - * @param center the center. - * @param id the id. + * + * @param name the name of the colony. + * @param center the center. + * @param id the id. * @param hasTownHall if it has a town hall. - * @param dimension the dimension it is in. + * @param dimension the dimension it is in. */ public CompactColonyReference(final String name, final BlockPos center, final int id, final boolean hasTownHall, final int dimension) { diff --git a/src/api/java/com/minecolonies/api/colony/IChunkmanagerCapability.java b/src/api/java/com/minecolonies/api/colony/IChunkmanagerCapability.java old mode 100644 new mode 100755 index d93c1725621..b8e3253d50b --- a/src/api/java/com/minecolonies/api/colony/IChunkmanagerCapability.java +++ b/src/api/java/com/minecolonies/api/colony/IChunkmanagerCapability.java @@ -18,13 +18,13 @@ import static com.minecolonies.api.util.constant.NbtTagConstants.*; /** - * * Capability for the colony tag for chunks */ public interface IChunkmanagerCapability { /** * Get the chunkStorage at a certain location. + * * @param chunkX the x chunk location. * @param chunkZ the z chunk location. * @return the storage or null. @@ -34,8 +34,9 @@ public interface IChunkmanagerCapability /** * Add a new chunkStorage. - * @param chunkX chunkX the x chunk location. - * @param chunkZ chunkX the z chunk location. + * + * @param chunkX chunkX the x chunk location. + * @param chunkZ chunkX the z chunk location. * @param storage the new to add or update. * @return true if override else false. */ @@ -43,6 +44,7 @@ public interface IChunkmanagerCapability /** * Get all chunk storages for serialization. + * * @return the storages. */ Map getAllChunkStorages(); @@ -80,7 +82,6 @@ public boolean addChunkStorage(final int chunkX, final int chunkZ, final ChunkLo } } - @Override public Map getAllChunkStorages() { @@ -97,15 +98,17 @@ class Storage implements Capability.IStorage public INBT writeNBT(@NotNull final Capability capability, @NotNull final IChunkmanagerCapability instance, @Nullable final Direction side) { final CompoundNBT compound = new CompoundNBT(); - compound.put(TAG_ALL_CHUNK_STORAGES, instance.getAllChunkStorages().entrySet().stream().map(entry -> write(entry.getKey(), entry.getValue())).collect(NBTUtils.toListNBT())); + compound.put(TAG_ALL_CHUNK_STORAGES, + instance.getAllChunkStorages().entrySet().stream().map(entry -> write(entry.getKey(), entry.getValue())).collect(NBTUtils.toListNBT())); return compound; } @Override - public void readNBT(@NotNull final Capability capability, @NotNull final IChunkmanagerCapability instance, + public void readNBT( + @NotNull final Capability capability, @NotNull final IChunkmanagerCapability instance, @Nullable final Direction side, @NotNull final INBT nbt) { - if(nbt instanceof CompoundNBT && ((CompoundNBT) nbt).keySet().contains(TAG_ALL_CHUNK_STORAGES)) + if (nbt instanceof CompoundNBT && ((CompoundNBT) nbt).keySet().contains(TAG_ALL_CHUNK_STORAGES)) { NBTUtils.streamCompound(((CompoundNBT) nbt).getList(TAG_ALL_CHUNK_STORAGES, Constants.NBT.TAG_COMPOUND)) .map(Storage::read).forEach(key -> instance.addChunkStorage(key.getA().x, key.getA().z, key.getB())); @@ -114,7 +117,8 @@ public void readNBT(@NotNull final Capability capabilit /** * Write a single ChunkPos, ChunkLoadStorage pair to nbt. - * @param key the key. + * + * @param key the key. * @param value the value * @return the resulting compound. */ @@ -129,6 +133,7 @@ private static CompoundNBT write(final ChunkPos key, final ChunkLoadStorage valu /** * Read a key value pair for the chunkloadstorages. + * * @param compound the compound to read it from. * @return a tuple for both. */ @@ -137,7 +142,7 @@ private static Tuple read(final CompoundNBT compound final ChunkLoadStorage storage = new ChunkLoadStorage(compound.getCompound(TAG_CHUNK_STORAGE)); final int x = compound.getInt(TAG_X); final int z = compound.getInt(TAG_Z); - return new Tuple<>(new ChunkPos(x,z), storage); + return new Tuple<>(new ChunkPos(x, z), storage); } } } diff --git a/src/api/java/com/minecolonies/api/colony/ICitizen.java b/src/api/java/com/minecolonies/api/colony/ICitizen.java old mode 100644 new mode 100755 index ef7bf8da9c4..8bcf2f09af2 --- a/src/api/java/com/minecolonies/api/colony/ICitizen.java +++ b/src/api/java/com/minecolonies/api/colony/ICitizen.java @@ -44,12 +44,14 @@ public interface ICitizen /** * Get the inventory of the citizen. + * * @return the inventory of the citizen. */ InventoryCitizen getInventory(); /** * Check if the citizen is paused. + * * @param p true if paused, else false. */ void setPaused(boolean p); diff --git a/src/api/java/com/minecolonies/api/colony/ICitizenData.java b/src/api/java/com/minecolonies/api/colony/ICitizenData.java old mode 100644 new mode 100755 index 642ada1d52e..cb7d18ebcee --- a/src/api/java/com/minecolonies/api/colony/ICitizenData.java +++ b/src/api/java/com/minecolonies/api/colony/ICitizenData.java @@ -29,8 +29,7 @@ public interface ICitizenData extends ICitizen, INBTSerializable int MAX_SATURATION = 10; /** - * Return the entity instance of the citizen data. Respawn the citizen if - * needed. + * Return the entity instance of the citizen data. Respawn the citizen if needed. * * @return {@link AbstractEntityCitizen} of the citizen data. */ @@ -93,9 +92,7 @@ public interface ICitizenData extends ICitizen, INBTSerializable void clearDirty(); /** - * When a building is destroyed, inform the citizen so it can do any cleanup - * of associations that the building's. own IBuilding.onDestroyed did - * not do. + * When a building is destroyed, inform the citizen so it can do any cleanup of associations that the building's. own IBuilding.onDestroyed did not do. * * @param building building that is destroyed. */ @@ -272,18 +269,21 @@ public interface ICitizenData extends ICitizen, INBTSerializable /** * Get the citizen skill handler. + * * @return the handler. */ ICitizenSkillHandler getCitizenSkillHandler(); /** * Schedule restart and cleanup. + * * @param player the player scheduling it. */ void scheduleRestart(ServerPlayerEntity player); /** * AI will be restarted, also restart building etc + * * @return true if so. */ boolean shouldRestart(); @@ -302,21 +302,24 @@ public interface ICitizenData extends ICitizen, INBTSerializable /** * Check if the citizen just ate. + * * @return true if so. */ boolean justAte(); /** * Set or reset if the citizen just ate. + * * @param justAte true if justAte, false to reset. */ void setJustAte(boolean justAte); /** * Trigger the response on the server side. - * @param key the key of the component. + * + * @param key the key of the component. * @param response the triggered response. - * @param world the world it was triggered in. + * @param world the world it was triggered in. */ void onResponseTriggered(@NotNull final ITextComponent key, @NotNull final ITextComponent response, final World world); @@ -327,37 +330,42 @@ public interface ICitizenData extends ICitizen, INBTSerializable /** * Trigger a possible interaction. + * * @param handler the new handler. */ void triggerInteraction(@NotNull final IInteractionResponseHandler handler); /** - * Get the clean job modifier. - * Primary skill + secondary divided by 4. + * Get the clean job modifier. Primary skill + secondary divided by 4. + * * @return the int modifier. */ int getJobModifier(); /** * If is idle at job. + * * @return true if so. */ boolean isIdleAtJob(); /** * Set idle at job. + * * @param idle true if so. */ void setIdleAtJob(final boolean idle); /** * Get the texture suffix. + * * @return the suffix. */ String getTextureSuffix(); /** * Set the suffix for a citizen. + * * @param suffix the suffix to set. */ void setSuffix(String suffix); diff --git a/src/api/java/com/minecolonies/api/colony/ICitizenDataManager.java b/src/api/java/com/minecolonies/api/colony/ICitizenDataManager.java old mode 100644 new mode 100755 index 32315acfa3f..23aa259510b --- a/src/api/java/com/minecolonies/api/colony/ICitizenDataManager.java +++ b/src/api/java/com/minecolonies/api/colony/ICitizenDataManager.java @@ -20,7 +20,7 @@ static ICitizenDataManager getInstance() * Creates a citizen data instance from the stored nbt. * * @param compound The nbt data to create an instance from. - * @param colony The colony to create an instance in. + * @param colony The colony to create an instance in. * @return The citizen data, loaded from the nbt into the colony. */ ICitizenData createFromNBT(@NotNull CompoundNBT compound, IColony colony); @@ -28,9 +28,9 @@ static ICitizenDataManager getInstance() /** * Creates a citizen data view from a given network buffer, containing the views data. * - * @param id the id of the citizen. + * @param id the id of the citizen. * @param networkBuffer The network buffer to read from. - * @param colonyView the colony the citizen belongs to. + * @param colonyView the colony the citizen belongs to. * @return The citizen data view. */ ICitizenDataView createFromNetworkData(@NotNull final int id, @NotNull final PacketBuffer networkBuffer, final IColonyView colonyView); diff --git a/src/api/java/com/minecolonies/api/colony/ICitizenDataView.java b/src/api/java/com/minecolonies/api/colony/ICitizenDataView.java old mode 100644 new mode 100755 index fc7de834aa7..d5560f6fe7e --- a/src/api/java/com/minecolonies/api/colony/ICitizenDataView.java +++ b/src/api/java/com/minecolonies/api/colony/ICitizenDataView.java @@ -45,6 +45,7 @@ public interface ICitizenDataView extends ICitizen /** * DEPRECATED + * * @param bp the position. */ void setWorkBuilding(BlockPos bp); @@ -73,8 +74,7 @@ public interface ICitizenDataView extends ICitizen /** * Deserialize the attributes and variables from transition. * - * @param buf - * Byte buffer to deserialize. + * @param buf Byte buffer to deserialize. */ void deserialize(@NotNull PacketBuffer buf); @@ -90,12 +90,14 @@ public interface ICitizenDataView extends ICitizen /** * Get the list of ordered interactions. + * * @return the list. */ List getOrderedInteractions(); /** * Get a specific interaction by key. + * * @param component the key. * @return the interaction or null. */ @@ -104,24 +106,28 @@ public interface ICitizenDataView extends ICitizen /** * Check if the citizen has important interactions. + * * @return true if so. */ boolean hasBlockingInteractions(); /** * Check if the citizen has any interactions. + * * @return true if so. */ boolean hasPendingInteractions(); /** * Get an instance of the skill handler. + * * @return the instance. */ ICitizenSkillHandler getCitizenSkillHandler(); /** * The citizen happiness handler. + * * @return the handler. */ ICitizenHappinessHandler getHappinessHandler(); diff --git a/src/api/java/com/minecolonies/api/colony/IColony.java b/src/api/java/com/minecolonies/api/colony/IColony.java old mode 100644 new mode 100755 index 214e899ec99..9d9296ee9ac --- a/src/api/java/com/minecolonies/api/colony/IColony.java +++ b/src/api/java/com/minecolonies/api/colony/IColony.java @@ -8,7 +8,6 @@ import com.minecolonies.api.colony.workorders.IWorkManager; import com.minecolonies.api.entity.citizen.AbstractEntityCitizen; import com.minecolonies.api.research.IResearchManager; -import com.minecolonies.coremod.colony.ColonyState; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; @@ -29,8 +28,7 @@ import static com.minecolonies.api.util.constant.ColonyConstants.TEAM_COLONY_NAME; /** - * Interface of the Colony and ColonyView which will have to implement the - * following methods. + * Interface of the Colony and ColonyView which will have to implement the following methods. */ public interface IColony { @@ -70,8 +68,7 @@ public interface IColony IPermissions getPermissions(); /** - * Determine if a given chunk coordinate is considered to be within the - * colony's bounds. + * Determine if a given chunk coordinate is considered to be within the colony's bounds. * * @param w World to check. * @param pos Block Position. @@ -140,8 +137,7 @@ default String getTeamName() World getWorld(); /** - * Get the current {@link IRequestManager} for this Colony. - * Returns null if the current Colony does not support the request system. + * Get the current {@link IRequestManager} for this Colony. Returns null if the current Colony does not support the request system. * * @return the {@link IRequestManager} for this colony, null if not supported. */ @@ -375,6 +371,7 @@ default List getWayPoints(@NotNull BlockPos position, @NotNull BlockPo /** * Is the colony active currently. + * * @return true if so. */ boolean isActive(); diff --git a/src/api/java/com/minecolonies/api/colony/IColonyManager.java b/src/api/java/com/minecolonies/api/colony/IColonyManager.java old mode 100644 new mode 100755 index 8687e5037c1..d792972ce35 --- a/src/api/java/com/minecolonies/api/colony/IColonyManager.java +++ b/src/api/java/com/minecolonies/api/colony/IColonyManager.java @@ -154,9 +154,7 @@ static IColonyManager getInstance() IBuildingView getBuildingView(int dimension, BlockPos pos); /** - * Side neutral method to get colony. - * On clients it returns the view. - * On servers it returns the colony itself. + * Side neutral method to get colony. On clients it returns the view. On servers it returns the colony itself. * * @param w World. * @param pos coordinates. @@ -166,15 +164,11 @@ static IColonyManager getInstance() IColony getIColony(@NotNull World w, @NotNull BlockPos pos); /** - * Side neutral method to get colony. - * On clients it returns the view. - * On servers it returns the colony itself. - * {@link #getClosestColony(World, BlockPos)} + * Side neutral method to get colony. On clients it returns the view. On servers it returns the colony itself. {@link #getClosestColony(World, BlockPos)} * * @param w World. * @param pos Block position. - * @return View of colony or colony itself depending on side, closest to - * coordinates. + * @return View of colony or colony itself depending on side, closest to coordinates. */ @Nullable IColony getClosestIColony(@NotNull World w, @NotNull BlockPos pos); @@ -199,9 +193,7 @@ static IColonyManager getInstance() IColony getClosestColony(@NotNull World w, @NotNull BlockPos pos); /** - * Side neutral method to get colony. - * On clients it returns the view. - * On servers it returns the colony itself. + * Side neutral method to get colony. On clients it returns the view. On servers it returns the colony itself. *

* Returns a colony or view with the given Player as owner. * @@ -213,9 +205,7 @@ static IColonyManager getInstance() IColony getIColonyByOwner(@NotNull World w, @NotNull PlayerEntity owner); /** - * Side neutral method to get colony. - * On clients it returns the view. - * On servers it returns the colony itself. + * Side neutral method to get colony. On clients it returns the view. On servers it returns the colony itself. *

* Returns a colony or view with given Player as owner. * @@ -227,16 +217,14 @@ static IColonyManager getInstance() IColony getIColonyByOwner(@NotNull World w, UUID owner); /** - * Returns the minimum distance between two town halls, to not make colonies - * collide. + * Returns the minimum distance between two town halls, to not make colonies collide. * * @return Minimum town hall distance. */ int getMinimumDistanceBetweenTownHalls(); /** - * On server tick, tick every Colony. - * NOTE: Review this for performance. + * On server tick, tick every Colony. NOTE: Review this for performance. * * @param event {@link net.minecraftforge.event.TickEvent.ServerTickEvent} */ @@ -264,16 +252,14 @@ static IColonyManager getInstance() void onClientTick(@NotNull TickEvent.ClientTickEvent event); /** - * On world tick, tick every Colony in that world. - * NOTE: Review this for performance. + * On world tick, tick every Colony in that world. NOTE: Review this for performance. * * @param event {@link TickEvent.WorldTickEvent}. */ void onWorldTick(@NotNull TickEvent.WorldTickEvent event); /** - * When a world is loaded, Colonies in that world need to grab the reference - * to the World. Additionally, when loading the first world, load the manager data. + * When a world is loaded, Colonies in that world need to grab the reference to the World. Additionally, when loading the first world, load the manager data. * * @param world World. */ @@ -294,8 +280,7 @@ static IColonyManager getInstance() void setServerUUID(UUID uuid); /** - * When a world unloads, all colonies in that world are informed. - * Additionally, when the last world is unloaded, delete all colonies. + * When a world unloads, all colonies in that world are informed. Additionally, when the last world is unloaded, delete all colonies. * * @param world World. */ @@ -322,9 +307,8 @@ static IColonyManager getInstance() IColonyView getColonyView(int id, int dimension); /** - * Returns result of {@link IColonyView#handlePermissionsViewMessage(PacketBuffer)} - * if {@link #getColonyView(int, int)}. gives a not-null result. If {@link - * #getColonyView(int, int)} is null, returns null. + * Returns result of {@link IColonyView#handlePermissionsViewMessage(PacketBuffer)} if {@link #getColonyView(int, int)}. gives a not-null result. If {@link #getColonyView(int, + * int)} is null, returns null. * * @param colonyID ID of the colony. * @param data {@link PacketBuffer} with colony data. @@ -333,9 +317,8 @@ static IColonyManager getInstance() void handlePermissionsViewMessage(int colonyID, @NotNull PacketBuffer data, int dim); /** - * Returns result of {@link IColonyView#handleColonyViewCitizensMessage(int, - * PacketBuffer)} if {@link #getColonyView(int, int)} gives a not-null result. If - * {@link #getColonyView(int, int)} is null, returns null. + * Returns result of {@link IColonyView#handleColonyViewCitizensMessage(int, PacketBuffer)} if {@link #getColonyView(int, int)} gives a not-null result. If {@link + * #getColonyView(int, int)} is null, returns null. * * @param colonyId ID of the colony. * @param citizenId ID of the citizen. @@ -345,9 +328,8 @@ static IColonyManager getInstance() void handleColonyViewCitizensMessage(int colonyId, int citizenId, PacketBuffer buf, int dim); /** - * Returns result of {@link IColonyView#handleColonyViewWorkOrderMessage(PacketBuffer)} - * (int, ByteBuf)} if {@link #getColonyView(int, int)} gives a not-null result. - * If {@link #getColonyView(int, int)} is null, returns null. + * Returns result of {@link IColonyView#handleColonyViewWorkOrderMessage(PacketBuffer)} (int, ByteBuf)} if {@link #getColonyView(int, int)} gives a not-null result. If {@link + * #getColonyView(int, int)} is null, returns null. * * @param colonyId ID of the colony. * @param buf {@link PacketBuffer} with colony data. @@ -356,9 +338,8 @@ static IColonyManager getInstance() void handleColonyViewWorkOrderMessage(int colonyId, PacketBuffer buf, int dim); /** - * Returns result of {@link IColonyView#handleColonyViewRemoveCitizenMessage(int)} - * if {@link #getColonyView(int, int)} gives a not-null result. If {@link - * #getColonyView(int, int)} is null, returns null. + * Returns result of {@link IColonyView#handleColonyViewRemoveCitizenMessage(int)} if {@link #getColonyView(int, int)} gives a not-null result. If {@link #getColonyView(int, + * int)} is null, returns null. * * @param colonyId ID of the colony. * @param citizenId ID of the citizen. @@ -367,9 +348,8 @@ static IColonyManager getInstance() void handleColonyViewRemoveCitizenMessage(int colonyId, int citizenId, int dim); /** - * Returns result of {@link IColonyView#handleColonyBuildingViewMessage(BlockPos, - * PacketBuffer)} if {@link #getColonyView(int, int)} gives a not-null result. If - * {@link #getColonyView(int, int)} is null, returns null. + * Returns result of {@link IColonyView#handleColonyBuildingViewMessage(BlockPos, PacketBuffer)} if {@link #getColonyView(int, int)} gives a not-null result. If {@link + * #getColonyView(int, int)} is null, returns null. * * @param colonyId ID of the colony. * @param buildingId ID of the building. @@ -379,8 +359,7 @@ static IColonyManager getInstance() void handleColonyBuildingViewMessage(int colonyId, BlockPos buildingId, @NotNull PacketBuffer buf, int dim); /** - * Returns result of {@link IColonyView#handleColonyViewRemoveBuildingMessage(BlockPos)} - * if {@link #getColonyView(int, int)} gives a not-null result. If {@link + * Returns result of {@link IColonyView#handleColonyViewRemoveBuildingMessage(BlockPos)} if {@link #getColonyView(int, int)} gives a not-null result. If {@link * #getColonyView(int, int)} is null, returns null. * * @param colonyId ID of the colony. @@ -390,9 +369,8 @@ static IColonyManager getInstance() void handleColonyViewRemoveBuildingMessage(int colonyId, BlockPos buildingId, int dim); /** - * Returns result of {@link IColonyView#handleColonyViewRemoveWorkOrderMessage(int)} - * if {@link #getColonyView(int, int)} gives a not-null result. If {@link - * #getColonyView(int, int)} is null, returns null. + * Returns result of {@link IColonyView#handleColonyViewRemoveWorkOrderMessage(int)} if {@link #getColonyView(int, int)} gives a not-null result. If {@link #getColonyView(int, + * int)} is null, returns null. * * @param colonyId ID of the colony. * @param workOrderId ID of the workOrder. diff --git a/src/api/java/com/minecolonies/api/colony/IColonyRelated.java b/src/api/java/com/minecolonies/api/colony/IColonyRelated.java old mode 100644 new mode 100755 index 66fa819bef9..dc8dfd324dd --- a/src/api/java/com/minecolonies/api/colony/IColonyRelated.java +++ b/src/api/java/com/minecolonies/api/colony/IColonyRelated.java @@ -12,6 +12,7 @@ public interface IColonyRelated /** * Gets the colony this entity belongs to + * * @return the colony. */ IColony getColony(); diff --git a/src/api/java/com/minecolonies/api/colony/IColonyTagCapability.java b/src/api/java/com/minecolonies/api/colony/IColonyTagCapability.java old mode 100644 new mode 100755 index 74e82c5ac28..6a037578364 --- a/src/api/java/com/minecolonies/api/colony/IColonyTagCapability.java +++ b/src/api/java/com/minecolonies/api/colony/IColonyTagCapability.java @@ -17,22 +17,23 @@ import static com.minecolonies.api.util.constant.NbtTagConstants.*; /** - * * Capability for the colony tag for chunks */ public interface IColonyTagCapability { /** * Remove a colony from the list. Only relevant in non dynamic claiming. + * * @param chunk the chunk to remove it from. - * @param id the id to remove. + * @param id the id to remove. */ void removeColony(final int id, final Chunk chunk); /** * Add a new colony to the chunk. Only relevant in non dynamic claiming. + * * @param chunk the chunk to add it to. - * @param id the id to add. + * @param id the id to add. */ void addColony(final int id, final Chunk chunk); @@ -46,8 +47,9 @@ public interface IColonyTagCapability /** * Set the owning colony. + * * @param chunk the chunk to set it for. - * @param id the id to set. + * @param id the id to set. */ void setOwningColony(final int id, final Chunk chunk); @@ -60,6 +62,7 @@ public interface IColonyTagCapability /** * Reset the capability. + * * @param chunk the chunk to reset. */ void reset(final Chunk chunk); @@ -69,7 +72,7 @@ public interface IColonyTagCapability * * @param colonyId the colony id. * @param pos the position of the building. - * @param chunk the chunk to add the claim for. + * @param chunk the chunk to add the claim for. */ void addBuildingClaim(final int colonyId, final BlockPos pos, final Chunk chunk); diff --git a/src/api/java/com/minecolonies/api/colony/IColonyView.java b/src/api/java/com/minecolonies/api/colony/IColonyView.java old mode 100644 new mode 100755 index 18ce1f826d3..7732239e6ac --- a/src/api/java/com/minecolonies/api/colony/IColonyView.java +++ b/src/api/java/com/minecolonies/api/colony/IColonyView.java @@ -127,30 +127,25 @@ public interface IColonyView extends IColony ITownHallView getTownHall(); /** - * Get a AbstractBuilding.View for a given building (by coordinate-id) using - * raw x,y,z. + * Get a AbstractBuilding.View for a given building (by coordinate-id) using raw x,y,z. * * @param x x-coordinate. * @param y y-coordinate. * @param z z-coordinate. - * @return {@link IBuildingView} of a AbstractBuilding for the given - * Coordinates/ID, or null. + * @return {@link IBuildingView} of a AbstractBuilding for the given Coordinates/ID, or null. */ IBuildingView getBuilding(int x, int y, int z); /** - * Get a AbstractBuilding.View for a given building (by coordinate-id) using - * ChunkCoordinates. + * Get a AbstractBuilding.View for a given building (by coordinate-id) using ChunkCoordinates. * * @param buildingId Coordinates/ID of the AbstractBuilding. - * @return {@link IBuildingView} of a AbstractBuilding for the given - * Coordinates/ID, or null. + * @return {@link IBuildingView} of a AbstractBuilding for the given Coordinates/ID, or null. */ IBuildingView getBuilding(BlockPos buildingId); /** - * Returns a map of players in the colony. Key is the UUID, value is {@link - * Player} + * Returns a map of players in the colony. Key is the UUID, value is {@link Player} * * @return Map of UUID's and {@link Player} */ @@ -158,8 +153,7 @@ public interface IColonyView extends IColony Map getPlayers(); /** - * Sets a specific permission to a rank. If the permission wasn't already - * set, it sends a message to the server. + * Sets a specific permission to a rank. If the permission wasn't already set, it sends a message to the server. * * @param rank Rank to get the permission. * @param action Permission to get. @@ -167,8 +161,7 @@ public interface IColonyView extends IColony void setPermission(Rank rank, @NotNull Action action); /** - * removes a specific permission to a rank. If the permission was set, it - * sends a message to the server. + * removes a specific permission to a rank. If the permission was set, it sends a message to the server. * * @param rank Rank to remove permission from. * @param action Action to remove permission of. @@ -240,9 +233,7 @@ public interface IColonyView extends IColony IMessage handlePermissionsViewMessage(@NotNull PacketBuffer buf); /** - * Update a ColonyView's workOrders given a network data ColonyView update - * packet. This uses a full-replacement - workOrders do not get updated and - * are instead overwritten. + * Update a ColonyView's workOrders given a network data ColonyView update packet. This uses a full-replacement - workOrders do not get updated and are instead overwritten. * * @param buf Network data. * @return null == no response. @@ -251,9 +242,7 @@ public interface IColonyView extends IColony IMessage handleColonyViewWorkOrderMessage(PacketBuffer buf); /** - * Update a ColonyView's citizens given a network data ColonyView update - * packet. This uses a full-replacement - citizens do not get updated and - * are instead overwritten. + * Update a ColonyView's citizens given a network data ColonyView update packet. This uses a full-replacement - citizens do not get updated and are instead overwritten. * * @param id ID of the citizen. * @param buf Network data. @@ -290,9 +279,7 @@ public interface IColonyView extends IColony IMessage handleColonyViewRemoveWorkOrderMessage(int workOrderId); /** - * Update a ColonyView's buildings given a network data ColonyView update - * packet. This uses a full-replacement - buildings do not get updated and - * are instead overwritten. + * Update a ColonyView's buildings given a network data ColonyView update packet. This uses a full-replacement - buildings do not get updated and are instead overwritten. * * @param buildingId location of the building. * @param buf buffer containing ColonyBuilding information. diff --git a/src/api/java/com/minecolonies/api/colony/buildings/HiringMode.java b/src/api/java/com/minecolonies/api/colony/buildings/HiringMode.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/buildings/IBuilding.java b/src/api/java/com/minecolonies/api/colony/buildings/IBuilding.java old mode 100644 new mode 100755 index 851bdde9f39..5d564f75e4e --- a/src/api/java/com/minecolonies/api/colony/buildings/IBuilding.java +++ b/src/api/java/com/minecolonies/api/colony/buildings/IBuilding.java @@ -28,7 +28,7 @@ import java.util.Optional; import java.util.function.Predicate; -import static com.minecolonies.api.util.constant.Suppression.*; +import static com.minecolonies.api.util.constant.Suppression.GENERIC_WILDCARD; public interface IBuilding extends IBuildingContainer, IRequestResolverProvider, IRequester { @@ -46,16 +46,14 @@ public interface IBuilding extends IBuildingContainer, IRequestResolverProvider, void onWakeUp(); /** - * Executed every time when citizen finish inventory cleanup called after citizen got paused. - * Use for cleaning a state only. + * Executed every time when citizen finish inventory cleanup called after citizen got paused. Use for cleaning a state only. * * @param citizen cleanup for citizen. */ void onCleanUp(ICitizenData citizen); /** - * Executed when RestartCitizenMessage is called and worker is paused. - * Use for reseting, onCleanUp is called before this + * Executed when RestartCitizenMessage is called and worker is paused. Use for reseting, onCleanUp is called before this * * @param citizen the citizen assigned to the building. */ @@ -96,8 +94,7 @@ default void onPlayerEnterBuilding(final PlayerEntity player) {} void onBuildingMove(final IBuilding oldBuilding); /** - * Destroys the block. - * Calls {@link #onDestroyed()}. + * Destroys the block. Calls {@link #onDestroyed()}. */ void destroy(); @@ -138,11 +135,7 @@ default void onPlayerEnterBuilding(final PlayerEntity player) {} int getClaimRadius(int buildingLevel); /** - * Serializes to view. - * Sends 3 integers. - * 1) hashcode of the name of the class. - * 2) building level. - * 3) max building level. + * Serializes to view. Sends 3 integers. 1) hashcode of the name of the class. 2) building level. 3) max building level. * * @param buf PacketBuffer to write to. */ @@ -198,16 +191,15 @@ default void onPlayerEnterBuilding(final PlayerEntity player) {} void deconstruct(); /** - * Called upon completion of an upgrade process. - * We suppress this warning since this parameter will be used in child classes which override this method. + * Called upon completion of an upgrade process. We suppress this warning since this parameter will be used in child classes which override this method. * * @param newLevel The new level. */ void onUpgradeComplete(int newLevel); /** - * Check if the worker requires a certain amount of that item and the alreadykept list contains it. - * Always leave one stack behind if the worker requires a certain amount of it. Just to be sure. + * Check if the worker requires a certain amount of that item and the alreadykept list contains it. Always leave one stack behind if the worker requires a certain amount of it. + * Just to be sure. * * @param stack the stack to check it with. * @param localAlreadyKept already kept items. @@ -217,9 +209,8 @@ default void onPlayerEnterBuilding(final PlayerEntity player) {} int buildingRequiresCertainAmountOfItem(ItemStack stack, List localAlreadyKept, boolean inventory); /** - * Override this method if you want to keep an amount of items in inventory. - * When the inventory is full, everything get's dumped into the building chest. - * But you can use this method to hold some stacks back. + * Override this method if you want to keep an amount of items in inventory. When the inventory is full, everything get's dumped into the building chest. But you can use this + * method to hold some stacks back. * * @return a list of objects which should be kept. */ @@ -289,8 +280,7 @@ ImmutableList> getCompletedRequestsOfTypeFiltered( /** * Overrule the next open request with a give stack. *

- * We squid:s135 which takes care that there are not too many continue statements in a loop since it makes sense here - * out of performance reasons. + * We squid:s135 which takes care that there are not too many continue statements in a loop since it makes sense here out of performance reasons. * * @param stack the stack. */ @@ -306,11 +296,8 @@ ImmutableList> getOpenRequestsOfTypeFiltered( boolean overruleNextOpenRequestOfCitizenWithStack(@NotNull ICitizenData citizenData, @NotNull ItemStack stack); /** - * Creates a pickup request for the building. - * It will make sure that only one pickup request exists per building, - * so it's safe to call multiple times. - * The call will return false if a pickup request already exists, or if the priority is not within - * the proper range, or if the pickup priority is set to NEVER (0). + * Creates a pickup request for the building. It will make sure that only one pickup request exists per building, so it's safe to call multiple times. The call will return + * false if a pickup request already exists, or if the priority is not within the proper range, or if the pickup priority is set to NEVER (0). * * @param scaledPriority The priority of the pickup request. This value is considered already scaled! * @return true if a pickup request could be created, false if not. diff --git a/src/api/java/com/minecolonies/api/colony/buildings/IBuildingContainer.java b/src/api/java/com/minecolonies/api/colony/buildings/IBuildingContainer.java old mode 100644 new mode 100755 index 6b63b4f25f7..1b535d5f5de --- a/src/api/java/com/minecolonies/api/colony/buildings/IBuildingContainer.java +++ b/src/api/java/com/minecolonies/api/colony/buildings/IBuildingContainer.java @@ -59,8 +59,7 @@ public interface IBuildingContainer extends ICitizenAssignable, ICapabilityProvi List getAdditionalCountainers(); /** - * Register a blockState and position. - * We suppress this warning since this parameter will be used in child classes which override this method. + * Register a blockState and position. We suppress this warning since this parameter will be used in child classes which override this method. * * @param blockState to be registered * @param pos of the blockState @@ -69,8 +68,7 @@ public interface IBuildingContainer extends ICitizenAssignable, ICapabilityProvi void registerBlockPosition(@NotNull BlockState blockState, @NotNull BlockPos pos, @NotNull World world); /** - * Register a block and position. - * We suppress this warning since this parameter will be used in child classes which override this method. + * Register a block and position. We suppress this warning since this parameter will be used in child classes which override this method. * * @param block to be registered * @param pos of the block diff --git a/src/api/java/com/minecolonies/api/colony/buildings/IBuildingWorker.java b/src/api/java/com/minecolonies/api/colony/buildings/IBuildingWorker.java old mode 100644 new mode 100755 index 4316dc799d7..b080c10063a --- a/src/api/java/com/minecolonies/api/colony/buildings/IBuildingWorker.java +++ b/src/api/java/com/minecolonies/api/colony/buildings/IBuildingWorker.java @@ -112,9 +112,7 @@ public interface IBuildingWorker extends IBuilding void switchIndex(int i, int j); /** - * Check if a recipe can be added. - * This is only important for 3x3 crafting. - * Workers shall override this if necessary. + * Check if a recipe can be added. This is only important for 3x3 crafting. Workers shall override this if necessary. * * @param ignored the token of the recipe. * @return true if so. @@ -124,10 +122,9 @@ public interface IBuildingWorker extends IBuilding /** * Check if players can change the building's recipe list. *

- * This is the case for most current buildings, but some buildings might only work on built-in recipes. - * It's recommended to turn this off for buildings that make no use of player-thaught recipes, to avoid confusion for new players. - * Turning this on will hide the "Teach recipes" button, hide the remove-buttons in the recipe list, - * and also hide the recipe list altogether if no recipes are present. + * This is the case for most current buildings, but some buildings might only work on built-in recipes. It's recommended to turn this off for buildings that make no use of + * player-thaught recipes, to avoid confusion for new players. Turning this on will hide the "Teach recipes" button, hide the remove-buttons in the recipe list, and also hide + * the recipe list altogether if no recipes are present. *

* * @return true if player is allowed to alter recipes, false if not @@ -212,6 +209,7 @@ public interface IBuildingWorker extends IBuilding /** * Check if the worker is allowed to eat the following stack. + * * @param stack the stack to test. * @return true if so. */ diff --git a/src/api/java/com/minecolonies/api/colony/buildings/IBuildingWorkerView.java b/src/api/java/com/minecolonies/api/colony/buildings/IBuildingWorkerView.java old mode 100644 new mode 100755 index b876704856c..0ae9e1143ba --- a/src/api/java/com/minecolonies/api/colony/buildings/IBuildingWorkerView.java +++ b/src/api/java/com/minecolonies/api/colony/buildings/IBuildingWorkerView.java @@ -92,10 +92,9 @@ public interface IBuildingWorkerView extends IBuildingView /** * Check if players can change the building's recipe list. *

- * This is the case for most current buildings, but some buildings might only work on built-in recipes. - * It's recommended to turn this off for buildings that make no use of player-thaught recipes, to avoid confusion for new players. - * Turning this on will hide the "Teach recipes" button, hide the remove-buttons in the recipe list, - * and also hide the recipe list altogether if no recipes are present. + * This is the case for most current buildings, but some buildings might only work on built-in recipes. It's recommended to turn this off for buildings that make no use of + * player-thaught recipes, to avoid confusion for new players. Turning this on will hide the "Teach recipes" button, hide the remove-buttons in the recipe list, and also hide + * the recipe list altogether if no recipes are present. *

* * @return true if player is allowed to alter recipes, false if not diff --git a/src/api/java/com/minecolonies/api/colony/buildings/ICitizenAssignable.java b/src/api/java/com/minecolonies/api/colony/buildings/ICitizenAssignable.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/buildings/IGuardBuilding.java b/src/api/java/com/minecolonies/api/colony/buildings/IGuardBuilding.java old mode 100644 new mode 100755 index 88543644d85..df9d2e7b04d --- a/src/api/java/com/minecolonies/api/colony/buildings/IGuardBuilding.java +++ b/src/api/java/com/minecolonies/api/colony/buildings/IGuardBuilding.java @@ -16,8 +16,7 @@ public interface IGuardBuilding extends IBuildingWorker { /** - * Worker gets this distance times building level away from his/her hut to - * patrol. + * Worker gets this distance times building level away from his/her hut to patrol. */ int PATROL_DISTANCE = 30; diff --git a/src/api/java/com/minecolonies/api/colony/buildings/IRSComponent.java b/src/api/java/com/minecolonies/api/colony/buildings/IRSComponent.java old mode 100644 new mode 100755 index 388f63e7aa9..12f223423ee --- a/src/api/java/com/minecolonies/api/colony/buildings/IRSComponent.java +++ b/src/api/java/com/minecolonies/api/colony/buildings/IRSComponent.java @@ -2,7 +2,7 @@ /** * Empty interface that indicates the Building is actually just a single block. - * + *

* Originally intended for detecting Stash and Postbox instances */ public interface IRSComponent diff --git a/src/api/java/com/minecolonies/api/colony/buildings/ISchematicProvider.java b/src/api/java/com/minecolonies/api/colony/buildings/ISchematicProvider.java old mode 100644 new mode 100755 index c729d8aeff6..9874e1fd0c3 --- a/src/api/java/com/minecolonies/api/colony/buildings/ISchematicProvider.java +++ b/src/api/java/com/minecolonies/api/colony/buildings/ISchematicProvider.java @@ -142,6 +142,7 @@ public interface ISchematicProvider extends INBTSerializable /** * Check if the building was deconstructed. + * * @return true if so. */ boolean isDeconstructed(); diff --git a/src/api/java/com/minecolonies/api/colony/buildings/ModBuildings.java b/src/api/java/com/minecolonies/api/colony/buildings/ModBuildings.java old mode 100644 new mode 100755 index 3766a1498f4..0e050cbdcdf --- a/src/api/java/com/minecolonies/api/colony/buildings/ModBuildings.java +++ b/src/api/java/com/minecolonies/api/colony/buildings/ModBuildings.java @@ -5,97 +5,97 @@ public final class ModBuildings { - public static final String ARCHERY_ID = "archery"; - public static final String BAKERY_ID = "baker"; - public static final String BARRACKS_ID = "barracks"; - public static final String BARRACKS_TOWER_ID = "barrackstower"; - public static final String BLACKSMITH_ID = "blacksmith"; - public static final String BUILDER_ID = "builder"; - public static final String CHICKENHERDER_ID = "chickenherder"; - public static final String COMBAT_ACADEMY_ID = "combatacademy"; - public static final String COMPOSTER_ID = "composter"; - public static final String COOK_ID = "cook"; - public static final String COWBOY_ID = "cowboy"; - public static final String CRUSHER_ID = "crusher"; - public static final String DELIVERYMAN_ID = "deliveryman"; - public static final String FARMER_ID = "farmer"; - public static final String FISHERMAN_ID = "fisherman"; - public static final String GUARD_TOWER_ID = "guardtower"; - public static final String HOME_ID = "home"; - public static final String LIBRARY_ID = "library"; - public static final String LUMBERJACK_ID = "lumberjack"; - public static final String MINER_ID = "miner"; - public static final String SAWMILL_ID = "sawmill"; - public static final String SHEPHERD_ID = "shepherd"; - public static final String SIFTER_ID = "sifter"; - public static final String SMELTERY_ID = "smeltery"; - public static final String STONE_MASON_ID = "stonemason"; - public static final String STONE_SMELTERY_ID = "stonesmeltery"; - public static final String SWINE_HERDER_ID = "swineherder"; - public static final String TOWNHALL_ID = "townhall"; - public static final String WAREHOUSE_ID = "warehouse"; - public static final String POSTBOX_ID = "postbox"; - public static final String FLORIST_ID = "florist"; - public static final String ENCHANTER_ID = "enchanter"; - public static final String UNIVERSITY_ID = "university"; - public static final String HOSPITAL_ID = "hospital"; - public static final String STASH_ID = "stash"; - public static final String SCHOOL_ID = "school"; - public static final String GLASSBLOWER_ID = "glassblower"; - public static final String DYER_ID = "dyer"; - public static final String FLETCHER_ID = "fletcher"; - public static final String MECHANIC_ID = "mechanic"; - public static final String PLANTATION_ID = "plantation"; - public static final String TAVERN_ID = "tavern"; - public static final String CONCRETE_ID = "concretemixer"; - public static final String RABBIT_ID = "rabbithutch"; - public static final String BEEKEEPER_ID = "beekeeper"; + public static final String ARCHERY_ID = "archery"; + public static final String BAKERY_ID = "baker"; + public static final String BARRACKS_ID = "barracks"; + public static final String BARRACKS_TOWER_ID = "barrackstower"; + public static final String BLACKSMITH_ID = "blacksmith"; + public static final String BUILDER_ID = "builder"; + public static final String CHICKENHERDER_ID = "chickenherder"; + public static final String COMBAT_ACADEMY_ID = "combatacademy"; + public static final String COMPOSTER_ID = "composter"; + public static final String COOK_ID = "cook"; + public static final String COWBOY_ID = "cowboy"; + public static final String CRUSHER_ID = "crusher"; + public static final String DELIVERYMAN_ID = "deliveryman"; + public static final String FARMER_ID = "farmer"; + public static final String FISHERMAN_ID = "fisherman"; + public static final String GUARD_TOWER_ID = "guardtower"; + public static final String HOME_ID = "home"; + public static final String LIBRARY_ID = "library"; + public static final String LUMBERJACK_ID = "lumberjack"; + public static final String MINER_ID = "miner"; + public static final String SAWMILL_ID = "sawmill"; + public static final String SHEPHERD_ID = "shepherd"; + public static final String SIFTER_ID = "sifter"; + public static final String SMELTERY_ID = "smeltery"; + public static final String STONE_MASON_ID = "stonemason"; + public static final String STONE_SMELTERY_ID = "stonesmeltery"; + public static final String SWINE_HERDER_ID = "swineherder"; + public static final String TOWNHALL_ID = "townhall"; + public static final String WAREHOUSE_ID = "warehouse"; + public static final String POSTBOX_ID = "postbox"; + public static final String FLORIST_ID = "florist"; + public static final String ENCHANTER_ID = "enchanter"; + public static final String UNIVERSITY_ID = "university"; + public static final String HOSPITAL_ID = "hospital"; + public static final String STASH_ID = "stash"; + public static final String SCHOOL_ID = "school"; + public static final String GLASSBLOWER_ID = "glassblower"; + public static final String DYER_ID = "dyer"; + public static final String FLETCHER_ID = "fletcher"; + public static final String MECHANIC_ID = "mechanic"; + public static final String PLANTATION_ID = "plantation"; + public static final String TAVERN_ID = "tavern"; + public static final String CONCRETE_ID = "concretemixer"; + public static final String RABBIT_ID = "rabbithutch"; + public static final String BEEKEEPER_ID = "beekeeper"; - public static BuildingEntry archery; - public static BuildingEntry bakery; - public static BuildingEntry barracks; - public static BuildingEntry barracksTower; - public static BuildingEntry blacksmith; - public static BuildingEntry builder; - public static BuildingEntry chickenHerder; - public static BuildingEntry combatAcademy; - public static BuildingEntry composter; - public static BuildingEntry cook; - public static BuildingEntry cowboy; - public static BuildingEntry crusher; - public static BuildingEntry deliveryman; - public static BuildingEntry farmer; - public static BuildingEntry fisherman; - public static BuildingEntry guardTower; - public static BuildingEntry home; - public static BuildingEntry library; - public static BuildingEntry lumberjack; - public static BuildingEntry miner; - public static BuildingEntry sawmill; - public static BuildingEntry shepherd; - public static BuildingEntry sifter; - public static BuildingEntry smeltery; - public static BuildingEntry stoneMason; - public static BuildingEntry stoneSmelter; - public static BuildingEntry swineHerder; - public static BuildingEntry townHall; - public static BuildingEntry wareHouse; - public static BuildingEntry postBox; - public static BuildingEntry florist; - public static BuildingEntry enchanter; - public static BuildingEntry university; - public static BuildingEntry hospital; - public static BuildingEntry stash; - public static BuildingEntry school; - public static BuildingEntry glassblower; - public static BuildingEntry dyer; - public static BuildingEntry fletcher; - public static BuildingEntry mechanic; - public static BuildingEntry plantation; - public static BuildingEntry tavern; - public static BuildingEntry concreteMixer; - public static BuildingEntry rabbitHutch; - public static BuildingEntry beekeeper; + public static BuildingEntry archery; + public static BuildingEntry bakery; + public static BuildingEntry barracks; + public static BuildingEntry barracksTower; + public static BuildingEntry blacksmith; + public static BuildingEntry builder; + public static BuildingEntry chickenHerder; + public static BuildingEntry combatAcademy; + public static BuildingEntry composter; + public static BuildingEntry cook; + public static BuildingEntry cowboy; + public static BuildingEntry crusher; + public static BuildingEntry deliveryman; + public static BuildingEntry farmer; + public static BuildingEntry fisherman; + public static BuildingEntry guardTower; + public static BuildingEntry home; + public static BuildingEntry library; + public static BuildingEntry lumberjack; + public static BuildingEntry miner; + public static BuildingEntry sawmill; + public static BuildingEntry shepherd; + public static BuildingEntry sifter; + public static BuildingEntry smeltery; + public static BuildingEntry stoneMason; + public static BuildingEntry stoneSmelter; + public static BuildingEntry swineHerder; + public static BuildingEntry townHall; + public static BuildingEntry wareHouse; + public static BuildingEntry postBox; + public static BuildingEntry florist; + public static BuildingEntry enchanter; + public static BuildingEntry university; + public static BuildingEntry hospital; + public static BuildingEntry stash; + public static BuildingEntry school; + public static BuildingEntry glassblower; + public static BuildingEntry dyer; + public static BuildingEntry fletcher; + public static BuildingEntry mechanic; + public static BuildingEntry plantation; + public static BuildingEntry tavern; + public static BuildingEntry concreteMixer; + public static BuildingEntry rabbitHutch; + public static BuildingEntry beekeeper; private ModBuildings() { diff --git a/src/api/java/com/minecolonies/api/colony/buildings/registry/BuildingEntry.java b/src/api/java/com/minecolonies/api/colony/buildings/registry/BuildingEntry.java old mode 100644 new mode 100755 index a1ed1394cbe..16723868532 --- a/src/api/java/com/minecolonies/api/colony/buildings/registry/BuildingEntry.java +++ b/src/api/java/com/minecolonies/api/colony/buildings/registry/BuildingEntry.java @@ -14,17 +14,16 @@ import java.util.function.Supplier; /** - * Entry for the {@link IBuilding} registry. - * Makes it possible to create a single registry for a {@link IBuilding}. - * Used to lookup how to create {@link IBuilding} and {@link IBuildingView}. - * Also links a given {@link IBuilding} to a given {@link AbstractBlockHut}. + * Entry for the {@link IBuilding} registry. Makes it possible to create a single registry for a {@link IBuilding}. Used to lookup how to create {@link IBuilding} and {@link + * IBuildingView}. Also links a given {@link IBuilding} to a given {@link AbstractBlockHut}. */ @SuppressWarnings("PMD.MissingStaticMethodInNonInstantiatableClass") //Use the builder to create one. public class BuildingEntry extends ForgeRegistryEntry { private final AbstractBlockHut buildingBlock; - private final BiFunction buildingProducer; + private final BiFunction buildingProducer; + /** * A builder class for {@link BuildingEntry}. */ diff --git a/src/api/java/com/minecolonies/api/colony/buildings/registry/IBuildingDataManager.java b/src/api/java/com/minecolonies/api/colony/buildings/registry/IBuildingDataManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/buildings/registry/IBuildingRegistry.java b/src/api/java/com/minecolonies/api/colony/buildings/registry/IBuildingRegistry.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/buildings/views/IBuildingView.java b/src/api/java/com/minecolonies/api/colony/buildings/views/IBuildingView.java old mode 100644 new mode 100755 index b13f2a83c51..a782e9540ed --- a/src/api/java/com/minecolonies/api/colony/buildings/views/IBuildingView.java +++ b/src/api/java/com/minecolonies/api/colony/buildings/views/IBuildingView.java @@ -18,7 +18,7 @@ import java.util.Map; import java.util.function.Predicate; -import static com.minecolonies.api.util.constant.Suppression.*; +import static com.minecolonies.api.util.constant.Suppression.GENERIC_WILDCARD; public interface IBuildingView extends IRequester { @@ -144,8 +144,7 @@ public interface IBuildingView extends IRequester int getClaimRadius(); /** - * Open the associated BlockOut window for this building. - * If the player is sneaking open the inventory else open the GUI directly. + * Open the associated BlockOut window for this building. If the player is sneaking open the inventory else open the GUI directly. * * @param shouldOpenInv if the player is sneaking. */ @@ -198,8 +197,7 @@ ImmutableList> getOpenRequestsOfTypeFiltered( ImmutableCollection> getResolverIds(); /** - * Setter for the custom name. - * Sets the name on the client side and sends it to the server. + * Setter for the custom name. Sets the name on the client side and sends it to the server. * * @param name the new name. */ @@ -207,6 +205,7 @@ ImmutableList> getOpenRequestsOfTypeFiltered( /** * Check if the building was deconstructed. + * * @return true if so. */ boolean isDeconstructed(); diff --git a/src/api/java/com/minecolonies/api/colony/buildings/views/MobEntryView.java b/src/api/java/com/minecolonies/api/colony/buildings/views/MobEntryView.java old mode 100644 new mode 100755 index 1792de81c86..6e19f4e074e --- a/src/api/java/com/minecolonies/api/colony/buildings/views/MobEntryView.java +++ b/src/api/java/com/minecolonies/api/colony/buildings/views/MobEntryView.java @@ -30,8 +30,9 @@ public class MobEntryView /** * Public constructor of the WorkOrderView. - * @param location the location. - * @param priority the mob priority. + * + * @param location the location. + * @param priority the mob priority. * @param shouldAttack if it should be attacked or not. */ public MobEntryView(final ResourceLocation location, final Boolean shouldAttack, final Integer priority) @@ -44,7 +45,7 @@ public MobEntryView(final ResourceLocation location, final Boolean shouldAttack, /** * Writes the Location, Attack, and Priority to a {@link PacketBuffer}. * - * @param buf Buf to write to. + * @param buf Buf to write to. * @param entry Entry to write. */ public static void writeToByteBuf(@NotNull final PacketBuffer buf, @NotNull final MobEntryView entry) @@ -75,7 +76,7 @@ public static MobEntryView readFromByteBuf(@NotNull final PacketBuffer buf) * * @param compound Compound to write to. * @param name Name of the tag. - * @param entry the View to write + * @param entry the View to write */ public static void write(@NotNull final CompoundNBT compound, final String name, @NotNull final MobEntryView entry) { diff --git a/src/api/java/com/minecolonies/api/colony/buildings/workerbuildings/IBuildingDeliveryman.java b/src/api/java/com/minecolonies/api/colony/buildings/workerbuildings/IBuildingDeliveryman.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/buildings/workerbuildings/ITownHall.java b/src/api/java/com/minecolonies/api/colony/buildings/workerbuildings/ITownHall.java old mode 100644 new mode 100755 index f51dc357b09..523be968448 --- a/src/api/java/com/minecolonies/api/colony/buildings/workerbuildings/ITownHall.java +++ b/src/api/java/com/minecolonies/api/colony/buildings/workerbuildings/ITownHall.java @@ -6,8 +6,7 @@ public interface ITownHall extends IBuilding { /** - * Add a colony permission event to the colony. - * Reduce the list by one if bigger than a treshhold. + * Add a colony permission event to the colony. Reduce the list by one if bigger than a treshhold. * * @param event the event to add. */ diff --git a/src/api/java/com/minecolonies/api/colony/buildings/workerbuildings/ITownHallView.java b/src/api/java/com/minecolonies/api/colony/buildings/workerbuildings/ITownHallView.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/buildings/workerbuildings/IWareHouse.java b/src/api/java/com/minecolonies/api/colony/buildings/workerbuildings/IWareHouse.java old mode 100644 new mode 100755 index abda9a7fa02..e363beb71a3 --- a/src/api/java/com/minecolonies/api/colony/buildings/workerbuildings/IWareHouse.java +++ b/src/api/java/com/minecolonies/api/colony/buildings/workerbuildings/IWareHouse.java @@ -3,6 +3,7 @@ import com.minecolonies.api.colony.buildings.IBuilding; import com.minecolonies.api.tileentities.AbstractTileEntityColonyBuilding; import com.minecolonies.api.tileentities.AbstractTileEntityWareHouse; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; @@ -47,4 +48,12 @@ public interface IWareHouse extends IBuilding */ @Override AbstractTileEntityWareHouse getTileEntity(); + + /** + * Check if a container position belongs to the warehouse. + * + * @param inDimensionLocation the location. + * @return true if so. + */ + boolean hasContainerPosition(BlockPos inDimensionLocation); } diff --git a/src/api/java/com/minecolonies/api/colony/colonyEvents/EventStatus.java b/src/api/java/com/minecolonies/api/colony/colonyEvents/EventStatus.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/colonyEvents/IColonyEntitySpawnEvent.java b/src/api/java/com/minecolonies/api/colony/colonyEvents/IColonyEntitySpawnEvent.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/colonyEvents/IColonyEvent.java b/src/api/java/com/minecolonies/api/colony/colonyEvents/IColonyEvent.java old mode 100644 new mode 100755 index 1e88244fd21..e9e7f8de141 --- a/src/api/java/com/minecolonies/api/colony/colonyEvents/IColonyEvent.java +++ b/src/api/java/com/minecolonies/api/colony/colonyEvents/IColonyEvent.java @@ -20,6 +20,7 @@ public interface IColonyEvent /** * Sets the current event status + * * @param status the status to set. */ void setStatus(final EventStatus status); diff --git a/src/api/java/com/minecolonies/api/colony/colonyEvents/IColonyRaidEvent.java b/src/api/java/com/minecolonies/api/colony/colonyEvents/IColonyRaidEvent.java old mode 100644 new mode 100755 index a881ffef605..2069e97bb2f --- a/src/api/java/com/minecolonies/api/colony/colonyEvents/IColonyRaidEvent.java +++ b/src/api/java/com/minecolonies/api/colony/colonyEvents/IColonyRaidEvent.java @@ -15,24 +15,28 @@ public interface IColonyRaidEvent extends IColonyEntitySpawnEvent /** * Get the normal raider type. + * * @return the normal type. */ EntityType getNormalRaiderType(); /** * Get the archer raider type. + * * @return the archer type. */ EntityType getArcherRaiderType(); /** * Get the boss raider type. + * * @return the boss type. */ EntityType getBossRaiderType(); /** * Add a spawner to an event. + * * @param pos the pos to add the spawner at. */ void addSpawner(final BlockPos pos); diff --git a/src/api/java/com/minecolonies/api/colony/colonyEvents/IColonySpawnEvent.java b/src/api/java/com/minecolonies/api/colony/colonyEvents/IColonySpawnEvent.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/colonyEvents/IColonyStructureSpawnEvent.java b/src/api/java/com/minecolonies/api/colony/colonyEvents/IColonyStructureSpawnEvent.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/colonyEvents/NBTTags.java b/src/api/java/com/minecolonies/api/colony/colonyEvents/NBTTags.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/colonyEvents/registry/ColonyEventTypeRegistryEntry.java b/src/api/java/com/minecolonies/api/colony/colonyEvents/registry/ColonyEventTypeRegistryEntry.java old mode 100644 new mode 100755 index e7c113a1975..82bfc1f4166 --- a/src/api/java/com/minecolonies/api/colony/colonyEvents/registry/ColonyEventTypeRegistryEntry.java +++ b/src/api/java/com/minecolonies/api/colony/colonyEvents/registry/ColonyEventTypeRegistryEntry.java @@ -24,7 +24,7 @@ public class ColonyEventTypeRegistryEntry extends ForgeRegistryEntry eventCreator, @NotNull final ResourceLocation registryID) { diff --git a/src/api/java/com/minecolonies/api/colony/guardtype/GuardType.java b/src/api/java/com/minecolonies/api/colony/guardtype/GuardType.java old mode 100644 new mode 100755 index 1ecc8cbf5b3..3a8f2f53a7c --- a/src/api/java/com/minecolonies/api/colony/guardtype/GuardType.java +++ b/src/api/java/com/minecolonies/api/colony/guardtype/GuardType.java @@ -45,12 +45,13 @@ public class GuardType extends ForgeRegistryEntry /** * Constructor to create the type. - * @param guardJobProducer the producer. - * @param jobTranslationKey job translation key. + * + * @param guardJobProducer the producer. + * @param jobTranslationKey job translation key. * @param buttonTranslationKey button translation ky. - * @param primarySkill primary skill. - * @param secondarySkill secondary skill. - * @param workerSoundName worker sound name. + * @param primarySkill primary skill. + * @param secondarySkill secondary skill. + * @param workerSoundName worker sound name. */ public GuardType( final Function> guardJobProducer, @@ -69,6 +70,7 @@ public GuardType( /** * Getter for the job producer. + * * @return the producer. */ public Function> getGuardJobProducer() @@ -78,6 +80,7 @@ public Function> getGuardJobProducer() /** * Getter for the job translation key. + * * @return the key. */ public String getJobTranslationKey() @@ -87,6 +90,7 @@ public String getJobTranslationKey() /** * Getter for the button translation key. + * * @return the key. */ public String getButtonTranslationKey() @@ -96,6 +100,7 @@ public String getButtonTranslationKey() /** * Getter for the primary key. + * * @return the skill. */ public Skill getPrimarySkill() @@ -105,6 +110,7 @@ public Skill getPrimarySkill() /** * Getter for the secondary skill. + * * @return the skill. */ public Skill getSecondarySkill() @@ -114,6 +120,7 @@ public Skill getSecondarySkill() /** * Getter for the worker sound name. + * * @return the sound name. */ public String getWorkerSoundName() diff --git a/src/api/java/com/minecolonies/api/colony/guardtype/registry/IGuardTypeDataManager.java b/src/api/java/com/minecolonies/api/colony/guardtype/registry/IGuardTypeDataManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/guardtype/registry/IGuardTypeRegistry.java b/src/api/java/com/minecolonies/api/colony/guardtype/registry/IGuardTypeRegistry.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/guardtype/registry/ModGuardTypes.java b/src/api/java/com/minecolonies/api/colony/guardtype/registry/ModGuardTypes.java old mode 100644 new mode 100755 index 04a54050350..6815b5f05f1 --- a/src/api/java/com/minecolonies/api/colony/guardtype/registry/ModGuardTypes.java +++ b/src/api/java/com/minecolonies/api/colony/guardtype/registry/ModGuardTypes.java @@ -8,7 +8,7 @@ public final class ModGuardTypes { public static final ResourceLocation KNIGHT_ID = new ResourceLocation(Constants.MOD_ID, "knight"); - public static final ResourceLocation RANGER_ID = new ResourceLocation(Constants.MOD_ID,"ranger"); + public static final ResourceLocation RANGER_ID = new ResourceLocation(Constants.MOD_ID, "ranger"); public static GuardType knight; public static GuardType ranger; diff --git a/src/api/java/com/minecolonies/api/colony/interactionhandling/AbstractInteractionResponseHandler.java b/src/api/java/com/minecolonies/api/colony/interactionhandling/AbstractInteractionResponseHandler.java old mode 100644 new mode 100755 index a98f85fab7e..c496f36a91c --- a/src/api/java/com/minecolonies/api/colony/interactionhandling/AbstractInteractionResponseHandler.java +++ b/src/api/java/com/minecolonies/api/colony/interactionhandling/AbstractInteractionResponseHandler.java @@ -45,16 +45,18 @@ public abstract class AbstractInteractionResponseHandler implements IInteraction /** * The inquiry of the citizen. - * @param inquiry the inquiry. - * @param primary if primary inquiry. - * @param priority the priority. + * + * @param inquiry the inquiry. + * @param primary if primary inquiry. + * @param priority the priority. * @param responseTuples optional response options. */ @SafeVarargs - public AbstractInteractionResponseHandler(@NotNull final ITextComponent inquiry, + public AbstractInteractionResponseHandler( + @NotNull final ITextComponent inquiry, final boolean primary, final IChatPriority priority, - final Tuple...responseTuples) + final Tuple... responseTuples) { this.inquiry = inquiry; this.primary = primary; @@ -94,6 +96,7 @@ public List getPossibleResponses() /** * Serialize the response handler to NBT. + * * @return the serialized data. */ public CompoundNBT serializeNBT() diff --git a/src/api/java/com/minecolonies/api/colony/interactionhandling/ChatPriority.java b/src/api/java/com/minecolonies/api/colony/interactionhandling/ChatPriority.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/interactionhandling/IChatPriority.java b/src/api/java/com/minecolonies/api/colony/interactionhandling/IChatPriority.java old mode 100644 new mode 100755 index e98ccbd9269..08226bfcc61 --- a/src/api/java/com/minecolonies/api/colony/interactionhandling/IChatPriority.java +++ b/src/api/java/com/minecolonies/api/colony/interactionhandling/IChatPriority.java @@ -4,6 +4,7 @@ public interface IChatPriority { /** * Get the priority of the interaction. + * * @return an int, the higher, the more important. */ int getPriority(); diff --git a/src/api/java/com/minecolonies/api/colony/interactionhandling/IInteractionResponseHandler.java b/src/api/java/com/minecolonies/api/colony/interactionhandling/IInteractionResponseHandler.java old mode 100644 new mode 100755 index 2c4d69ce4ea..0b520db758e --- a/src/api/java/com/minecolonies/api/colony/interactionhandling/IInteractionResponseHandler.java +++ b/src/api/java/com/minecolonies/api/colony/interactionhandling/IInteractionResponseHandler.java @@ -19,20 +19,22 @@ public interface IInteractionResponseHandler extends INBTSerializable { /** - * The inquiry of the GUI to the player. - * This is the key for the interaction, functions as id. + * The inquiry of the GUI to the player. This is the key for the interaction, functions as id. + * * @return the text inquiry. */ ITextComponent getInquiry(); /** * Get a list of all possible responses. + * * @return a list of the possible responses the player can give.. */ List getPossibleResponses(); /** * Get possible further interaction from the GUI on response. + * * @param response the response given to the GUI. * @return an instance of ICitizenInquiry if existent, else null. */ @@ -41,18 +43,21 @@ public interface IInteractionResponseHandler extends INBTSerializable genChildInteractions(); /** * Type id used to deserialize. + * * @return the string type. */ String getType(); diff --git a/src/api/java/com/minecolonies/api/colony/interactionhandling/InteractionValidatorRegistry.java b/src/api/java/com/minecolonies/api/colony/interactionhandling/InteractionValidatorRegistry.java old mode 100644 new mode 100755 index b9042c37ad6..bdb7b9090c7 --- a/src/api/java/com/minecolonies/api/colony/interactionhandling/InteractionValidatorRegistry.java +++ b/src/api/java/com/minecolonies/api/colony/interactionhandling/InteractionValidatorRegistry.java @@ -33,6 +33,7 @@ public final class InteractionValidatorRegistry /** * Get the StandardInteractionValidatorPredicate. + * * @param key the key of it. * @return the predicate. */ @@ -43,6 +44,7 @@ public static Predicate getStandardInteractionValidatorPredicate(f /** * Get the PosBasedInteractionValidatorPredicate. + * * @param key the key of it. * @return the predicate. */ @@ -53,6 +55,7 @@ public static BiPredicate getPosBasedInteractionValidato /** * Get the PosBasedInteractionValidatorPredicate. + * * @param key the key of it. * @return the predicate. */ @@ -63,7 +66,8 @@ public static BiPredicate> getTokenBasedInteractionValid /** * Add a new StandardInteractionValidatorPredicate. - * @param key it's key. + * + * @param key it's key. * @param predicate it's predicate. */ public static void registerStandardPredicate(final ITextComponent key, final Predicate predicate) @@ -73,7 +77,8 @@ public static void registerStandardPredicate(final ITextComponent key, final Pre /** * Add a new PosBasedInteractionValidatorPredicate. - * @param key it's key. + * + * @param key it's key. * @param predicate it's predicate. */ public static void registerPosBasedPredicate(final ITextComponent key, final BiPredicate predicate) @@ -83,7 +88,8 @@ public static void registerPosBasedPredicate(final ITextComponent key, final BiP /** * Add a new TokenBasedInteractionValidatorPredicate. - * @param key it's key. + * + * @param key it's key. * @param predicate it's predicate. */ public static void registerTokenBasedPredicate(final ITextComponent key, final BiPredicate> predicate) @@ -93,6 +99,7 @@ public static void registerTokenBasedPredicate(final ITextComponent key, final B /** * Check if there is a validator with a certain key. + * * @param component the key to check. * @return true if so. */ diff --git a/src/api/java/com/minecolonies/api/colony/interactionhandling/ModInteractionResponseHandlers.java b/src/api/java/com/minecolonies/api/colony/interactionhandling/ModInteractionResponseHandlers.java old mode 100644 new mode 100755 index 4a6e1e96af5..c693c3aacd8 --- a/src/api/java/com/minecolonies/api/colony/interactionhandling/ModInteractionResponseHandlers.java +++ b/src/api/java/com/minecolonies/api/colony/interactionhandling/ModInteractionResponseHandlers.java @@ -13,8 +13,8 @@ public final class ModInteractionResponseHandlers * List of IDs. */ public static final ResourceLocation STANDARD = new ResourceLocation(Constants.MOD_ID, "standard"); - public static final ResourceLocation POS = new ResourceLocation(Constants.MOD_ID, "pos"); - public static final ResourceLocation REQUEST = new ResourceLocation(Constants.MOD_ID, "request"); + public static final ResourceLocation POS = new ResourceLocation(Constants.MOD_ID, "pos"); + public static final ResourceLocation REQUEST = new ResourceLocation(Constants.MOD_ID, "request"); /** * List of entries. diff --git a/src/api/java/com/minecolonies/api/colony/interactionhandling/registry/IInteractionResponseHandlerDataManager.java b/src/api/java/com/minecolonies/api/colony/interactionhandling/registry/IInteractionResponseHandlerDataManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/interactionhandling/registry/InteractionResponseHandlerEntry.java b/src/api/java/com/minecolonies/api/colony/interactionhandling/registry/InteractionResponseHandlerEntry.java old mode 100644 new mode 100755 index 9d955ebf0ed..3a80bc90688 --- a/src/api/java/com/minecolonies/api/colony/interactionhandling/registry/InteractionResponseHandlerEntry.java +++ b/src/api/java/com/minecolonies/api/colony/interactionhandling/registry/InteractionResponseHandlerEntry.java @@ -24,7 +24,7 @@ public final class InteractionResponseHandlerEntry extends ForgeRegistryEntry responseHandlerProducer; - private ResourceLocation registryName; + private ResourceLocation registryName; /** * Setter the for the producer. diff --git a/src/api/java/com/minecolonies/api/colony/jobs/IJob.java b/src/api/java/com/minecolonies/api/colony/jobs/IJob.java old mode 100644 new mode 100755 index e9e110fb6ba..5305282f2cf --- a/src/api/java/com/minecolonies/api/colony/jobs/IJob.java +++ b/src/api/java/com/minecolonies/api/colony/jobs/IJob.java @@ -71,9 +71,8 @@ public interface IJob extends INBTSerializable /** * Generate your AI class to register. *

- * Suppressing Sonar Rule squid:S1452 This rule does "Generic wildcard types should not be used in return parameters" - * But in this case the rule does not apply because - * We are fine with all AbstractJob implementations and need generics only for java + * Suppressing Sonar Rule squid:S1452 This rule does "Generic wildcard types should not be used in return parameters" But in this case the rule does not apply because We are + * fine with all AbstractJob implementations and need generics only for java * * @return your personal AI instance. */ @@ -93,16 +92,14 @@ public interface IJob extends INBTSerializable void setCheckedForFood(); /** - * This method can be used to display the current status. - * That a citizen is having. + * This method can be used to display the current status. That a citizen is having. * * @return Small string to display info in name tag */ String getNameTagDescription(); /** - * Used by the AI skeleton to change a citizens name. - * Mostly used to update debugging information. + * Used by the AI skeleton to change a citizens name. Mostly used to update debugging information. * * @param nameTag The name tag to display. */ @@ -156,20 +153,17 @@ public interface IJob extends INBTSerializable int getActionsDone(); /** - * Increase the actions done since the last reset by 1 - * Used for example to detect if and when the inventory has to be dumped. + * Increase the actions done since the last reset by 1 Used for example to detect if and when the inventory has to be dumped. */ void incrementActionsDone(); /** - * Increase the actions done since the last reset by numberOfActions - * Used for example to detect if and when the inventory has to be dumped. + * Increase the actions done since the last reset by numberOfActions Used for example to detect if and when the inventory has to be dumped. */ void incrementActionsDone(int numberOfActions); /** - * Clear the actions done counter. - * Call this when dumping into the chest. + * Clear the actions done counter. Call this when dumping into the chest. */ void clearActionsDone(); @@ -220,8 +214,16 @@ public interface IJob extends INBTSerializable /** * Check if the particular job ignores a particular damage type. + * * @param damageSource the damage source to check. * @return true if so. */ boolean ignoresDamage(@NotNull final DamageSource damageSource); + + /** + * Mark a request as a synchronous (blocking request). + * + * @param id the id. + */ + void markRequestSync(IToken id); } diff --git a/src/api/java/com/minecolonies/api/colony/jobs/ModJobs.java b/src/api/java/com/minecolonies/api/colony/jobs/ModJobs.java old mode 100644 new mode 100755 index 286aa681ed7..9d7eef07579 --- a/src/api/java/com/minecolonies/api/colony/jobs/ModJobs.java +++ b/src/api/java/com/minecolonies/api/colony/jobs/ModJobs.java @@ -8,86 +8,86 @@ public final class ModJobs { public static final ResourceLocation PLACEHOLDER_ID = new ResourceLocation(Constants.MOD_ID, "placeholder"); - public static final ResourceLocation BUILDER_ID = new ResourceLocation(Constants.MOD_ID,"builder"); - public static final ResourceLocation DELIVERY_ID = new ResourceLocation(Constants.MOD_ID,"deliveryman"); - public static final ResourceLocation MINER_ID = new ResourceLocation(Constants.MOD_ID,"miner"); - public static final ResourceLocation LUMBERJACK_ID = new ResourceLocation(Constants.MOD_ID,"lumberjack"); - public static final ResourceLocation FARMER_ID = new ResourceLocation(Constants.MOD_ID,"farmer"); - public static final ResourceLocation FISHERMAN_ID = new ResourceLocation(Constants.MOD_ID,"fisherman"); - public static final ResourceLocation BAKER_ID = new ResourceLocation(Constants.MOD_ID,"baker"); - public static final ResourceLocation COOK_ID = new ResourceLocation(Constants.MOD_ID,"cook"); - public static final ResourceLocation SHEPHERD_ID = new ResourceLocation(Constants.MOD_ID,"shepherd"); - public static final ResourceLocation COWBOY_ID = new ResourceLocation(Constants.MOD_ID,"cowboy"); - public static final ResourceLocation SWINE_HERDER_ID = new ResourceLocation(Constants.MOD_ID,"swineherder"); - public static final ResourceLocation CHICKEN_HERDER_ID = new ResourceLocation(Constants.MOD_ID,"chickenherder"); - public static final ResourceLocation SMELTER_ID = new ResourceLocation(Constants.MOD_ID,"smelter"); - public static final ResourceLocation RANGER_ID = new ResourceLocation(Constants.MOD_ID,"ranger"); - public static final ResourceLocation KNIGHT_ID = new ResourceLocation(Constants.MOD_ID,"knight"); - public static final ResourceLocation COMPOSTER_ID = new ResourceLocation(Constants.MOD_ID,"composter"); - public static final ResourceLocation STUDENT_ID = new ResourceLocation(Constants.MOD_ID,"student"); - public static final ResourceLocation ARCHER_ID = new ResourceLocation(Constants.MOD_ID,"archertraining"); - public static final ResourceLocation COMBAT_ID = new ResourceLocation(Constants.MOD_ID,"combattraining"); - public static final ResourceLocation SAWMILL_ID = new ResourceLocation(Constants.MOD_ID,"sawmill"); - public static final ResourceLocation BLACKSMITH_ID = new ResourceLocation(Constants.MOD_ID,"blacksmith"); - public static final ResourceLocation STONEMASON_ID = new ResourceLocation(Constants.MOD_ID,"stonemason"); - public static final ResourceLocation STONE_SMELTERY_ID = new ResourceLocation(Constants.MOD_ID,"stonesmeltery"); - public static final ResourceLocation CRUSHER_ID = new ResourceLocation(Constants.MOD_ID,"crusher"); - public static final ResourceLocation SIFTER_ID = new ResourceLocation(Constants.MOD_ID,"sifter"); - public static final ResourceLocation FLORIST_ID = new ResourceLocation(Constants.MOD_ID,"florist"); - public static final ResourceLocation ENCHANTER_ID = new ResourceLocation(Constants.MOD_ID,"enchanter"); - public static final ResourceLocation RESEARCHER_ID = new ResourceLocation(Constants.MOD_ID,"researcher"); - public static final ResourceLocation HEALER_ID = new ResourceLocation(Constants.MOD_ID,"healer"); - public static final ResourceLocation PUPIL_ID = new ResourceLocation(Constants.MOD_ID,"pupil"); - public static final ResourceLocation TEACHER_ID = new ResourceLocation(Constants.MOD_ID,"teacher"); - public static final ResourceLocation GLASSBLOWER_ID = new ResourceLocation(Constants.MOD_ID,"glassblower"); - public static final ResourceLocation DYER_ID = new ResourceLocation(Constants.MOD_ID,"dyer"); - public static final ResourceLocation FLETCHER_ID = new ResourceLocation(Constants.MOD_ID,"fletcher"); - public static final ResourceLocation MECHANIC_ID = new ResourceLocation(Constants.MOD_ID,"mechanic"); - public static final ResourceLocation PLANTER_ID = new ResourceLocation(Constants.MOD_ID,"planter"); - public static final ResourceLocation RABBIT_ID = new ResourceLocation(Constants.MOD_ID,"rabbitherder"); - public static final ResourceLocation CONCRETE_ID = new ResourceLocation(Constants.MOD_ID,"concretemixer"); - public static final ResourceLocation BEEKEEPER_ID = new ResourceLocation(Constants.MOD_ID,"beekeeper"); + public static final ResourceLocation BUILDER_ID = new ResourceLocation(Constants.MOD_ID, "builder"); + public static final ResourceLocation DELIVERY_ID = new ResourceLocation(Constants.MOD_ID, "deliveryman"); + public static final ResourceLocation MINER_ID = new ResourceLocation(Constants.MOD_ID, "miner"); + public static final ResourceLocation LUMBERJACK_ID = new ResourceLocation(Constants.MOD_ID, "lumberjack"); + public static final ResourceLocation FARMER_ID = new ResourceLocation(Constants.MOD_ID, "farmer"); + public static final ResourceLocation FISHERMAN_ID = new ResourceLocation(Constants.MOD_ID, "fisherman"); + public static final ResourceLocation BAKER_ID = new ResourceLocation(Constants.MOD_ID, "baker"); + public static final ResourceLocation COOK_ID = new ResourceLocation(Constants.MOD_ID, "cook"); + public static final ResourceLocation SHEPHERD_ID = new ResourceLocation(Constants.MOD_ID, "shepherd"); + public static final ResourceLocation COWBOY_ID = new ResourceLocation(Constants.MOD_ID, "cowboy"); + public static final ResourceLocation SWINE_HERDER_ID = new ResourceLocation(Constants.MOD_ID, "swineherder"); + public static final ResourceLocation CHICKEN_HERDER_ID = new ResourceLocation(Constants.MOD_ID, "chickenherder"); + public static final ResourceLocation SMELTER_ID = new ResourceLocation(Constants.MOD_ID, "smelter"); + public static final ResourceLocation RANGER_ID = new ResourceLocation(Constants.MOD_ID, "ranger"); + public static final ResourceLocation KNIGHT_ID = new ResourceLocation(Constants.MOD_ID, "knight"); + public static final ResourceLocation COMPOSTER_ID = new ResourceLocation(Constants.MOD_ID, "composter"); + public static final ResourceLocation STUDENT_ID = new ResourceLocation(Constants.MOD_ID, "student"); + public static final ResourceLocation ARCHER_ID = new ResourceLocation(Constants.MOD_ID, "archertraining"); + public static final ResourceLocation COMBAT_ID = new ResourceLocation(Constants.MOD_ID, "combattraining"); + public static final ResourceLocation SAWMILL_ID = new ResourceLocation(Constants.MOD_ID, "sawmill"); + public static final ResourceLocation BLACKSMITH_ID = new ResourceLocation(Constants.MOD_ID, "blacksmith"); + public static final ResourceLocation STONEMASON_ID = new ResourceLocation(Constants.MOD_ID, "stonemason"); + public static final ResourceLocation STONE_SMELTERY_ID = new ResourceLocation(Constants.MOD_ID, "stonesmeltery"); + public static final ResourceLocation CRUSHER_ID = new ResourceLocation(Constants.MOD_ID, "crusher"); + public static final ResourceLocation SIFTER_ID = new ResourceLocation(Constants.MOD_ID, "sifter"); + public static final ResourceLocation FLORIST_ID = new ResourceLocation(Constants.MOD_ID, "florist"); + public static final ResourceLocation ENCHANTER_ID = new ResourceLocation(Constants.MOD_ID, "enchanter"); + public static final ResourceLocation RESEARCHER_ID = new ResourceLocation(Constants.MOD_ID, "researcher"); + public static final ResourceLocation HEALER_ID = new ResourceLocation(Constants.MOD_ID, "healer"); + public static final ResourceLocation PUPIL_ID = new ResourceLocation(Constants.MOD_ID, "pupil"); + public static final ResourceLocation TEACHER_ID = new ResourceLocation(Constants.MOD_ID, "teacher"); + public static final ResourceLocation GLASSBLOWER_ID = new ResourceLocation(Constants.MOD_ID, "glassblower"); + public static final ResourceLocation DYER_ID = new ResourceLocation(Constants.MOD_ID, "dyer"); + public static final ResourceLocation FLETCHER_ID = new ResourceLocation(Constants.MOD_ID, "fletcher"); + public static final ResourceLocation MECHANIC_ID = new ResourceLocation(Constants.MOD_ID, "mechanic"); + public static final ResourceLocation PLANTER_ID = new ResourceLocation(Constants.MOD_ID, "planter"); + public static final ResourceLocation RABBIT_ID = new ResourceLocation(Constants.MOD_ID, "rabbitherder"); + public static final ResourceLocation CONCRETE_ID = new ResourceLocation(Constants.MOD_ID, "concretemixer"); + public static final ResourceLocation BEEKEEPER_ID = new ResourceLocation(Constants.MOD_ID, "beekeeper"); - public static JobEntry placeHolder; - public static JobEntry builder; - public static JobEntry delivery; - public static JobEntry miner; - public static JobEntry lumberjack; - public static JobEntry farmer; - public static JobEntry fisherman; - public static JobEntry baker; - public static JobEntry cook; - public static JobEntry shepherd; - public static JobEntry cowboy; - public static JobEntry swineHerder; - public static JobEntry chickenHerder; - public static JobEntry smelter; - public static JobEntry ranger; - public static JobEntry knight; - public static JobEntry composter; - public static JobEntry student; - public static JobEntry archer; - public static JobEntry combat; - public static JobEntry sawmill; - public static JobEntry blacksmith; - public static JobEntry stoneMason; - public static JobEntry stoneSmeltery; - public static JobEntry crusher; - public static JobEntry sifter; - public static JobEntry florist; - public static JobEntry enchanter; - public static JobEntry researcher; - public static JobEntry healer; - public static JobEntry pupil; - public static JobEntry teacher; - public static JobEntry glassblower; - public static JobEntry dyer; - public static JobEntry fletcher; - public static JobEntry mechanic; - public static JobEntry planter; - public static JobEntry rabbitHerder; - public static JobEntry concreteMixer; - public static JobEntry beekeeper; + public static JobEntry placeHolder; + public static JobEntry builder; + public static JobEntry delivery; + public static JobEntry miner; + public static JobEntry lumberjack; + public static JobEntry farmer; + public static JobEntry fisherman; + public static JobEntry baker; + public static JobEntry cook; + public static JobEntry shepherd; + public static JobEntry cowboy; + public static JobEntry swineHerder; + public static JobEntry chickenHerder; + public static JobEntry smelter; + public static JobEntry ranger; + public static JobEntry knight; + public static JobEntry composter; + public static JobEntry student; + public static JobEntry archer; + public static JobEntry combat; + public static JobEntry sawmill; + public static JobEntry blacksmith; + public static JobEntry stoneMason; + public static JobEntry stoneSmeltery; + public static JobEntry crusher; + public static JobEntry sifter; + public static JobEntry florist; + public static JobEntry enchanter; + public static JobEntry researcher; + public static JobEntry healer; + public static JobEntry pupil; + public static JobEntry teacher; + public static JobEntry glassblower; + public static JobEntry dyer; + public static JobEntry fletcher; + public static JobEntry mechanic; + public static JobEntry planter; + public static JobEntry rabbitHerder; + public static JobEntry concreteMixer; + public static JobEntry beekeeper; private ModJobs() { diff --git a/src/api/java/com/minecolonies/api/colony/jobs/registry/IJobDataManager.java b/src/api/java/com/minecolonies/api/colony/jobs/registry/IJobDataManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/jobs/registry/IJobRegistry.java b/src/api/java/com/minecolonies/api/colony/jobs/registry/IJobRegistry.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/jobs/registry/JobEntry.java b/src/api/java/com/minecolonies/api/colony/jobs/registry/JobEntry.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/managers/interfaces/IBuildingManager.java b/src/api/java/com/minecolonies/api/colony/managers/interfaces/IBuildingManager.java old mode 100644 new mode 100755 index 512e49cd46b..54d413f3202 --- a/src/api/java/com/minecolonies/api/colony/managers/interfaces/IBuildingManager.java +++ b/src/api/java/com/minecolonies/api/colony/managers/interfaces/IBuildingManager.java @@ -76,8 +76,7 @@ public interface IBuildingManager IBuilding getBuilding(BlockPos pos); /** - * Returns a map with all buildings within the colony. - * Key is ID (Coordinates), value is building object. + * Returns a map with all buildings within the colony. Key is ID (Coordinates), value is building object. * * @return Map with ID (coordinates) as key, and buildings as value. */ @@ -106,8 +105,7 @@ public interface IBuildingManager boolean hasTownHall(); /** - * Get building in Colony by ID. The building will be casted to the provided - * type. + * Get building in Colony by ID. The building will be casted to the provided type. * * @param buildingId ID (coordinates) of the building to get. * @param type Type of building. diff --git a/src/api/java/com/minecolonies/api/colony/managers/interfaces/ICitizenManager.java b/src/api/java/com/minecolonies/api/colony/managers/interfaces/ICitizenManager.java old mode 100644 new mode 100755 index 3b99aea4bb6..46dc87742cc --- a/src/api/java/com/minecolonies/api/colony/managers/interfaces/ICitizenManager.java +++ b/src/api/java/com/minecolonies/api/colony/managers/interfaces/ICitizenManager.java @@ -35,20 +35,23 @@ public interface ICitizenManager /** * Read the citizens from nbt. + * * @param compound the compound to read it from. */ void read(@NotNull final CompoundNBT compound); /** * Write the citizens to nbt. + * * @param citizenCompound the compound to write it to. */ void write(@NotNull final CompoundNBT citizenCompound); /** * Sends packages to update the citizens. - * @param closeSubscribers the existing subscribers. - * @param newSubscribers new subscribers + * + * @param closeSubscribers the existing subscribers. + * @param newSubscribers new subscribers */ void sendPackets( @NotNull final Set closeSubscribers, @@ -60,11 +63,9 @@ void sendPackets( void spawnOrCreateCitizen(); /** - * Returns a map of citizens in the colony. - * The map has ID as key, and citizen data as value. + * Returns a map of citizens in the colony. The map has ID as key, and citizen data as value. * - * @return Map of citizens in the colony, with as key the citizen ID, and as - * value the citizen data. + * @return Map of citizens in the colony, with as key the citizen ID, and as value the citizen data. */ @NotNull Map getCitizenMap(); @@ -80,7 +81,7 @@ void sendPackets( /** * Spawn a citizen with specific citizen data. * - * @param data Data to use to spawn citizen. + * @param data Data to use to spawn citizen. * @param world the world to spawn it in. * @return the citizen data of the spawned citizen. */ @@ -95,7 +96,6 @@ default ICitizenData spawnOrCreateCitizen(final ICitizenData data, @NotNull fina * @param data Data to use to spawn citizen. * @param world the world to spawn it in. * @param spawnPos the Blockposition to spawn at - * * @return the new citizen. */ default ICitizenData spawnOrCreateCitizen(final ICitizenData data, @NotNull final World world, final BlockPos spawnPos) @@ -105,9 +105,10 @@ default ICitizenData spawnOrCreateCitizen(final ICitizenData data, @NotNull fina /** * Spawns a citizen with the specific citizen data. - * @param data Data to use when spawn, null when new generation. - * @param world THe world. - * @param force True to skip max citizen test, false when not. + * + * @param data Data to use when spawn, null when new generation. + * @param world THe world. + * @param force True to skip max citizen test, false when not. * @param spawnPos the pos to spawn it at. * @return the new citizen. */ @@ -152,38 +153,42 @@ default ICitizenData spawnOrCreateCitizen(final ICitizenData data, @NotNull fina /** * Get all citizens. + * * @return a copy of the list of citizens. */ List getCitizens(); /** * Get max citizens of the colony. + * * @return the amount. */ int getMaxCitizens(); /** - * Get potential max citizens of the colony. - * The potential considers all available beds including not assigned guard towers. + * Get potential max citizens of the colony. The potential considers all available beds including not assigned guard towers. + * * @return the amount. */ int getPotentialMaxCitizens(); /** * Get the current amount of citizens, might be bigger then {@link #getMaxCitizens()} + * * @return The current amount of citizens in the colony. */ int getCurrentCitizenCount(); /** * Set the new max citizens. + * * @param newMaxCitizens the amount to set. */ void setMaxCitizens(final int newMaxCitizens); /** - * Set the new potential max citizens. - * The potential considers all available beds including not assigned guard towers. + * Set the new potential max citizens. The potential considers all available beds including not assigned guard towers. + * * @param newMaxCitizens the potential amount to set. */ void setPotentialMaxCitizens(final int newMaxCitizens); @@ -200,6 +205,7 @@ default ICitizenData spawnOrCreateCitizen(final ICitizenData data, @NotNull fina /** * Actions to execute on a colony tick. + * * @param colony the event. */ void onColonyTick(final IColony colony); @@ -220,19 +226,20 @@ default ICitizenData spawnOrCreateCitizen(final ICitizenData data, @NotNull fina /** * Get a random citizen. + * * @return the random citizen. */ ICitizenData getRandomCitizen(); /** * Update a modifier for all citizens. + * * @param id the name of it. */ void updateModifier(final String id); /** - * Call this when citizens sleep + * Call this when citizens sleep */ void onCitizenSleep(); - } diff --git a/src/api/java/com/minecolonies/api/colony/managers/interfaces/IColonyPackageManager.java b/src/api/java/com/minecolonies/api/colony/managers/interfaces/IColonyPackageManager.java old mode 100644 new mode 100755 index ac12f084d17..55ce09c0818 --- a/src/api/java/com/minecolonies/api/colony/managers/interfaces/IColonyPackageManager.java +++ b/src/api/java/com/minecolonies/api/colony/managers/interfaces/IColonyPackageManager.java @@ -12,18 +12,21 @@ public interface IColonyPackageManager { /** * Get the last contact in hours from the colony. + * * @return the integer. */ int getLastContactInHours(); /** * Set the last contact in hours. + * * @param lastContactInHours the number to set. */ void setLastContactInHours(int lastContactInHours); /** * Get all subscribers. + * * @return a copy of the hashset. */ Set getCloseSubscribers(); @@ -48,13 +51,11 @@ public interface IColonyPackageManager */ void sendPermissionsPackets(); - /** * Sends packages to update the workOrders. */ void sendWorkOrderPackets(); - /** * Sends packages to update the schematics. */ @@ -67,6 +68,7 @@ public interface IColonyPackageManager /** * Add a new subscriber to the colony. + * * @param subscriber the subscriber to add. */ void addCloseSubscriber(@NotNull final ServerPlayerEntity subscriber); @@ -87,6 +89,7 @@ public interface IColonyPackageManager /** * Remove a subscriber from the colony. + * * @param player the subscriber to remove. */ void removeCloseSubscriber(@NotNull final ServerPlayerEntity player); diff --git a/src/api/java/com/minecolonies/api/colony/managers/interfaces/IEventManager.java b/src/api/java/com/minecolonies/api/colony/managers/interfaces/IEventManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/managers/interfaces/IEventStructureManager.java b/src/api/java/com/minecolonies/api/colony/managers/interfaces/IEventStructureManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/managers/interfaces/IProgressManager.java b/src/api/java/com/minecolonies/api/colony/managers/interfaces/IProgressManager.java old mode 100644 new mode 100755 index 4ea7cf092dc..b45fcba4f51 --- a/src/api/java/com/minecolonies/api/colony/managers/interfaces/IProgressManager.java +++ b/src/api/java/com/minecolonies/api/colony/managers/interfaces/IProgressManager.java @@ -11,33 +11,38 @@ public interface IProgressManager { /** * Notifies progress on building block placement. + * * @param block the placed block. */ void progressBuildingPlacement(Block block); /** * Notifies progress on citizen spawn. - * @param total the total citizen count. + * + * @param total the total citizen count. * @param employed the employed count. */ void progressCitizenSpawn(int total, int employed); /** * Notifies progress on workOrder creation. + * * @param workOrder the placed workOrder. */ void progressWorkOrderPlacement(IWorkOrder workOrder); /** * Notifies progress on building built. - * @param building the built building. - * @param totalLevels total building levels. + * + * @param building the built building. + * @param totalLevels total building levels. * @param totalHousing total housing. */ void progressBuildBuilding(IBuilding building, int totalLevels, int totalHousing); /** * Notifies progress on employing citizen. + * * @param employed the amount of employed citizen. */ void progressEmploy(int employed); @@ -49,6 +54,7 @@ public interface IProgressManager /** * Triggers a progress type to notify the player. + * * @param type the progress type. */ void trigger(ColonyProgressType type); @@ -60,18 +66,21 @@ public interface IProgressManager /** * Reads the progress manager from NBT. + * * @param compound the compound to read it from. */ void read(@NotNull CompoundNBT compound); /** * Writes the progress manager to NBT. + * * @param compound the compound to write it to. */ void write(@NotNull CompoundNBT compound); /** * Check if progress should be printed. + * * @return true if so. */ boolean isPrintingProgress(); diff --git a/src/api/java/com/minecolonies/api/colony/managers/interfaces/IRaiderManager.java b/src/api/java/com/minecolonies/api/colony/managers/interfaces/IRaiderManager.java old mode 100644 new mode 100755 index b38a82e38d6..0fa4d717c0d --- a/src/api/java/com/minecolonies/api/colony/managers/interfaces/IRaiderManager.java +++ b/src/api/java/com/minecolonies/api/colony/managers/interfaces/IRaiderManager.java @@ -12,42 +12,49 @@ public interface IRaiderManager { /** * Checks if the raider manager can have raider events. + * * @return true if so. */ boolean canHaveRaiderEvents(); /** * Checks if the raider raid has been calculated already. + * * @return true if so. */ boolean hasRaidBeenCalculated(); /** * Checks if raiders will raid tonight. + * * @return true if so. */ boolean willRaidTonight(); /** * Set that the manager can receive raider events. + * * @param canHave true or false. */ void setCanHaveRaiderEvents(final boolean canHave); /** * Add a spawnPoint to the last raiders spawns. + * * @param pos the position to set. */ void addRaiderSpawnPoint(final BlockPos pos); /** * Set if the raid has been calculated. + * * @param hasSet true or false. */ void setHasRaidBeenCalculated(final boolean hasSet); /** * Set if raiders will raid tonight. + * * @param willRaid true or false. */ void setWillRaidTonight(final boolean willRaid); @@ -80,6 +87,7 @@ public interface IRaiderManager /** * Getter for the last spawn points. + * * @return a copy of the list */ List getLastSpawnPoints(); @@ -93,6 +101,7 @@ public interface IRaiderManager /** * Whether the colony is currently raided. + * * @return true if so. */ boolean isRaided(); @@ -104,24 +113,28 @@ public interface IRaiderManager /** * Returns the amount of nights since the last raid + * * @return the number of nights. */ int getNightsSinceLastRaid(); /** * Sets the amount of nights since the last raid + * * @param nightsSinceLastRaid the nights to set. */ void setNightsSinceLastRaid(int nightsSinceLastRaid); /** * Tries to raid the colony, if possible. + * * @param colony the colony to try. */ void tryToRaidColony(final IColony colony); /** * Whether the colony can be raided. + * * @return true if possible. */ boolean canRaid(); diff --git a/src/api/java/com/minecolonies/api/colony/permissions/Action.java b/src/api/java/com/minecolonies/api/colony/permissions/Action.java old mode 100644 new mode 100755 index f51b13f49b9..18de36afce0 --- a/src/api/java/com/minecolonies/api/colony/permissions/Action.java +++ b/src/api/java/com/minecolonies/api/colony/permissions/Action.java @@ -43,9 +43,7 @@ public enum Action private final int flag; /** - * Stores the action as byte. - * {@link #ACCESS_HUTS} has value 0000 0000 - * {@link #SEND_MESSAGES} has value 0100 0000 + * Stores the action as byte. {@link #ACCESS_HUTS} has value 0000 0000 {@link #SEND_MESSAGES} has value 0100 0000 * * @param bit how many bits should be shifted and set */ diff --git a/src/api/java/com/minecolonies/api/colony/permissions/IPermissions.java b/src/api/java/com/minecolonies/api/colony/permissions/IPermissions.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/permissions/PermissionEvent.java b/src/api/java/com/minecolonies/api/colony/permissions/PermissionEvent.java old mode 100644 new mode 100755 index 3f12c1e071c..953a6d269bc --- a/src/api/java/com/minecolonies/api/colony/permissions/PermissionEvent.java +++ b/src/api/java/com/minecolonies/api/colony/permissions/PermissionEvent.java @@ -17,17 +17,17 @@ public class PermissionEvent * Player UUID. */ @Nullable - private final UUID id; + private final UUID id; /** * Player name. */ - private final String name; + private final String name; /** * Action happening. */ - private final Action action; + private final Action action; /** * Impact permission. @@ -36,9 +36,10 @@ public class PermissionEvent /** * Constructor for permissionevents. - * @param id the player UUID. - * @param name the player name. - * @param action the action happening. + * + * @param id the player UUID. + * @param name the player name. + * @param action the action happening. * @param position the position of the action. */ public PermissionEvent(final UUID id, final String name, final Action action, final BlockPos position) @@ -51,12 +52,13 @@ public PermissionEvent(final UUID id, final String name, final Action action, fi /** * Constructor for permissionevents. to load them from a ByteBuf. + * * @param buf the ByteBuf. */ public PermissionEvent(final PacketBuffer buf) { final UUID uuid = PacketUtils.readUUID(buf); - if(uuid.equals(UUID.fromString("1-2-3-4-5"))) + if (uuid.equals(UUID.fromString("1-2-3-4-5"))) { this.id = null; } @@ -71,6 +73,7 @@ public PermissionEvent(final PacketBuffer buf) /** * The UUID of the player causing the event. + * * @return the UUID. */ @Nullable @@ -81,6 +84,7 @@ public UUID getId() /** * The name of the player causing the event. + * * @return the name String. */ public String getName() @@ -90,6 +94,7 @@ public String getName() /** * The action causing the event. + * * @return the Action */ public Action getAction() @@ -99,6 +104,7 @@ public Action getAction() /** * The position at which the event had happened. + * * @return the BlockPos. */ public BlockPos getPosition() @@ -108,11 +114,12 @@ public BlockPos getPosition() /** * Serialize the PermissioNEvent to a ByteBuf. + * * @param buf the buffer. */ public void serialize(final PacketBuffer buf) { - if(id == null) + if (id == null) { PacketUtils.writeUUID(buf, UUID.fromString("1-2-3-4-5")); } @@ -138,9 +145,9 @@ public boolean equals(final Object o) } final PermissionEvent that = (PermissionEvent) o; return Objects.equals(id, that.id) && - Objects.equals(name, that.name) && - action == that.action && - Objects.equals(position, that.position); + Objects.equals(name, that.name) && + action == that.action && + Objects.equals(position, that.position); } @Override diff --git a/src/api/java/com/minecolonies/api/colony/permissions/Player.java b/src/api/java/com/minecolonies/api/colony/permissions/Player.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/permissions/Rank.java b/src/api/java/com/minecolonies/api/colony/permissions/Rank.java old mode 100644 new mode 100755 index 9d29a954e85..72ba7abb020 --- a/src/api/java/com/minecolonies/api/colony/permissions/Rank.java +++ b/src/api/java/com/minecolonies/api/colony/permissions/Rank.java @@ -19,9 +19,7 @@ public enum Rank /** * Ranks enum constructor. *

- * Subscribers are receiving events from the colony. - * They are either citizens or near enough. - * Ranks with true are automatically subscribed to the colony. + * Subscribers are receiving events from the colony. They are either citizens or near enough. Ranks with true are automatically subscribed to the colony. * * @param isSubscriber boolean whether auto-subscribed to this colony. */ @@ -29,5 +27,4 @@ public enum Rank { this.isSubscriber = isSubscriber; } - } diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/StandardFactoryController.java b/src/api/java/com/minecolonies/api/colony/requestsystem/StandardFactoryController.java old mode 100644 new mode 100755 index d3d014b15ef..2de43aa261a --- a/src/api/java/com/minecolonies/api/colony/requestsystem/StandardFactoryController.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/StandardFactoryController.java @@ -21,8 +21,7 @@ import java.util.concurrent.ExecutionException; /** - * Default implementation of a FactoryController - * Singleton. + * Default implementation of a FactoryController Singleton. */ public final class StandardFactoryController implements IFactoryController { @@ -35,7 +34,7 @@ public final class StandardFactoryController implements IFactoryController /** * Instance variable. */ - private static final StandardFactoryController INSTANCE = new StandardFactoryController(); + private static final StandardFactoryController INSTANCE = new StandardFactoryController(); /** * Primary (main) INPUT mappings. */ @@ -51,10 +50,10 @@ public final class StandardFactoryController implements IFactoryController * Secondary (super) output mappings */ @NotNull - private final Map, Set>> secondaryOutputMappings = new HashMap<>(); + private final Map, Set>> secondaryOutputMappings = new HashMap<>(); /** - * A cache that holds all Mappers and their search secondary IO types. - * Filled during runtime to speed up searches to factories when both INPUT and OUTPUT type are secondary types. + * A cache that holds all Mappers and their search secondary IO types. Filled during runtime to speed up searches to factories when both INPUT and OUTPUT type are secondary + * types. */ @NotNull private final Cache, TypeToken>, IFactory> secondaryMappingsCache = CacheBuilder.newBuilder().build(); @@ -73,10 +72,8 @@ public final class StandardFactoryController implements IFactoryController /** * Private constructor. Throws IllegalStateException if already created. - * - * We suppress warning squid:S2583 which makes sure that no null checks are executed on notnull fields. - * In this case it makes sense since we need to make sure. - * + *

+ * We suppress warning squid:S2583 which makes sure that no null checks are executed on notnull fields. In this case it makes sense since we need to make sure. */ @SuppressWarnings("squid:S2583") private StandardFactoryController() @@ -88,8 +85,7 @@ private StandardFactoryController() } /** - * Resets the FactoryController to the default values. - * Clears all registered Factories. + * Resets the FactoryController to the default values. Clears all registered Factories. *

* Only used for testing. */ @@ -112,7 +108,8 @@ public static StandardFactoryController getInstance() @SuppressWarnings(Suppression.UNCHECKED) @Override - public IFactory getFactoryForIO(@NotNull final TypeToken inputClass, @NotNull final TypeToken outputClass) throws IllegalArgumentException + public IFactory getFactoryForIO(@NotNull final TypeToken inputClass, @NotNull final TypeToken outputClass) + throws IllegalArgumentException { final ITypeOverrideHandler inputOverrideHandler = typeOverrideHandlers.stream().filter(h -> h.matches(inputClass)).findFirst().orElse(null); final ITypeOverrideHandler outputOverrideHandler = typeOverrideHandlers.stream().filter(h -> h.matches(outputClass)).findFirst().orElse(null); @@ -284,14 +281,14 @@ private String processClassRenaming(@NotNull final String previousClassName) } @Override - public void writeToBuffer(@NotNull final PacketBuffer buffer, @NotNull final OUTPUT object) throws IllegalArgumentException + public void serialize(@NotNull final PacketBuffer buffer, @NotNull final OUTPUT object) throws IllegalArgumentException { final CompoundNBT bufferCompound = serialize(object); buffer.writeCompoundTag(bufferCompound); } @Override - public OUTPUT readFromBuffer(@NotNull final PacketBuffer buffer) throws IllegalArgumentException + public OUTPUT deserialize(@NotNull final PacketBuffer buffer) throws IllegalArgumentException { final CompoundNBT bufferCompound = buffer.readCompoundTag(); return deserialize(bufferCompound); diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IAssignmentDataStore.java b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IAssignmentDataStore.java old mode 100644 new mode 100755 index 06260bfee57..86269117649 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IAssignmentDataStore.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IAssignmentDataStore.java @@ -7,15 +7,16 @@ import java.util.Map; /** - * A Key-Value-MultiMap Store that handles assignments from a Value to a Key. - * Allows multiple values to be assigned to a Key. + * A Key-Value-MultiMap Store that handles assignments from a Value to a Key. Allows multiple values to be assigned to a Key. + * * @param The key type. * @param The value type. */ -public interface IAssignmentDataStore extends IDataStore +public interface IAssignmentDataStore extends IDataStore { /** * The K to V assignments. + * * @return The assignments */ @NotNull @@ -23,6 +24,7 @@ public interface IAssignmentDataStore extends IDataStore /** * Returns the key for a value by finding the first key it is assigned to. + * * @param value The value to look for. * @return The key or null. */ diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IDataStore.java b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IDataStore.java old mode 100644 new mode 100755 index 47d58f8dbcc..82657d6e9f6 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IDataStore.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IDataStore.java @@ -9,13 +9,14 @@ public interface IDataStore { /** * Method to get the {@link IToken} used to identify this {@link IDataStore}. + * * @return The {@link IToken} for this {@link IDataStore} */ IToken getId(); /** - * Method to set the {@link IToken} used to identify this {@link IDataStore}. - * Used during creation to setup the initial Id. + * Method to set the {@link IToken} used to identify this {@link IDataStore}. Used during creation to setup the initial Id. + * * @param id The new Id. */ void setId(IToken id); diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IDataStoreManager.java b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IDataStoreManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IIdentitiesDataStore.java b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IIdentitiesDataStore.java old mode 100644 new mode 100755 index 6b03f92db9a..991e4323ba6 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IIdentitiesDataStore.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IIdentitiesDataStore.java @@ -4,6 +4,7 @@ /** * {@link IDataStore} definition for a KeyValue-Store. + * * @param The key type for the KV-Store. * @param The value type for the KV-Store. */ @@ -12,6 +13,7 @@ public interface IIdentitiesDataStore extends IDataStore /** * Method to get the identities stored in this {@link IIdentitiesDataStore} + * * @return The identities. */ BiMap getIdentities(); diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IProviderResolverAssignmentDataStore.java b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IProviderResolverAssignmentDataStore.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestIdentitiesDataStore.java b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestIdentitiesDataStore.java old mode 100644 new mode 100755 index 3779420fa95..de599bb20a3 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestIdentitiesDataStore.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestIdentitiesDataStore.java @@ -4,8 +4,7 @@ import com.minecolonies.api.colony.requestsystem.token.IToken; /** - * The KV-Store for the requests and their identities. - * Extends the {@link IIdentitiesDataStore} with {@link IToken} as key type and {@link IRequest} as value type. + * The KV-Store for the requests and their identities. Extends the {@link IIdentitiesDataStore} with {@link IToken} as key type and {@link IRequest} as value type. */ public interface IRequestIdentitiesDataStore extends IIdentitiesDataStore, IRequest> { diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestResolverIdentitiesDataStore.java b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestResolverIdentitiesDataStore.java old mode 100644 new mode 100755 index 5a4a7d21c8d..d28e846ee6e --- a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestResolverIdentitiesDataStore.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestResolverIdentitiesDataStore.java @@ -5,8 +5,7 @@ import com.minecolonies.api.colony.requestsystem.token.IToken; /** - * The KV-Store for the requests and their identities. - * Extends the {@link IIdentitiesDataStore} with {@link IToken} as key type and {@link IRequest} as value type. + * The KV-Store for the requests and their identities. Extends the {@link IIdentitiesDataStore} with {@link IToken} as key type and {@link IRequest} as value type. */ public interface IRequestResolverIdentitiesDataStore extends IIdentitiesDataStore, IRequestResolver> { diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestResolverRequestAssignmentDataStore.java b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestResolverRequestAssignmentDataStore.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestSystemBuildingDataStore.java b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestSystemBuildingDataStore.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestSystemCrafterJobDataStore.java b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestSystemCrafterJobDataStore.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestSystemDeliveryManJobDataStore.java b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestSystemDeliveryManJobDataStore.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestableTypeRequestResolverAssignmentDataStore.java b/src/api/java/com/minecolonies/api/colony/requestsystem/data/IRequestableTypeRequestResolverAssignmentDataStore.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/data/ITokenTokenAssignmentDataStore.java b/src/api/java/com/minecolonies/api/colony/requestsystem/data/ITokenTokenAssignmentDataStore.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/factory/FactoryVoidInput.java b/src/api/java/com/minecolonies/api/colony/requestsystem/factory/FactoryVoidInput.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/factory/IFactory.java b/src/api/java/com/minecolonies/api/colony/requestsystem/factory/IFactory.java old mode 100644 new mode 100755 index 168e58030c3..2d2ba52cae2 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/factory/IFactory.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/factory/IFactory.java @@ -2,6 +2,7 @@ import com.google.common.reflect.TypeToken; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import org.jetbrains.annotations.NotNull; /** @@ -35,7 +36,6 @@ public interface IFactory * @param input The input to build a new output for. * @param context The context of the request. * @return The new output instance for a given input. - * * @throws IllegalArgumentException is thrown when the factory cannot produce a new instance out of the given context and input. */ @NotNull @@ -61,4 +61,26 @@ public interface IFactory */ @NotNull Output deserialize(@NotNull IFactoryController controller, @NotNull CompoundNBT nbt) throws Throwable; + + /** + * Method to serialize a given constructable. + * + * @param controller The controller that can be used to serialize complicated types. + * @param output The request to serialize. + * @param packetBuffer The buffer to serialize into. + * @return The serialized data of the given requests. + */ + @NotNull + void serialize(@NotNull IFactoryController controller, @NotNull Output output, PacketBuffer packetBuffer); + + /** + * Method to deserialize a given constructable. + * + * @param buffer The data buffer of the request that should be deserialized. + * @param controller The controller that can be used to deserialize complicated types. + * @return The request that corresponds with the given data in the nbt + * @throws Exception if somethings goes wrong during the deserialization. + */ + @NotNull + Output deserialize(@NotNull IFactoryController controller, @NotNull PacketBuffer buffer) throws Throwable; } diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/factory/IFactoryController.java b/src/api/java/com/minecolonies/api/colony/requestsystem/factory/IFactoryController.java old mode 100644 new mode 100755 index 6b176ee82a5..33f342bb51e --- a/src/api/java/com/minecolonies/api/colony/requestsystem/factory/IFactoryController.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/factory/IFactoryController.java @@ -18,7 +18,6 @@ public interface IFactoryController * @param className The class name of the input type of the requested factory. * @param The type of input for the requested factory. * @return The factory that can handle the given input class. - * * @throws IllegalArgumentException is thrown when the given input name is unknown to this Factory Controller. */ default IFactory getFactoryForInput(@NotNull final String className) throws IllegalArgumentException @@ -45,7 +44,6 @@ public interface IFactoryController * @param clazz The class of the input type of the requested factory. * @param The type of input for the requested factory. * @return The factory that can handle the given input class. - * * @throws IllegalArgumentException is thrown when the given input class is unknown to this Factory Controller. */ IFactory getFactoryForInput(@NotNull final TypeToken clazz) throws IllegalArgumentException; @@ -58,7 +56,6 @@ public interface IFactoryController * @param The input type of the factory * @param The output type of the factory. * @return A factory that takes the input type and produces the output type. - * * @throws IllegalArgumentException Thrown when no factory exists for the combination of input and output. */ IFactory getFactoryForIO(@NotNull final TypeToken inputTypeToken, @NotNull final TypeToken outputTypeToken) @@ -70,7 +67,6 @@ IFactory getFactoryForIO(@NotNull final TypeToken * @param className The class name of the Output type of the requested factory. * @param The type of Output for the requested factory. * @return The factory that can handle the given Output class. - * * @throws IllegalArgumentException is thrown when the given Output name is unknown to this Factory Controller. */ default IFactory getFactoryForOutput(@NotNull final String className) throws IllegalArgumentException @@ -97,7 +93,6 @@ default IFactory getFactoryForOutput(@NotNull final String c * @param clazz The class of the output type of the requested factory. * @param The type of output for the requested factory. * @return The factory that can handle the given output class. - * * @throws IllegalArgumentException is thrown when the given output class is unknown to this Factory Controller. */ IFactory getFactoryForOutput(@NotNull final TypeToken clazz) throws IllegalArgumentException; @@ -115,10 +110,9 @@ default IFactory getFactoryForOutput(@NotNull final String c /** * Method used to quickly serialize a object if it is known to this controller. * - * @param object The object to serialize. + * @param object The object to serialize. * @param the output type. * @return An NBTTag containing a serialized version of the given object. - * * @throws IllegalArgumentException is thrown when the output type is unknown to this controller. */ CompoundNBT serialize(@NotNull final Output object) throws IllegalArgumentException; @@ -129,7 +123,6 @@ default IFactory getFactoryForOutput(@NotNull final String c * @param compound The data to deserialize an object from. * @param The type of object to deserialize. * @return The deserialized version of the given data. - * * @throws IllegalArgumentException is thrown when the type stored in the data is unknown to this controller. */ Output deserialize(@NotNull final CompoundNBT compound) throws IllegalArgumentException; @@ -142,7 +135,7 @@ default IFactory getFactoryForOutput(@NotNull final String c * @param The type of the object to write. * @throws IllegalArgumentException is thrown when the given output type is unknown to this controller. */ - void writeToBuffer(@NotNull final PacketBuffer buffer, @NotNull final Output object) throws IllegalArgumentException; + void serialize(@NotNull final PacketBuffer buffer, @NotNull final Output object) throws IllegalArgumentException; /** * Method used to quickly read an object from a given {@link ByteBuf} @@ -150,10 +143,9 @@ default IFactory getFactoryForOutput(@NotNull final String c * @param buffer The buffer to read from. * @param The type to read. * @return An instance of the given output type, with its stored data from the buffer. - * * @throws IllegalArgumentException is thrown when the requested type is unknown to this controller. */ - Output readFromBuffer(@NotNull final PacketBuffer buffer) throws IllegalArgumentException; + Output deserialize(@NotNull final PacketBuffer buffer) throws IllegalArgumentException; /** * Method used to create a new instance of the given input. @@ -164,7 +156,6 @@ default IFactory getFactoryForOutput(@NotNull final String c * @param The type of input. * @param The type of output. * @return The output from the factory, created by the given input and output. - * * @throws IllegalArgumentException thrown when the output and input do not match a factory known to this controller. * @throws ClassCastException thrown when a Factory is known for the given input, but does not produce the given output. */ @@ -177,16 +168,13 @@ Output getNewInstance(@NotNull final TypeToken * @param requestedType The typetoken of the requested type. * @param The type of output. * @return The output from the factory, created by the given input and output. - * * @throws IllegalArgumentException thrown when the output and input do not match a factory known to this controller. * @throws ClassCastException thrown when a Factory is known for the given input, but does not produce the given output. */ Output getNewInstance(@NotNull final TypeToken requestedType) throws IllegalArgumentException, ClassCastException; /** - * Method used to register a TypeOverride handler. - * Useful if the Client side has a different Handler. - * Or if an upgrade between version is needed. + * Method used to register a TypeOverride handler. Useful if the Client side has a different Handler. Or if an upgrade between version is needed. * * @param overrideHandler The override handler to register. * @param The output type that the handler converts to. @@ -195,8 +183,9 @@ Output getNewInstance(@NotNull final TypeToken /** * Method used to register a renaming of a class. + * * @param previousName The old class name. - * @param newName The new class name. + * @param newName The new class name. */ void registerNewClassRenaming(@NotNull final String previousName, @NotNull final String newName); } diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/factory/ITypeOverrideHandler.java b/src/api/java/com/minecolonies/api/colony/requestsystem/factory/ITypeOverrideHandler.java old mode 100644 new mode 100755 index 104da131c92..a56e6320a59 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/factory/ITypeOverrideHandler.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/factory/ITypeOverrideHandler.java @@ -6,6 +6,7 @@ public interface ITypeOverrideHandler { /** * Method used if this typeoverride handler is used to override a given type. + * * @param inputType The type to check * @return true when this handler overrides the given type, false when not. */ diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/factory/standard/IntegerFactory.java b/src/api/java/com/minecolonies/api/colony/requestsystem/factory/standard/IntegerFactory.java old mode 100644 new mode 100755 index 262a2e19741..05386bd86f4 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/factory/standard/IntegerFactory.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/factory/standard/IntegerFactory.java @@ -7,9 +7,10 @@ import com.minecolonies.api.util.constant.NbtTagConstants; import com.minecolonies.api.util.constant.TypeConstants; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import org.jetbrains.annotations.NotNull; -public class IntegerFactory implements IFactory +public class IntegerFactory implements IFactory { @NotNull @Override @@ -50,4 +51,16 @@ public Integer deserialize(@NotNull final IFactoryController controller, @NotNul { return nbt.getInt(NbtTagConstants.TAG_VALUE); } + + @Override + public void serialize(IFactoryController controller, Integer input, PacketBuffer packetBuffer) + { + packetBuffer.writeInt(input); + } + + @Override + public Integer deserialize(IFactoryController controller, PacketBuffer buffer) throws Throwable + { + return buffer.readInt(); + } } diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/factory/standard/TypeTokenFactory.java b/src/api/java/com/minecolonies/api/colony/requestsystem/factory/standard/TypeTokenFactory.java old mode 100644 new mode 100755 index d6940ff161f..c3b14a8762b --- a/src/api/java/com/minecolonies/api/colony/requestsystem/factory/standard/TypeTokenFactory.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/factory/standard/TypeTokenFactory.java @@ -8,6 +8,7 @@ import com.minecolonies.api.util.constant.NbtTagConstants; import com.minecolonies.api.util.constant.TypeConstants; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import org.jetbrains.annotations.NotNull; public class TypeTokenFactory implements IFactory, TypeToken> @@ -74,4 +75,23 @@ public TypeToken> getOutputType() return TypeConstants.TYPETOKEN; } } + + @Override + public void serialize(IFactoryController controller, TypeToken input, PacketBuffer packetBuffer) + { + packetBuffer.writeString(input.getRawType().getName()); + } + + @Override + public TypeToken deserialize(IFactoryController controller, PacketBuffer buffer) throws Throwable + { + try + { + return TypeToken.of(Class.forName(buffer.readString())); + } + catch (ClassNotFoundException e) + { + throw new IllegalStateException("Failed to create TypeToken", e); + } + } } diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/location/ILocatable.java b/src/api/java/com/minecolonies/api/colony/requestsystem/location/ILocatable.java old mode 100644 new mode 100755 index 97b252657eb..7509e287920 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/location/ILocatable.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/location/ILocatable.java @@ -10,6 +10,7 @@ public interface ILocatable /** * Getter to get the location of this locatable. + * * @return The location of the locatable. */ @NotNull diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/location/ILocation.java b/src/api/java/com/minecolonies/api/colony/requestsystem/location/ILocation.java old mode 100644 new mode 100755 index f019816b1ff..3b981d3de50 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/location/ILocation.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/location/ILocation.java @@ -32,6 +32,4 @@ public interface ILocation * @return True when reachable, false when not. */ boolean isReachableFromLocation(@NotNull ILocation location); - - } diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/location/ILocationFactory.java b/src/api/java/com/minecolonies/api/colony/requestsystem/location/ILocationFactory.java old mode 100644 new mode 100755 index 9107263c60e..6f8f1452c80 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/location/ILocationFactory.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/location/ILocationFactory.java @@ -5,8 +5,7 @@ import org.jetbrains.annotations.NotNull; /** - * Marker interface used to specify a factory for locations. - * Restricts the output type of the general factory interface to ILocation + * Marker interface used to specify a factory for locations. Restricts the output type of the general factory interface to ILocation * * @param The type of location. * @param The location type. @@ -21,7 +20,6 @@ public interface ILocationFactory extends IFactory * @param t The input to build a new output for. * @param context The context of the location. * @return The new output instance for a given input. - * * @throws IllegalArgumentException is thrown when the factory cannot produce a new instance out of the given context and input. */ @NotNull diff --git a/src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/IProviderHandler.java b/src/api/java/com/minecolonies/api/colony/requestsystem/management/IProviderHandler.java similarity index 95% rename from src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/IProviderHandler.java rename to src/api/java/com/minecolonies/api/colony/requestsystem/management/IProviderHandler.java index 239b9db81bf..421055da18e 100644 --- a/src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/IProviderHandler.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/management/IProviderHandler.java @@ -1,4 +1,4 @@ -package com.minecolonies.coremod.colony.requestsystem.management.handlers; +package com.minecolonies.api.colony.requestsystem.management; import com.minecolonies.api.colony.requestsystem.manager.IRequestManager; import com.minecolonies.api.colony.requestsystem.resolver.IRequestResolverProvider; diff --git a/src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/IRequestHandler.java b/src/api/java/com/minecolonies/api/colony/requestsystem/management/IRequestHandler.java similarity index 98% rename from src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/IRequestHandler.java rename to src/api/java/com/minecolonies/api/colony/requestsystem/management/IRequestHandler.java index 32cd6a8037a..09eee597ddf 100644 --- a/src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/IRequestHandler.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/management/IRequestHandler.java @@ -1,4 +1,4 @@ -package com.minecolonies.coremod.colony.requestsystem.management.handlers; +package com.minecolonies.api.colony.requestsystem.management; import com.minecolonies.api.colony.requestsystem.manager.AssigningStrategy; import com.minecolonies.api.colony.requestsystem.manager.IRequestManager; @@ -122,8 +122,8 @@ public interface IRequestHandler * Method used to get a registered request from a given token. * * @param token The token to query - * @throws IllegalArgumentException when the token is unknown to the given manager. * @return the request. + * @throws IllegalArgumentException when the token is unknown to the given manager. */ IRequest getRequest(IToken token); @@ -142,5 +142,4 @@ public interface IRequestHandler * @return A collection with request instances that are made by the given requester. */ Collection> getRequestsMadeByRequester(IRequester requester); - } diff --git a/src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/IResolverHandler.java b/src/api/java/com/minecolonies/api/colony/requestsystem/management/IResolverHandler.java similarity index 98% rename from src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/IResolverHandler.java rename to src/api/java/com/minecolonies/api/colony/requestsystem/management/IResolverHandler.java index 32030f43f52..1d3a1993461 100644 --- a/src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/IResolverHandler.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/management/IResolverHandler.java @@ -1,4 +1,4 @@ -package com.minecolonies.coremod.colony.requestsystem.management.handlers; +package com.minecolonies.api.colony.requestsystem.management; import com.minecolonies.api.colony.requestsystem.manager.IRequestManager; import com.minecolonies.api.colony.requestsystem.request.IRequest; diff --git a/src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/ITokenHandler.java b/src/api/java/com/minecolonies/api/colony/requestsystem/management/ITokenHandler.java similarity index 82% rename from src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/ITokenHandler.java rename to src/api/java/com/minecolonies/api/colony/requestsystem/management/ITokenHandler.java index eef397fe30a..4256577c94c 100644 --- a/src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/ITokenHandler.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/management/ITokenHandler.java @@ -1,4 +1,4 @@ -package com.minecolonies.coremod.colony.requestsystem.management.handlers; +package com.minecolonies.api.colony.requestsystem.management; import com.minecolonies.api.colony.requestsystem.manager.IRequestManager; import com.minecolonies.api.colony.requestsystem.token.IToken; diff --git a/src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/IUpdateHandler.java b/src/api/java/com/minecolonies/api/colony/requestsystem/management/IUpdateHandler.java similarity index 57% rename from src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/IUpdateHandler.java rename to src/api/java/com/minecolonies/api/colony/requestsystem/management/IUpdateHandler.java index b260df8ee29..db82d451fd3 100644 --- a/src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/IUpdateHandler.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/management/IUpdateHandler.java @@ -1,7 +1,7 @@ -package com.minecolonies.coremod.colony.requestsystem.management.handlers; +package com.minecolonies.api.colony.requestsystem.management; +import com.minecolonies.api.colony.requestsystem.management.update.UpdateType; import com.minecolonies.api.colony.requestsystem.manager.IRequestManager; -import com.minecolonies.coremod.colony.requestsystem.management.handlers.update.UpdateType; public interface IUpdateHandler { diff --git a/src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/update/UpdateType.java b/src/api/java/com/minecolonies/api/colony/requestsystem/management/update/UpdateType.java similarity index 54% rename from src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/update/UpdateType.java rename to src/api/java/com/minecolonies/api/colony/requestsystem/management/update/UpdateType.java index 72bf0688da3..47f0f0a77b7 100644 --- a/src/api/java/com/minecolonies/coremod/colony/requestsystem/management/handlers/update/UpdateType.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/management/update/UpdateType.java @@ -1,4 +1,4 @@ -package com.minecolonies.coremod.colony.requestsystem.management.handlers.update; +package com.minecolonies.api.colony.requestsystem.management.update; /** * Update types (reset, or onLoad). diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/manager/AssigningStrategy.java b/src/api/java/com/minecolonies/api/colony/requestsystem/manager/AssigningStrategy.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/manager/IRequestManager.java b/src/api/java/com/minecolonies/api/colony/requestsystem/manager/IRequestManager.java old mode 100644 new mode 100755 index c9ca4c223af..067e9570c8e --- a/src/api/java/com/minecolonies/api/colony/requestsystem/manager/IRequestManager.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/manager/IRequestManager.java @@ -14,6 +14,7 @@ import com.minecolonies.api.colony.requestsystem.token.IToken; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraftforge.common.util.INBTSerializable; import org.apache.logging.log4j.Logger; @@ -24,8 +25,7 @@ import java.util.function.Predicate; /** - * Interface used to describe classes that function as managers for requests inside a colony. - * Extends INBTSerializable to allow for easy reading and writing from NBT. + * Interface used to describe classes that function as managers for requests inside a colony. Extends INBTSerializable to allow for easy reading and writing from NBT. */ public interface IRequestManager extends INBTSerializable, ITickableTileEntity { @@ -53,7 +53,6 @@ public interface IRequestManager extends INBTSerializable, ITickabl * @param object The Object that is being requested. * @param The type of request. * @return The token representing the request. - * * @throws IllegalArgumentException is thrown when this manager cannot produce a request for the given types. */ @NotNull @@ -75,7 +74,6 @@ public interface IRequestManager extends INBTSerializable, ITickabl * @param object The requestable * @param The type of the requestable * @return The token that represents the request. - * * @throws IllegalArgumentException when either createRequest or assignRequest have thrown an IllegalArgumentException */ @NotNull @@ -89,10 +87,9 @@ default IToken createAndAssignRequest(@NotNull IRequ /** * Method used to reassign a given request. * - * @param token The token of the request that should be reassigned. + * @param token The token of the request that should be reassigned. * @param resolverTokenBlackList the blacklist. * @return The token of the resolver that has gotten the assignment, null if none was found. - * * @throws IllegalArgumentException when the token is not known to this manager. */ @Nullable @@ -103,7 +100,6 @@ default IToken createAndAssignRequest(@NotNull IRequ * * @param token The token to get a request for. * @return The request of the given type for that token. - * * @throws IllegalArgumentException when the token does not produce a request of the given type T. */ @Nullable @@ -111,9 +107,9 @@ default IToken createAndAssignRequest(@NotNull IRequ /** * Method to get a resolver from its token. + * * @param token the token. * @return The resolver registered with the given token. - * * @throws IllegalArgumentException when the token is unknown. */ @NotNull @@ -124,7 +120,6 @@ default IToken createAndAssignRequest(@NotNull IRequ * * @param requestToken The token of the request to get resolver for. * @return Null if the request is not yet resolved, or else the assigned resolver. - * * @throws IllegalArgumentException Thrown when the token is unknown. */ @Nullable @@ -141,8 +136,7 @@ default IToken createAndAssignRequest(@NotNull IRequ void updateRequestState(@NotNull IToken token, @NotNull RequestState state) throws IllegalArgumentException; /** - * Method used to overrule a request. - * Updates the state and sets the delivery if applicable. + * Method used to overrule a request. Updates the state and sets the delivery if applicable. * * @param token The token of the request that is being overruled. * @param stack The stack that should be treated as delivery. If no delivery is possible, this is null. @@ -168,6 +162,7 @@ default IToken createAndAssignRequest(@NotNull IRequ /** * Method used to indicate that a colony has updated their available items. + * * @param shouldTriggerReassign The request assigned */ void onColonyUpdate(@NotNull final Predicate> shouldTriggerReassign); @@ -190,6 +185,7 @@ default IToken createAndAssignRequest(@NotNull IRequ /** * Get the data store manager. + * * @return The data store manager. */ @NotNull @@ -202,12 +198,14 @@ default IToken createAndAssignRequest(@NotNull IRequ /** * Checks if dirty and needs to be updated. + * * @return true if so. */ boolean isDirty(); /** * Sets if dirty and needs to be updated. + * * @param isDirty true if so. */ void setDirty(boolean isDirty); @@ -217,5 +215,26 @@ default IToken createAndAssignRequest(@NotNull IRequ */ void markDirty(); + /** + * Get a logger. + * + * @return a logger. + */ Logger getLogger(); + + /** + * serialize this request manager to the give {@link PacketBuffer} + * + * @param controller the controller. + * @param buffer the {@link PacketBuffer} to serialize to. + */ + void serialize(final IFactoryController controller, final PacketBuffer buffer); + + /** + * deserialize this request manager from the give {@link PacketBuffer} + * + * @param controller the controller. + * @param buffer the {@link PacketBuffer} to deserialize from. + */ + void deserialize(final IFactoryController controller, final PacketBuffer buffer); } diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/manager/RequestMappingHandler.java b/src/api/java/com/minecolonies/api/colony/requestsystem/manager/RequestMappingHandler.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/request/IRequest.java b/src/api/java/com/minecolonies/api/colony/requestsystem/request/IRequest.java old mode 100644 new mode 100755 index c8a390a27d9..702cf92dd62 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/request/IRequest.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/request/IRequest.java @@ -46,8 +46,7 @@ default AssigningStrategy getStrategy() > T getId(); /** - * Used to determine which type of request this is. - * Only RequestResolvers for this Type are then used to resolve the this. + * Used to determine which type of request this is. Only RequestResolvers for this Type are then used to resolve the this. * * @return The class that represents this Type of Request. */ @@ -63,8 +62,7 @@ default AssigningStrategy getStrategy() RequestState getState(); /** - * Setter for the current state of this request. - * It is not recommended to call this method from outside of the request management system. + * Setter for the current state of this request. It is not recommended to call this method from outside of the request management system. * * @param manager the request manager. * @param state The new state of this request. @@ -80,11 +78,9 @@ default AssigningStrategy getStrategy() IRequester getRequester(); /** - * Return the object that is actually requested. - * A RequestResolver can compare this object however way it sees fit. + * Return the object that is actually requested. A RequestResolver can compare this object however way it sees fit. *

- * During the resolving process this object is called multiple times. But at least twice. - * A cached implementation is preferred. + * During the resolving process this object is called multiple times. But at least twice. A cached implementation is preferred. * * @return The object that is actually requested. */ @@ -114,8 +110,7 @@ default AssigningStrategy getStrategy() boolean hasResult(); /** - * Returns the parent of this request. - * If this is set it means that this request is part of request chain. + * Returns the parent of this request. If this is set it means that this request is part of request chain. * * @param generic token. * @return The parent of this request, or null if it has no parent. @@ -194,8 +189,7 @@ default AssigningStrategy getStrategy() boolean hasChildren(); /** - * Method to get the children of this request. - * Immutable. + * Method to get the children of this request. Immutable. * * @return An immutable collection of the children of this request. */ @@ -227,21 +221,21 @@ default AssigningStrategy getStrategy() /** * Sets the deliveries of this request to the given stacks - * + * * @param stacks The stacks that will be the deliveries. */ void overrideCurrentDeliveries(@NotNull final ImmutableList stacks); /** * Adds a single stack as a delivery to this request. - * + * * @param stack The stack that should be treated as a new delivery. */ void addDelivery(@NotNull final ItemStack stack); /** - * Method used to get a {@link ITextComponent} that can be displayed to the Player and describes the request in short. - * Should represent the request, in case the player needs to fulfill it, or information about this request is required. + * Method used to get a {@link ITextComponent} that can be displayed to the Player and describes the request in short. Should represent the request, in case the player needs to + * fulfill it, or information about this request is required. * * @return The text that describes this Request. */ @@ -249,8 +243,8 @@ default AssigningStrategy getStrategy() ITextComponent getShortDisplayString(); /** - * Method used to get a {@link ITextComponent} that can be displayed to the Player and describes so that the player can complete it. - * Should represent the request, in case the player needs to fulfill it, or information about this request is required. + * Method used to get a {@link ITextComponent} that can be displayed to the Player and describes so that the player can complete it. Should represent the request, in case the + * player needs to fulfill it, or information about this request is required. * * @return The text that describes this Request. */ @@ -258,8 +252,7 @@ default AssigningStrategy getStrategy() ITextComponent getLongDisplayString(); /** - * Method used to get a List of ItemStacks that represents the stack. - * This list is used in GUI to show what the request is. If an empty list is returned then no stack is shown. + * Method used to get a List of ItemStacks that represents the stack. This list is used in GUI to show what the request is. If an empty list is returned then no stack is shown. * If a list with multiple stacks is returned it will switch between the stacks once every second unless the player holds the shift key. * * @return A List of ItemStacks that represents this request. diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/request/IRequestFactory.java b/src/api/java/com/minecolonies/api/colony/requestsystem/request/IRequestFactory.java old mode 100644 new mode 100755 index 79f33a38844..5465e7ea237 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/request/IRequestFactory.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/request/IRequestFactory.java @@ -8,8 +8,7 @@ import org.jetbrains.annotations.NotNull; /** - * Marker interface used to specify a factory for requests. - * Restricts the output type of the general factory interface to IRequest + * Marker interface used to specify a factory for requests. Restricts the output type of the general factory interface to IRequest * * @param The type of request. * @param The request type. @@ -26,7 +25,6 @@ public interface IRequestFactory> * @param t The input to build a new output for. * @param context The context of the request. * @return The new output instance for a given input. - * * @throws IllegalArgumentException is thrown when the factory cannot produce a new instance out of the given context and input. */ @NotNull diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/request/RequestState.java b/src/api/java/com/minecolonies/api/colony/requestsystem/request/RequestState.java old mode 100644 new mode 100755 index 0f164c5b20f..6a54828e53c --- a/src/api/java/com/minecolonies/api/colony/requestsystem/request/RequestState.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/request/RequestState.java @@ -1,6 +1,7 @@ package com.minecolonies.api.colony.requestsystem.request; import net.minecraft.nbt.IntNBT; +import net.minecraft.network.PacketBuffer; import java.util.ArrayList; import java.util.Collections; @@ -37,8 +38,7 @@ public enum RequestState IN_PROGRESS, /** - * States for a request who's primary processing has been completed. - * Followup processing still needs to be determined. + * States for a request who's primary processing has been completed. Followup processing still needs to be determined. */ RESOLVED, @@ -102,7 +102,7 @@ public enum RequestState * @param nbt The nbt to deserialize from. * @return The RequestState that is stored in the given NBT. */ - public static RequestState deserializeNBT(final IntNBT nbt) + public static RequestState deserialize(final IntNBT nbt) { return indexList.get(nbt.getInt()); } @@ -112,10 +112,29 @@ public static RequestState deserializeNBT(final IntNBT nbt) * * @return The NBT representation of the state. */ - public IntNBT serializeNBT() + public IntNBT serialize() { return IntNBT.valueOf(indexList.indexOf(this)); } + /** + * Method used to deserialize a RequestState from a packet buffer + * + * @param buffer The buffer to deserialize from. + * @return The RequestState that is stored in the given NBT. + */ + public static RequestState deserialize(final PacketBuffer buffer) + { + return indexList.get(buffer.readInt()); + } + /** + * Method used to serialize a state to a packet buffer. + * + * @param buffer The buffer to write to. + */ + public void serialize(PacketBuffer buffer) + { + buffer.writeInt(indexList.indexOf(this)); + } } diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Burnable.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Burnable.java old mode 100644 new mode 100755 index 4a9d2608087..97067f820f2 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Burnable.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Burnable.java @@ -4,12 +4,12 @@ import com.minecolonies.api.util.ItemStackUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.FurnaceTileEntity; import org.jetbrains.annotations.NotNull; /** - * Burnable requestable. - * Delivers a stack of burnable fuel. + * Burnable requestable. Delivers a stack of burnable fuel. */ public class Burnable implements IDeliverable { @@ -31,19 +31,33 @@ public Burnable(final int count, @NotNull final ItemStack result) this.result = result; } - public static CompoundNBT serialize(final IFactoryController controller, final Burnable food) + /** + * Serialize the deliverable. + * + * @param controller the controller. + * @param burnable the input. + * @return the compound. + */ + public static CompoundNBT serialize(final IFactoryController controller, final Burnable burnable) { final CompoundNBT compound = new CompoundNBT(); - compound.putInt(NBT_COUNT, food.count); + compound.putInt(NBT_COUNT, burnable.count); - if (!ItemStackUtils.isEmpty(food.result)) + if (!ItemStackUtils.isEmpty(burnable.result)) { - compound.put(NBT_RESULT, food.result.serializeNBT()); + compound.put(NBT_RESULT, burnable.result.serializeNBT()); } return compound; } + /** + * Deserialize the deliverable. + * + * @param controller the controller. + * @param compound the compound. + * @return the deliverable. + */ public static Burnable deserialize(final IFactoryController controller, final CompoundNBT compound) { final int count = compound.getInt(NBT_COUNT); @@ -52,6 +66,39 @@ public static Burnable deserialize(final IFactoryController controller, final Co return new Burnable(count, result); } + /** + * Serialize the deliverable. + * + * @param controller the controller. + * @param buffer the the buffer to write to. + * @param input the input to serialize. + */ + public static void serialize(final IFactoryController controller, final PacketBuffer buffer, final Burnable input) + { + buffer.writeInt(input.count); + + buffer.writeBoolean(!ItemStackUtils.isEmpty(input.result)); + if (!ItemStackUtils.isEmpty(input.result)) + { + buffer.writeItemStack(input.result); + } + } + + /** + * Deserialize the deliverable. + * + * @param controller the controller. + * @param buffer the buffer to read. + * @return the deliverable. + */ + public static Burnable deserialize(final IFactoryController controller, final PacketBuffer buffer) + { + final int count = buffer.readInt(); + final ItemStack result = buffer.readBoolean() ? buffer.readItemStack() : ItemStack.EMPTY; + + return new Burnable(count, result); + } + @Override public boolean matches(@NotNull final ItemStack stack) { diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Food.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Food.java old mode 100644 new mode 100755 index 5c88169f087..abb51c424a2 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Food.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Food.java @@ -4,11 +4,11 @@ import com.minecolonies.api.util.ItemStackUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import org.jetbrains.annotations.NotNull; /** - * Eatable requestable. - * Delivers a stack of food. + * Eatable requestable. Delivers a stack of food. */ public class Food implements IDeliverable { @@ -31,6 +31,13 @@ public Food(final int count, @NotNull final ItemStack result) this.result = result; } + /** + * Serialize the deliverable. + * + * @param controller the controller. + * @param food the input. + * @return the compound. + */ public static CompoundNBT serialize(final IFactoryController controller, final Food food) { final CompoundNBT compound = new CompoundNBT(); @@ -44,6 +51,13 @@ public static CompoundNBT serialize(final IFactoryController controller, final F return compound; } + /** + * Deserialize the deliverable. + * + * @param controller the controller. + * @param compound the compound. + * @return the deliverable. + */ public static Food deserialize(final IFactoryController controller, final CompoundNBT compound) { final int count = compound.getInt(NBT_COUNT); @@ -52,6 +66,39 @@ public static Food deserialize(final IFactoryController controller, final Compou return new Food(count, result); } + /** + * Serialize the deliverable. + * + * @param controller the controller. + * @param buffer the the buffer to write to. + * @param input the input to serialize. + */ + public static void serialize(final IFactoryController controller, final PacketBuffer buffer, final Food input) + { + buffer.writeInt(input.count); + + buffer.writeBoolean(!ItemStackUtils.isEmpty(input.result)); + if (!ItemStackUtils.isEmpty(input.result)) + { + buffer.writeItemStack(input.result); + } + } + + /** + * Deserialize the deliverable. + * + * @param controller the controller. + * @param buffer the buffer to read. + * @return the deliverable. + */ + public static Food deserialize(final IFactoryController controller, final PacketBuffer buffer) + { + final int count = buffer.readInt(); + final ItemStack result = buffer.readBoolean() ? buffer.readItemStack() : ItemStack.EMPTY; + + return new Food(count, result); + } + @Override public boolean matches(@NotNull final ItemStack stack) { diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/IDeliverable.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/IDeliverable.java old mode 100644 new mode 100755 index 7f4e09cbf2e..c5ab1b9dd09 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/IDeliverable.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/IDeliverable.java @@ -9,8 +9,7 @@ public interface IDeliverable extends IRetryable { /** - * Method called to check if a given stack matches this deliverable. - * The first stack that returns true from this method is returned as a Deliverable. + * Method called to check if a given stack matches this deliverable. The first stack that returns true from this method is returned as a Deliverable. * * @param stack The stack to test. * @return true when the stack matches. False when not. @@ -48,6 +47,7 @@ public interface IDeliverable extends IRetryable /** * Creates a new instance of this requestable with the given count. + * * @param newCount The new requestable, with the requested count. * @return the deliverable. */ diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/IRequestable.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/IRequestable.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/IRetryable.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/IRetryable.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Stack.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Stack.java old mode 100644 new mode 100755 index 2f2c57991e7..eeb9eea51ef --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Stack.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Stack.java @@ -5,6 +5,7 @@ import com.minecolonies.api.util.ItemStackUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import org.jetbrains.annotations.NotNull; import java.util.Collections; @@ -57,6 +58,7 @@ public class Stack implements IDeliverable /** * Create a Stack deliverable. + * * @param stack the required stack. */ public Stack(@NotNull final ItemStack stack) @@ -66,8 +68,9 @@ public Stack(@NotNull final ItemStack stack) /** * Create a Stack deliverable. - * @param stack the required stack. - * @param count the count. + * + * @param stack the required stack. + * @param count the count. * @param minCount the min count. */ public Stack(@NotNull final ItemStack stack, final int count, final int minCount) @@ -77,6 +80,7 @@ public Stack(@NotNull final ItemStack stack, final int count, final int minCount /** * Transform an itemStorage into this predicate. + * * @param itemStorage the storage to use. */ public Stack(@NotNull final ItemStorage itemStorage) @@ -86,22 +90,23 @@ public Stack(@NotNull final ItemStorage itemStorage) /** * Create a Stack deliverable. - * @param stack the required stack. - * @param matchMeta if meta has to be matched. - * @param matchNBT if NBT has to be matched. + * + * @param stack the required stack. + * @param matchMeta if meta has to be matched. + * @param matchNBT if NBT has to be matched. * @param matchOreDic if the oredict has to be matched. - * @param result the result stack. - * @param count the count. - * @param minCount the min count. + * @param result the result stack. + * @param count the count. + * @param minCount the min count. */ public Stack( - @NotNull final ItemStack stack, - final boolean matchMeta, - final boolean matchNBT, - final boolean matchOreDic, - @NotNull final ItemStack result , - final int count, - final int minCount) + @NotNull final ItemStack stack, + final boolean matchMeta, + final boolean matchNBT, + final boolean matchOreDic, + @NotNull final ItemStack result, + final int count, + final int minCount) { if (ItemStackUtils.isEmpty(stack)) { @@ -119,8 +124,9 @@ public Stack( /** * Serialize the deliverable. + * * @param controller the controller. - * @param input the input. + * @param input the input. * @return the compound. */ public static CompoundNBT serialize(final IFactoryController controller, final Stack input) @@ -142,8 +148,9 @@ public static CompoundNBT serialize(final IFactoryController controller, final S /** * Deserialize the deliverable. + * * @param controller the controller. - * @param compound the compound. + * @param compound the compound. * @return the deliverable. */ public static Stack deserialize(final IFactoryController controller, final CompoundNBT compound) @@ -165,6 +172,51 @@ public static Stack deserialize(final IFactoryController controller, final Compo return new Stack(stack, matchMeta, matchNBT, matchOreDic, result, count, minCount); } + /** + * Serialize the deliverable. + * + * @param controller the controller. + * @param buffer the the buffer to write to. + * @param input the input to serialize. + */ + public static void serialize(final IFactoryController controller, final PacketBuffer buffer, final Stack input) + { + buffer.writeItemStack(input.theStack); + buffer.writeBoolean(input.matchMeta); + buffer.writeBoolean(input.matchNBT); + buffer.writeBoolean(input.matchOreDic); + + buffer.writeBoolean(!ItemStackUtils.isEmpty(input.result)); + if (!ItemStackUtils.isEmpty(input.result)) + { + buffer.writeItemStack(input.result); + } + buffer.writeInt(input.getCount()); + buffer.writeInt(input.getMinimumCount()); + } + + /** + * Deserialize the deliverable. + * + * @param controller the controller. + * @param buffer the buffer to read. + * @return the deliverable. + */ + public static Stack deserialize(final IFactoryController controller, final PacketBuffer buffer) + { + final ItemStack stack = buffer.readItemStack(); + final boolean matchMeta = buffer.readBoolean(); + final boolean matchNBT = buffer.readBoolean(); + final boolean matchOreDic = buffer.readBoolean(); + + final ItemStack result = buffer.readBoolean() ? buffer.readItemStack() : ItemStack.EMPTY; + + int count = buffer.readInt(); + int minCount = buffer.readInt(); + + return new Stack(stack, matchMeta, matchNBT, matchOreDic, result, count, minCount); + } + @Override public boolean matches(@NotNull final ItemStack stack) { diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/StackList.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/StackList.java old mode 100644 new mode 100755 index ccbe75069df..6b484d80971 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/StackList.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/StackList.java @@ -5,6 +5,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; +import net.minecraft.network.PacketBuffer; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -74,9 +75,10 @@ public class StackList implements IDeliverable /** * Create a Stacks deliverable. - * @param stacks the required stacks. + * + * @param stacks the required stacks. * @param description the description. - * @param count the count. + * @param count the count. */ public StackList(@NotNull final List stacks, final String description, final int count) { @@ -85,10 +87,11 @@ public StackList(@NotNull final List stacks, final String description /** * Create a Stacks deliverable. - * @param stacks the required stacks. + * + * @param stacks the required stacks. * @param description the description. - * @param count the count. - * @param minCount the min count. + * @param count the count. + * @param minCount the min count. */ public StackList(@NotNull final List stacks, final String description, final int count, final int minCount) { @@ -97,24 +100,25 @@ public StackList(@NotNull final List stacks, final String description /** * Create a Stacks deliverable. - * @param stacks the required stacks. - * @param matchMeta if meta has to be matched. - * @param matchNBT if NBT has to be matched. + * + * @param stacks the required stacks. + * @param matchMeta if meta has to be matched. + * @param matchNBT if NBT has to be matched. * @param matchOreDic if the oredict has to be matched. - * @param result the result stack. + * @param result the result stack. * @param description the description. - * @param count the count. - * @param minCount the min count. + * @param count the count. + * @param minCount the min count. */ public StackList( - @NotNull final List stacks, - final boolean matchMeta, - final boolean matchNBT, - final boolean matchOreDic, - @NotNull final ItemStack result, - final String description, - final int count, - final int minCount) + @NotNull final List stacks, + final boolean matchMeta, + final boolean matchNBT, + final boolean matchOreDic, + @NotNull final ItemStack result, + final String description, + final int count, + final int minCount) { this.description = description; for (final ItemStack stack : stacks) @@ -135,8 +139,9 @@ public StackList( /** * Serialize the deliverable. + * * @param controller the controller. - * @param input the input. + * @param input the input. * @return the compound. */ public static CompoundNBT serialize(final IFactoryController controller, final StackList input) @@ -166,8 +171,9 @@ public static CompoundNBT serialize(final IFactoryController controller, final S /** * Deserialize the deliverable. + * * @param controller the controller. - * @param compound the compound. + * @param compound the compound. * @return the deliverable. */ public static StackList deserialize(final IFactoryController controller, final CompoundNBT compound) @@ -197,6 +203,60 @@ public static StackList deserialize(final IFactoryController controller, final C return new StackList(stacks, matchMeta, matchNBT, matchOreDic, result, desc, count, minCount); } + /** + * Serialize the deliverable. + * + * @param controller the controller. + * @param buffer the the buffer to write to. + * @param input the input to serialize. + */ + public static void serialize(final IFactoryController controller, final PacketBuffer buffer, final StackList input) + { + buffer.writeInt(input.theStacks.size()); + input.theStacks.forEach(res -> buffer.writeItemStack(res)); + + buffer.writeBoolean(input.matchMeta); + buffer.writeBoolean(input.matchNBT); + buffer.writeBoolean(input.matchOreDic); + + buffer.writeBoolean(!ItemStackUtils.isEmpty(input.result)); + if (!ItemStackUtils.isEmpty(input.result)) + { + buffer.writeItemStack(input.result); + } + buffer.writeString(input.description); + buffer.writeInt(input.getCount()); + buffer.writeInt(input.getMinimumCount()); + } + + /** + * Deserialize the deliverable. + * + * @param controller the controller. + * @param buffer the buffer to read. + * @return the deliverable. + */ + public static StackList deserialize(final IFactoryController controller, final PacketBuffer buffer) + { + final List stacks = new ArrayList<>(); + + final int stacksSize = buffer.readInt(); + for (int i = 0; i < stacksSize; ++i) + { + stacks.add(buffer.readItemStack()); + } + + final boolean matchMeta = buffer.readBoolean(); + final boolean matchNBT = buffer.readBoolean(); + final boolean matchOreDic = buffer.readBoolean(); + final ItemStack result = buffer.readBoolean() ? buffer.readItemStack() : ItemStack.EMPTY; + final String desc = buffer.readString(); + int count = buffer.readInt(); + int minCount = buffer.readInt(); + + return new StackList(stacks, matchMeta, matchNBT, matchOreDic, result, desc, count, minCount); + } + @Override public boolean matches(@NotNull final ItemStack stack) { @@ -308,6 +368,7 @@ public int hashCode() /** * Getter for the display description of the list. + * * @return the description. */ public String getDescription() diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Tag.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Tag.java index f6e20bcacf1..2d6172674f5 100644 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Tag.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Tag.java @@ -5,6 +5,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import net.minecraft.tags.ItemTags; import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.NotNull; @@ -203,6 +204,29 @@ public static CompoundNBT serialize(final IFactoryController controller, final T return compound; } + public static void serialize(final IFactoryController controller, final PacketBuffer buffer, final Tag input) + { + buffer.writeString(input.getTag().getId().toString()); + buffer.writeBoolean(!ItemStackUtils.isEmpty(input.getResult())); + + if (!ItemStackUtils.isEmpty(input.getResult())) + { + buffer.writeItemStack(input.getResult()); + } + buffer.writeInt(input.getCount()); + buffer.writeInt(input.getMinimumCount()); + } + + public static Tag deserialize(final IFactoryController controller, final PacketBuffer buffer) + { + final net.minecraft.tags.Tag theTag = ItemTags.getCollection().getOrCreate(ResourceLocation.tryCreate(buffer.readString())); + final ItemStack result = buffer.readBoolean() ? buffer.readItemStack() : ItemStack.EMPTY; + final int count = buffer.readInt(); + final int minCount = buffer.readInt(); + + return new Tag(theTag, result, count, minCount); + } + /** * Deserialize the deliverable. * diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Tool.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Tool.java old mode 100644 new mode 100755 index db838e4fad2..404dc1b0bf9 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Tool.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/Tool.java @@ -8,6 +8,7 @@ import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.*; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import org.jetbrains.annotations.NotNull; import java.util.HashSet; @@ -56,7 +57,7 @@ public Tool(@NotNull final IToolType toolClass, @NotNull final Integer minLevel, * Serializes this Tool into NBT. * * @param controller The IFactoryController used to serialize sub types. - * @param tool the tool to serialize. + * @param tool the tool to serialize. * @return The CompoundNBT containing the tool data. */ @NotNull @@ -72,6 +73,61 @@ public static CompoundNBT serialize(final IFactoryController controller, final T return compound; } + /** + * Static method that constructs an instance from NBT. + * + * @param controller The {@link IFactoryController} to deserialize components with. + * @param nbt The nbt to serialize from. + * @return An instance of Tool with the data contained in the given NBT. + */ + @NotNull + public static Tool deserialize(final IFactoryController controller, final CompoundNBT nbt) + { + //API:Map the given strings a proper way. + final IToolType type = ToolType.getToolType(nbt.getString(NBT_TYPE)); + final Integer minLevel = nbt.getInt(NBT_MIN_LEVEL); + final Integer maxLevel = nbt.getInt(NBT_MAX_LEVEL); + final ItemStack result = ItemStack.read(nbt.getCompound(NBT_RESULT)); + + return new Tool(type, minLevel, maxLevel, result); + } + + /** + * Serialize the deliverable. + * + * @param controller the controller. + * @param buffer the the buffer to write to. + * @param input the input to serialize. + */ + public static void serialize(final IFactoryController controller, final PacketBuffer buffer, final Tool input) + { + buffer.writeString(input.getToolClass().getName()); + buffer.writeInt(input.getMinLevel()); + buffer.writeInt(input.getMaxLevel()); + buffer.writeBoolean(!ItemStackUtils.isEmpty(input.result)); + if (!ItemStackUtils.isEmpty(input.result)) + { + buffer.writeItemStack(input.result); + } + } + + /** + * Deserialize the deliverable. + * + * @param controller the controller. + * @param buffer the buffer to read. + * @return the deliverable. + */ + public static Tool deserialize(final IFactoryController controller, final PacketBuffer buffer) + { + final IToolType type = ToolType.getToolType(buffer.readString()); + final int minLevel = buffer.readInt(); + final int maxLevel = buffer.readInt(); + final ItemStack result = buffer.readBoolean() ? buffer.readItemStack() : ItemStack.EMPTY; + + return new Tool(type, minLevel, maxLevel, result); + } + /** * Returns the tool class that is requested. * @@ -103,7 +159,9 @@ public Integer getMinLevel() public Integer getMaxLevel() { return maxLevel; - } /** + } + + /** * The resulting stack if set during creation, else ItemStack.Empty. * * @return The resulting stack. @@ -114,35 +172,19 @@ public ItemStack getResult() return result; } - /** - * Static method that constructs an instance from NBT. - * - * @param controller The {@link IFactoryController} to deserialize components with. - * @param nbt The nbt to serialize from. - * @return An instance of Tool with the data contained in the given NBT. - */ - @NotNull - public static Tool deserialize(final IFactoryController controller, final CompoundNBT nbt) - { - //API:Map the given strings a proper way. - final IToolType type = ToolType.getToolType(nbt.getString(NBT_TYPE)); - final Integer minLevel = nbt.getInt(NBT_MIN_LEVEL); - final Integer maxLevel = nbt.getInt(NBT_MAX_LEVEL); - final ItemStack result = ItemStack.read(nbt.getCompound(NBT_RESULT)); - - return new Tool(type, minLevel, maxLevel, result); - } - @Override public boolean matches(@NotNull final ItemStack stack) { //API:Map the given strings a proper way. final boolean toolTypeResult = !ItemStackUtils.isEmpty(stack) - && stack.getCount() >= 1 - && getToolClasses(stack).stream() - .filter(s -> getToolClass().getName().equalsIgnoreCase(s)) - .map(ToolType::getToolType) - .anyMatch(t -> t != ToolType.NONE && (stack.getDamage() > 0 || !stack.isDamaged()) && ItemStackUtils.hasToolLevel(stack, t, getMinLevel(), getMaxLevel())); + && stack.getCount() >= 1 + && getToolClasses(stack).stream() + .filter(s -> getToolClass().getName().equalsIgnoreCase(s)) + .map(ToolType::getToolType) + .anyMatch(t -> t != ToolType.NONE && (stack.getDamage() > 0 || !stack.isDamaged()) && ItemStackUtils.hasToolLevel(stack, + t, + getMinLevel(), + getMaxLevel())); if (!toolTypeResult) { @@ -156,38 +198,38 @@ private Set getToolClasses(final ItemStack stack) { final Set set = new HashSet<>(); - if(ItemStackUtils.isEmpty(stack)) + if (ItemStackUtils.isEmpty(stack)) { return set; } set.addAll(stack.getItem().getToolTypes(stack).stream().map(net.minecraftforge.common.ToolType::getName).collect(Collectors.toList())); - if(stack.getItem() instanceof BowItem) + if (stack.getItem() instanceof BowItem) { set.add("bow"); } - else if(stack.getItem() instanceof SwordItem || Compatibility.isTinkersWeapon(stack)) + else if (stack.getItem() instanceof SwordItem || Compatibility.isTinkersWeapon(stack)) { set.add("weapon"); } - else if(stack.getItem() instanceof HoeItem) + else if (stack.getItem() instanceof HoeItem) { set.add("hoe"); } - else if(stack.getItem() instanceof FishingRodItem) + else if (stack.getItem() instanceof FishingRodItem) { set.add("rod"); } - else if(stack.getItem() instanceof ShearsItem) + else if (stack.getItem() instanceof ShearsItem) { set.add("shears"); } - else if(stack.getItem() instanceof ShieldItem) + else if (stack.getItem() instanceof ShieldItem) { set.add("shield"); } - else if(stack.getItem() instanceof ArmorItem) + else if (stack.getItem() instanceof ArmorItem) { /* * There is no armor class for each type of armor. @@ -218,6 +260,7 @@ else if (armor.getEquipmentSlot() == EquipmentSlotType.LEGS) /** * Check if the tool is armor. + * * @return true if so. */ public boolean isArmor() diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/crafting/AbstractCrafting.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/crafting/AbstractCrafting.java old mode 100644 new mode 100755 index 343083f93fd..0ae15f0a79f --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/crafting/AbstractCrafting.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/crafting/AbstractCrafting.java @@ -13,9 +13,9 @@ public abstract class AbstractCrafting implements IRequestable { ////// --------------------------- NBTConstants --------------------------- \\\\\\ - protected static final String NBT_STACK = "Stack"; - protected static final String NBT_COUNT = "Count"; - protected static final String NBT_MIN_COUNT = "Count"; + protected static final String NBT_STACK = "Stack"; + protected static final String NBT_COUNT = "Count"; + protected static final String NBT_MIN_COUNT = "Count"; ////// --------------------------- NBTConstants --------------------------- \\\\\\ /** @@ -36,8 +36,9 @@ public abstract class AbstractCrafting implements IRequestable /** * Create a Stack deliverable. - * @param stack the required stack. - * @param count the crafting count. + * + * @param stack the required stack. + * @param count the crafting count. * @param minCount the min crafting count. */ public AbstractCrafting(@NotNull final ItemStack stack, final int count, final int minCount) @@ -62,6 +63,7 @@ public ItemStack getStack() /** * Get the count to fulfill. + * * @return the count. */ public int getCount() @@ -71,6 +73,7 @@ public int getCount() /** * Get the min count to fulfill. + * * @return the min count. */ public int getMinCount() diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/crafting/PrivateCrafting.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/crafting/PrivateCrafting.java old mode 100644 new mode 100755 index 8a04caf428a..61c5e7c19b4 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/crafting/PrivateCrafting.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/crafting/PrivateCrafting.java @@ -4,6 +4,7 @@ import com.minecolonies.api.util.ItemStackUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import org.jetbrains.annotations.NotNull; public class PrivateCrafting extends AbstractCrafting @@ -11,8 +12,8 @@ public class PrivateCrafting extends AbstractCrafting /** * Create a Stack deliverable. * - * @param stack the required stack. - * @param count the crafting count. + * @param stack the required stack. + * @param count the crafting count. * @param minCount the min count. */ public PrivateCrafting(@NotNull final ItemStack stack, final int count, final int minCount) @@ -32,7 +33,7 @@ public static CompoundNBT serialize(final IFactoryController controller, final P final CompoundNBT compound = new CompoundNBT(); compound.put(NBT_STACK, input.getStack().serializeNBT()); compound.putInt(NBT_COUNT, input.getCount()); - compound.putInt(NBT_MIN_COUNT, input.getCount()); + compound.putInt(NBT_MIN_COUNT, input.getMinCount()); return compound; } @@ -52,4 +53,34 @@ public static PrivateCrafting deserialize(final IFactoryController controller, f return new PrivateCrafting(stack, count, minCount == 0 ? count : minCount); } + + /** + * Serialize the deliverable. + * + * @param controller the controller. + * @param buffer the the buffer to write to. + * @param input the input to serialize. + */ + public static void serialize(final IFactoryController controller, final PacketBuffer buffer, final PrivateCrafting input) + { + buffer.writeItemStack(input.getStack()); + buffer.writeInt(input.getCount()); + buffer.writeInt(input.getMinCount()); + } + + /** + * Deserialize the deliverable. + * + * @param controller the controller. + * @param buffer the buffer to read. + * @return the deliverable. + */ + public static PrivateCrafting deserialize(final IFactoryController controller, final PacketBuffer buffer) + { + final ItemStack stack = buffer.readItemStack(); + final int count = buffer.readInt(); + final int minCount = buffer.readInt(); + + return new PrivateCrafting(stack, count, minCount == 0 ? count : minCount); + } } diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/crafting/PublicCrafting.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/crafting/PublicCrafting.java old mode 100644 new mode 100755 index 0399ec8075a..e25fc281573 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/crafting/PublicCrafting.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/crafting/PublicCrafting.java @@ -4,6 +4,7 @@ import com.minecolonies.api.util.ItemStackUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import org.jetbrains.annotations.NotNull; public class PublicCrafting extends AbstractCrafting @@ -49,4 +50,32 @@ public static PublicCrafting deserialize(final IFactoryController controller, fi return new PublicCrafting(stack, count); } + + /** + * Serialize the deliverable. + * + * @param controller the controller. + * @param buffer the the buffer to write to. + * @param input the input to serialize. + */ + public static void serialize(final IFactoryController controller, final PacketBuffer buffer, final PublicCrafting input) + { + buffer.writeItemStack(input.getStack()); + buffer.writeInt(input.getCount()); + } + + /** + * Deserialize the deliverable. + * + * @param controller the controller. + * @param buffer the buffer to read. + * @return the deliverable. + */ + public static PublicCrafting deserialize(final IFactoryController controller, final PacketBuffer buffer) + { + final ItemStack stack = buffer.readItemStack(); + final int count = buffer.readInt(); + + return new PublicCrafting(stack, count); + } } diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/AbstractDeliverymanRequestable.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/AbstractDeliverymanRequestable.java old mode 100644 new mode 100755 index 2f7f05ce728..789696f85ac --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/AbstractDeliverymanRequestable.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/AbstractDeliverymanRequestable.java @@ -27,11 +27,9 @@ protected AbstractDeliverymanRequestable(final int priority) } /** - * Scales the priority to the desired internal value. - * This is used so that the actual priorities are not just 1-10, but i.e. 1-100 (x^2) - * This will effectively make the aging-algorithm, which always increments by 1, slower. - * The function can be anything - a linear scaler, quadratic, exponential, whatever. - * Adapt over time to find the best solution. + * Scales the priority to the desired internal value. This is used so that the actual priorities are not just 1-10, but i.e. 1-100 (x^2) This will effectively make the + * aging-algorithm, which always increments by 1, slower. The function can be anything - a linear scaler, quadratic, exponential, whatever. Adapt over time to find the best + * solution. */ public static int scaledPriority(final int priority) { @@ -42,8 +40,7 @@ public static int scaledPriority(final int priority) } /** - * Gets the maximum priority allowed to be set in the building GUI. - * This is the "normal" setting available to players. + * Gets the maximum priority allowed to be set in the building GUI. This is the "normal" setting available to players. * * @param returnScaled true if the value should be returned scaled * @return the scaled/unscaled priority @@ -54,8 +51,7 @@ public static int getMaxBuildingPriority(final boolean returnScaled) } /** - * Gets the priority given to deliveries. - * This affects follow-up deliveries from crafters, and deliveries from the warehouse. + * Gets the priority given to deliveries. This affects follow-up deliveries from crafters, and deliveries from the warehouse. * * @param returnScaled true if the value should be returned scaled * @return the scaled/unscaled priority @@ -66,8 +62,7 @@ public static int getDefaultDeliveryPriority(final boolean returnScaled) } /** - * Gets the maximum priority the aging mechanism can assign. - * After that, priorities can not naturally increase. + * Gets the maximum priority the aging mechanism can assign. After that, priorities can not naturally increase. * * @param returnScaled true if the value should be returned scaled * @return the scaled/unscaled priority @@ -78,8 +73,7 @@ public static int getMaxAgingPriority(final boolean returnScaled) } /** - * Gets the priority given to the Request-Pickup-Now-feature - * TODO: Eventually, this should also affect the Postbox. + * Gets the priority given to the Request-Pickup-Now-feature TODO: Eventually, this should also affect the Postbox. * * @param returnScaled true if the value should be returned scaled * @return the scaled/unscaled priority diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/Delivery.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/Delivery.java old mode 100644 new mode 100755 index 514c6b19245..74ecf09ed38 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/Delivery.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/Delivery.java @@ -5,11 +5,11 @@ import com.minecolonies.api.util.ItemStackUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import org.jetbrains.annotations.NotNull; /** - * Class used to represent deliveries inside the request system. - * This class can be used to request a getDelivery of a given ItemStack from a source to a target. + * Class used to represent deliveries inside the request system. This class can be used to request a getDelivery of a given ItemStack from a source to a target. */ public class Delivery extends AbstractDeliverymanRequestable { @@ -56,6 +56,49 @@ public static CompoundNBT serialize(@NotNull final IFactoryController controller return compound; } + @NotNull + public static Delivery deserialize(@NotNull final IFactoryController controller, @NotNull final CompoundNBT compound) + { + final ILocation start = controller.deserialize(compound.getCompound(NBT_START)); + final ILocation target = controller.deserialize(compound.getCompound(NBT_TARGET)); + final ItemStack stack = ItemStackUtils.deserializeFromNBT(compound.getCompound(NBT_STACK)); + final int priority = controller.deserialize(compound.getCompound(NBT_PRIORITY)); + + return new Delivery(start, target, stack, priority); + } + + /** + * Serialize the deliverable. + * + * @param controller the controller. + * @param buffer the the buffer to write to. + * @param input the input to serialize. + */ + public static void serialize(final IFactoryController controller, final PacketBuffer buffer, final Delivery input) + { + controller.serialize(buffer, input.getStack()); + controller.serialize(buffer, input.getTarget()); + buffer.writeItemStack(input.getStack()); + buffer.writeInt(input.getPriority()); + } + + /** + * Deserialize the deliverable. + * + * @param controller the controller. + * @param buffer the buffer to read. + * @return the deliverable. + */ + public static Delivery deserialize(final IFactoryController controller, final PacketBuffer buffer) + { + final ILocation start = controller.deserialize(buffer); + final ILocation target = controller.deserialize(buffer); + final ItemStack stack = buffer.readItemStack(); + final int priority = buffer.readInt(); + + return new Delivery(start, target, stack, priority); + } + @NotNull public ILocation getStart() { @@ -74,17 +117,6 @@ public ItemStack getStack() return stack; } - @NotNull - public static Delivery deserialize(@NotNull final IFactoryController controller, @NotNull final CompoundNBT compound) - { - final ILocation start = controller.deserialize(compound.getCompound(NBT_START)); - final ILocation target = controller.deserialize(compound.getCompound(NBT_TARGET)); - final ItemStack stack = ItemStackUtils.deserializeFromNBT(compound.getCompound(NBT_STACK)); - final int priority = controller.deserialize(compound.getCompound(NBT_PRIORITY)); - - return new Delivery(start, target, stack, priority); - } - @Override public boolean equals(final Object o) { diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/IDeliverymanRequestable.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/IDeliverymanRequestable.java old mode 100644 new mode 100755 index 9c9c7668563..9539deec9ab --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/IDeliverymanRequestable.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/IDeliverymanRequestable.java @@ -8,16 +8,14 @@ public interface IDeliverymanRequestable extends IRequestable { /** - * Returns the priority of the Requestable. - * The higher the priority, the more urgent it is and the faster a deliveryman will handle it. + * Returns the priority of the Requestable. The higher the priority, the more urgent it is and the faster a deliveryman will handle it. * * @return The current priority of the request */ int getPriority(); /** - * This will increment the priority due to the aging algorithm. - * This is important because it prevents starvation, making older requests successively more important. + * This will increment the priority due to the aging algorithm. This is important because it prevents starvation, making older requests successively more important. */ void incrementPriorityDueToAging(); } diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/Pickup.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/Pickup.java old mode 100644 new mode 100755 index d9d2cfa30ae..d36f1b827dd --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/Pickup.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requestable/deliveryman/Pickup.java @@ -2,11 +2,11 @@ import com.minecolonies.api.colony.requestsystem.factory.IFactoryController; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import org.jetbrains.annotations.NotNull; /** - * Class used to represent pickups inside the request system. - * This class can be used to request a pickup of + * Class used to represent pickups inside the request system. This class can be used to request a pickup of */ public class Pickup extends AbstractDeliverymanRequestable { @@ -36,6 +36,32 @@ public static Pickup deserialize(@NotNull final IFactoryController controller, @ return new Pickup(priority); } + /** + * Serialize the deliverable. + * + * @param controller the controller. + * @param buffer the the buffer to write to. + * @param input the input to serialize. + */ + public static void serialize(final IFactoryController controller, final PacketBuffer buffer, final Pickup input) + { + buffer.writeInt(input.getPriority()); + } + + /** + * Deserialize the deliverable. + * + * @param controller the controller. + * @param buffer the buffer to read. + * @return the deliverable. + */ + public static Pickup deserialize(final IFactoryController controller, final PacketBuffer buffer) + { + final int priority = buffer.readInt(); + + return new Pickup(priority); + } + @Override public boolean equals(final Object o) { diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requester/IRequester.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requester/IRequester.java old mode 100644 new mode 100755 index e4d6591b374..a5c8dc315ce --- a/src/api/java/com/minecolonies/api/colony/requestsystem/requester/IRequester.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/requester/IRequester.java @@ -29,6 +29,7 @@ public interface IRequester /** * Method called by the request system to notify this requester that a request is complete. + * * @param manager the request manager. * @param request the request. */ @@ -36,6 +37,7 @@ public interface IRequester /** * Method called by the request system to notify this requester that a request has been overruled. + * * @param manager the request manager. * @param request the request. */ diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/requester/IRequesterFactory.java b/src/api/java/com/minecolonies/api/colony/requestsystem/requester/IRequesterFactory.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/IQueuedRequestResolver.java b/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/IQueuedRequestResolver.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/IRequestResolver.java b/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/IRequestResolver.java old mode 100644 new mode 100755 index cd3872157b7..1e24ff2a6b9 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/IRequestResolver.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/IRequestResolver.java @@ -14,9 +14,7 @@ import java.util.function.Predicate; /** - * Used to resolve a request. - * In a colony multiple resolvers can exist for a given type R. - * The resolver with the highest priority is checked first, then second and so forth. + * Used to resolve a request. In a colony multiple resolvers can exist for a given type R. The resolver with the highest priority is checked first, then second and so forth. *

* The resolver himself is responsible for storing the tokens of requests that he returns * @@ -33,8 +31,7 @@ public interface IRequestResolver extends IRequester TypeToken getRequestType(); /** - * A PreCheck used to determine if this request resolver is able to resolve a given request. - * Should quickly and cheaply check if this resolver COULD resolve this request. + * A PreCheck used to determine if this request resolver is able to resolve a given request. Should quickly and cheaply check if this resolver COULD resolve this request. * * @param requestToCheck The request to check. * @param manager The manager that is checking if this resolver could resolve that request. @@ -45,15 +42,13 @@ public interface IRequestResolver extends IRequester /** * Method used to attempt a resolving operation. *

- * When this attempt was successful a List with tokens of required requests is returned. - * This list maybe empty. - * The list should indicate all sub requests that should be fullfilled before the @code{resolve(IRequest request)} method is called. + * When this attempt was successful a List with tokens of required requests is returned. This list maybe empty. The list should indicate all sub requests that should be + * fullfilled before the @code{resolve(IRequest request)} method is called. *

- * When this attempt was not successful, eg. this resolver could not schedule a crafting operation, a Null object should be returned. - * In that case the next resolver will be tried by the manager. + * When this attempt was not successful, eg. this resolver could not schedule a crafting operation, a Null object should be returned. In that case the next resolver will be + * tried by the manager. *

- * IT IS VITAL THAT THE REQUEST RETURNED ARE NOT YET ASSIGNED. SIMULATION AND OTHER STRATEGIES WILL FAIL ELSE! - * THE MANAGER GIVEN WILL HANDLE ASSIGNING HIMSELF! + * IT IS VITAL THAT THE REQUEST RETURNED ARE NOT YET ASSIGNED. SIMULATION AND OTHER STRATEGIES WILL FAIL ELSE! THE MANAGER GIVEN WILL HANDLE ASSIGNING HIMSELF! * * @param manager The manager that is attempting to resolve using this resolver. * @param request The request to resolve. @@ -63,26 +58,25 @@ public interface IRequestResolver extends IRequester List> attemptResolveRequest(@NotNull IRequestManager manager, @NotNull IRequest request); /** - * Method used to resolve a given request. - * Is called the moment all Child requests are resolved. + * Method used to resolve a given request. Is called the moment all Child requests are resolved. *

* The resolver should update the state through the given manager. *

- * When this method is called all requirements need be fullfilled for this resolver. - * If this is not the case it will throw a RunTimeException + * When this method is called all requirements need be fullfilled for this resolver. If this is not the case it will throw a RunTimeException * * @param request The request to resolve. * @param manager The manager that is resolving this request, under normal conditions this is the colony manager. - * @throws RuntimeException is thrown when the resolver could not resolve the request. Should never happen as attemptResolve should be called first, - * and all requirements should be available to this resolver at this point in time. + * @throws RuntimeException is thrown when the resolver could not resolve the request. Should never happen as attemptResolve should be called first, and all requirements should + * be available to this resolver at this point in time. */ @Nullable void resolveRequest(@NotNull IRequestManager manager, @NotNull IRequest request); /** * Called by the manager given to indicate that this request has been assigned to you. - * @param manager The systems manager. - * @param request The request assigned. + * + * @param manager The systems manager. + * @param request The request assigned. * @param simulation True when simulating. */ default void onRequestAssigned(@NotNull final IRequestManager manager, @NotNull final IRequest request, boolean simulation) @@ -91,8 +85,7 @@ default void onRequestAssigned(@NotNull final IRequestManager manager, @NotNull } /** - * Indicates that a assigned request has been cancelled. - * Is called before graph is updated. + * Indicates that a assigned request has been cancelled. Is called before graph is updated. * * @param manager The manager that indicates the cancelling * @param request The request that has been cancelled. @@ -100,8 +93,7 @@ default void onRequestAssigned(@NotNull final IRequestManager manager, @NotNull void onAssignedRequestBeingCancelled(@NotNull IRequestManager manager, @NotNull IRequest request); /** - * Indicates that a assigned request has been cancelled. - * Is called after the graph has been updated. + * Indicates that a assigned request has been cancelled. Is called after the graph has been updated. * * @param manager The manager that indicates the cancelling * @param request The request that has been cancelled. @@ -110,7 +102,8 @@ default void onRequestAssigned(@NotNull final IRequestManager manager, @NotNull /** * Called by manager given to indicate that a colony has updated their available items. - * @param manager The systems manager. + * + * @param manager The systems manager. * @param shouldTriggerReassign The request assigned */ default void onColonyUpdate(@NotNull final IRequestManager manager, @NotNull final Predicate> shouldTriggerReassign) @@ -125,8 +118,7 @@ default List> getFollowupRequestForCompletion(@NotNull IRequestManag } /** - * The priority of this resolver. - * The higher the priority the earlier this resolver is called. + * The priority of this resolver. The higher the priority the earlier this resolver is called. * * @return The priority of this resolver. */ diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/IRequestResolverFactory.java b/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/IRequestResolverFactory.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/IRequestResolverProvider.java b/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/IRequestResolverProvider.java old mode 100644 new mode 100755 index cce0f4c8556..6bff776f9e0 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/IRequestResolverProvider.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/IRequestResolverProvider.java @@ -4,8 +4,7 @@ import com.minecolonies.api.colony.requestsystem.token.IToken; /** - * Interface used to describe a class that provides resolvers. - * Should be put on Buildings, Citizens etc who can resolve certain requests. + * Interface used to describe a class that provides resolvers. Should be put on Buildings, Citizens etc who can resolve certain requests. *

* If a provider is added to his or her colony */ diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/player/IPlayerRequestResolver.java b/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/player/IPlayerRequestResolver.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/retrying/IRetryingRequestResolver.java b/src/api/java/com/minecolonies/api/colony/requestsystem/resolver/retrying/IRetryingRequestResolver.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/token/AbstractTokenFactory.java b/src/api/java/com/minecolonies/api/colony/requestsystem/token/AbstractTokenFactory.java old mode 100644 new mode 100755 index 2671d0efe56..de1433c9187 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/token/AbstractTokenFactory.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/token/AbstractTokenFactory.java @@ -4,6 +4,7 @@ import com.minecolonies.api.colony.requestsystem.factory.IFactoryController; import com.minecolonies.api.util.constant.TypeConstants; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import org.jetbrains.annotations.NotNull; import java.util.UUID; @@ -62,4 +63,20 @@ public StandardToken deserialize(@NotNull final IFactoryController controller, @ return new StandardToken(id); } + + @Override + public void serialize(IFactoryController controller, StandardToken input, PacketBuffer packetBuffer) + { + packetBuffer.writeLong(input.getIdentifier().getLeastSignificantBits()); + packetBuffer.writeLong(input.getIdentifier().getMostSignificantBits()); + } + + @Override + public StandardToken deserialize(IFactoryController controller, PacketBuffer buffer) throws Throwable + { + final long lsb = buffer.readLong(); + final long msb = buffer.readLong(); + final UUID id = new UUID(msb, lsb); + return new StandardToken(id); + } } diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/token/IToken.java b/src/api/java/com/minecolonies/api/colony/requestsystem/token/IToken.java old mode 100644 new mode 100755 index 89c0ff4dca7..9d2963b217b --- a/src/api/java/com/minecolonies/api/colony/requestsystem/token/IToken.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/token/IToken.java @@ -3,8 +3,7 @@ /** * Interface used to represent a request outside of the request management system. *

- * Allows for simple storage of all open requests of a building, a worker etc, without having to - * store the whole request twice. + * Allows for simple storage of all open requests of a building, a worker etc, without having to store the whole request twice. *

* Also extends INBTSerializable to make writing the data to disk a lot easier. */ diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/token/ITokenFactory.java b/src/api/java/com/minecolonies/api/colony/requestsystem/token/ITokenFactory.java old mode 100644 new mode 100755 index 56e3b8ddd84..d9d4b696e48 --- a/src/api/java/com/minecolonies/api/colony/requestsystem/token/ITokenFactory.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/token/ITokenFactory.java @@ -5,8 +5,7 @@ import org.jetbrains.annotations.NotNull; /** - * Marker interface used to specify a factory for requesttokens. - * Restricts the output type of the general factory interface to IToken + * Marker interface used to specify a factory for requesttokens. Restricts the output type of the general factory interface to IToken * * @param The type of requesttoken. * @param The requesttoken type. @@ -21,7 +20,6 @@ public interface ITokenFactory> extends IFactory * @param t The input to build a new output for. * @param context The context of the token. * @return The new output instance for a given input. - * * @throws IllegalArgumentException is thrown when the factory cannot produce a new instance out of the given context and input. */ @NotNull diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/token/InitializedTokenFactory.java b/src/api/java/com/minecolonies/api/colony/requestsystem/token/InitializedTokenFactory.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/token/RandomSeededTokenFactory.java b/src/api/java/com/minecolonies/api/colony/requestsystem/token/RandomSeededTokenFactory.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/token/StandardToken.java b/src/api/java/com/minecolonies/api/colony/requestsystem/token/StandardToken.java old mode 100644 new mode 100755 index bdfdbb532b1..de4e3d4149d --- a/src/api/java/com/minecolonies/api/colony/requestsystem/token/StandardToken.java +++ b/src/api/java/com/minecolonies/api/colony/requestsystem/token/StandardToken.java @@ -5,8 +5,7 @@ import java.util.UUID; /** - * Internal implementation of the IToken interface. - * Uses UUID to store the ID of the request. + * Internal implementation of the IToken interface. Uses UUID to store the ID of the request. */ public class StandardToken implements IToken { diff --git a/src/api/java/com/minecolonies/api/colony/requestsystem/token/StandardTokenFactory.java b/src/api/java/com/minecolonies/api/colony/requestsystem/token/StandardTokenFactory.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/workorders/IWorkManager.java b/src/api/java/com/minecolonies/api/colony/workorders/IWorkManager.java old mode 100644 new mode 100755 index 1843f240750..0b752e65e6e --- a/src/api/java/com/minecolonies/api/colony/workorders/IWorkManager.java +++ b/src/api/java/com/minecolonies/api/colony/workorders/IWorkManager.java @@ -32,8 +32,7 @@ public interface IWorkManager * @param id the id of the work order. * @param type the class of the expected type of the work order. * @param the type of work order to return. - * @return the work order of the specified id, or null if it was not found - * or is of an incompatible type. + * @return the work order of the specified id, or null if it was not found or is of an incompatible type. */ @Nullable W getWorkOrder(int id, @NotNull Class type); @@ -51,8 +50,7 @@ public interface IWorkManager * * @param type the class of the type of work order to find. * @param the type of work order to return. - * @return an unclaimed work order of the given type, or null if no - * unclaimed work order of the type was found. + * @return an unclaimed work order of the given type, or null if no unclaimed work order of the type was found. */ @Nullable W getUnassignedWorkOrder(@NotNull Class type); @@ -75,8 +73,7 @@ public interface IWorkManager Map getWorkOrders(); /** - * When a citizen is removed, unclaim any Work Orders that were claimed by - * that citizen. + * When a citizen is removed, unclaim any Work Orders that were claimed by that citizen. * * @param citizen Citizen to unclaim work for. */ @@ -105,8 +102,7 @@ public interface IWorkManager void addWorkOrder(@NotNull IWorkOrder order, boolean readingFromNbt); /** - * Process updates on the Colony Tick. - * Currently, does periodic Work Order cleanup. + * Process updates on the Colony Tick. Currently, does periodic Work Order cleanup. * * @param colony colony which ticks. */ @@ -115,9 +111,9 @@ public interface IWorkManager /** * Get an ordered list by priority of the work orders. * - * @param type the type of workOrder which is required. + * @param type the type of workOrder which is required. * @param builder the builder wanting to claim it. - * @param the type. + * @param the type. * @return the list. */ List getOrderedList(@NotNull Class type, BlockPos builder); diff --git a/src/api/java/com/minecolonies/api/colony/workorders/IWorkOrder.java b/src/api/java/com/minecolonies/api/colony/workorders/IWorkOrder.java old mode 100644 new mode 100755 index 17a654293f3..bc61f5673cf --- a/src/api/java/com/minecolonies/api/colony/workorders/IWorkOrder.java +++ b/src/api/java/com/minecolonies/api/colony/workorders/IWorkOrder.java @@ -14,8 +14,9 @@ public interface IWorkOrder { /** * Read the WorkOrder data from the CompoundNBT. - * @param compound NBT Tag compound - * @param manager the workManager calling this method. + * + * @param compound NBT Tag compound + * @param manager the workManager calling this method. */ void read(@NotNull CompoundNBT compound, IWorkManager manager); @@ -85,6 +86,7 @@ public interface IWorkOrder /** * Set the Work order as claimed by a given building. + * * @param builder the building position. */ void setClaimedBy(BlockPos builder); @@ -104,9 +106,7 @@ public interface IWorkOrder /** * Is this WorkOrder still valid? If not, it will be deleted. *

- * Suppressing Sonar Rule squid:S1172 - * This rule does " Unused method parameters should be removed" - * But in this case extending class may need to use the colony parameter + * Suppressing Sonar Rule squid:S1172 This rule does " Unused method parameters should be removed" But in this case extending class may need to use the colony parameter * * @param colony The colony that owns the Work Order * @return True if the WorkOrder is still valid, or False if it should be deleted @@ -136,7 +136,7 @@ public interface IWorkOrder *

* Override this when something need to be done when the work order is completed * - * @param colony in which the work order exist + * @param colony in which the work order exist * @param citizen citizen that completed the work order */ void onCompleted(IColony colony, ICitizenData citizen); diff --git a/src/api/java/com/minecolonies/api/colony/workorders/WorkOrderType.java b/src/api/java/com/minecolonies/api/colony/workorders/WorkOrderType.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/colony/workorders/WorkOrderView.java b/src/api/java/com/minecolonies/api/colony/workorders/WorkOrderView.java old mode 100644 new mode 100755 index a8799129788..b41e14415a2 --- a/src/api/java/com/minecolonies/api/colony/workorders/WorkOrderView.java +++ b/src/api/java/com/minecolonies/api/colony/workorders/WorkOrderView.java @@ -5,10 +5,8 @@ import org.jetbrains.annotations.NotNull; /** - * The WorkOrderView is the client-side representation of a WorkOrders. Views - * contain the WorkOrder's data that is relevant to a Client, in a more - * client-friendly form Mutable operations on a View result in a message to the - * server to perform the operation + * The WorkOrderView is the client-side representation of a WorkOrders. Views contain the WorkOrder's data that is relevant to a Client, in a more client-friendly form Mutable + * operations on a View result in a message to the server to perform the operation */ public class WorkOrderView { @@ -113,8 +111,7 @@ public BlockPos getClaimedBy() } /** - * Deserialize the attributes and variables from transition. - * Buffer may be not readable because the workOrderView may be null. + * Deserialize the attributes and variables from transition. Buffer may be not readable because the workOrderView may be null. * * @param buf Byte buffer to deserialize. */ @@ -130,6 +127,7 @@ public void deserialize(@NotNull final PacketBuffer buf) /** * Get the position of the workorder. + * * @return the position */ public BlockPos getPos() diff --git a/src/api/java/com/minecolonies/api/compatibility/Compatibility.java b/src/api/java/com/minecolonies/api/compatibility/Compatibility.java old mode 100644 new mode 100755 index 3479cbdc239..b41a3b81085 --- a/src/api/java/com/minecolonies/api/compatibility/Compatibility.java +++ b/src/api/java/com/minecolonies/api/compatibility/Compatibility.java @@ -30,8 +30,7 @@ private Compatibility() } /** - * This method checks to see if STACK is able to mine anything. - * It goes through all compatibility checks. + * This method checks to see if STACK is able to mine anything. It goes through all compatibility checks. * * @param stack the item in question. * @param tool the name of the tool. @@ -142,6 +141,7 @@ public static boolean isPamsInstalled() /** * Check if dynamic tree's is present + * * @return the dynamic trees. */ public static boolean isDynTreePresent() @@ -161,6 +161,7 @@ public static String getDynamicTreeDamage() /** * Check if block is a Dynamic tree + * * @param block the block to check. * @return true if so. */ @@ -171,6 +172,7 @@ public static boolean isDynamicBlock(final Block block) /** * Check if block is a Dynamic Leaf + * * @param block the block to check. * @return true if so. */ @@ -198,7 +200,7 @@ public static boolean isDynamicTrunkShell(final Block block) * @param blockState Blockstate of the Leaf * @param fortune amount of fortune to use * @param leaf The leaf to check - * @return the list of drops + * @return the list of drops */ public static NonNullList getDropsForDynamicLeaf(final IWorld world, final BlockPos pos, final BlockState blockState, final int fortune, final Block leaf) { @@ -259,7 +261,7 @@ public static boolean isDynamicTreeSapling(final ItemStack stack) * * @param block1 First blockpos to compare * @param block2 Second blockpos to compare - * @param world the world to check. + * @param world the world to check. * @return true when same family */ public static boolean isDynamicFamilyFitting(final BlockPos block1, final BlockPos block2, final IWorld world) diff --git a/src/api/java/com/minecolonies/api/compatibility/CompatibilityManager.java b/src/api/java/com/minecolonies/api/compatibility/CompatibilityManager.java old mode 100644 new mode 100755 index d9204e1befb..1515e238f62 --- a/src/api/java/com/minecolonies/api/compatibility/CompatibilityManager.java +++ b/src/api/java/com/minecolonies/api/compatibility/CompatibilityManager.java @@ -5,10 +5,7 @@ import com.minecolonies.api.IMinecoloniesAPI; import com.minecolonies.api.MinecoloniesAPIProxy; import com.minecolonies.api.crafting.ItemStorage; -import com.minecolonies.api.util.BlockStateStorage; -import com.minecolonies.api.util.Disease; -import com.minecolonies.api.util.Log; -import com.minecolonies.api.util.NBTUtils; +import com.minecolonies.api.util.*; import net.minecraft.block.*; import net.minecraft.enchantment.EnchantmentData; import net.minecraft.item.*; @@ -21,7 +18,6 @@ import net.minecraft.tags.ItemTags; import net.minecraft.tileentity.FurnaceTileEntity; import net.minecraft.util.ResourceLocation; -import com.minecolonies.api.util.Tuple; import net.minecraftforge.common.Tags; import net.minecraftforge.common.util.Constants; import net.minecraftforge.registries.ForgeRegistries; @@ -47,15 +43,14 @@ public class CompatibilityManager implements ICompatibilityManager private final Map leavesToSaplingMap = new HashMap<>(); /** - * List of saplings. - * Works on client and server-side. + * List of saplings. Works on client and server-side. */ private final List saplings = new ArrayList<>(); /** * List of properties we're ignoring when comparing leaves. */ - private final List> leafCompareWithoutProperties = ImmutableList.of(checkDecay, decayable, DYN_PROP_HYDRO,TREE_DISTANCE); + private final List> leafCompareWithoutProperties = ImmutableList.of(checkDecay, decayable, DYN_PROP_HYDRO, TREE_DISTANCE); /** * Properties for leaves we're ignoring upon comparing. @@ -63,11 +58,10 @@ public class CompatibilityManager implements ICompatibilityManager private static final BooleanProperty checkDecay = BooleanProperty.create("check_decay"); private static final BooleanProperty decayable = BooleanProperty.create("decayable"); public static final IntegerProperty DYN_PROP_HYDRO = IntegerProperty.create("hydro", 1, 4); - public static final IntegerProperty TREE_DISTANCE = IntegerProperty.create("distance", 1, 7); + public static final IntegerProperty TREE_DISTANCE = IntegerProperty.create("distance", 1, 7); /** - * List of all ore-like blocks. - * Works on client and server-side. + * List of all ore-like blocks. Works on client and server-side. */ private final Set oreBlocks = new HashSet<>(); @@ -235,7 +229,8 @@ public boolean isCompost(final ItemStack itemStack) return false; } - if (itemStack.getItem().isFood() || (itemStack.getItem() instanceof BlockItem && (((BlockItem) itemStack.getItem()).getBlock() instanceof CropsBlock || ((BlockItem) itemStack.getItem()).getBlock() instanceof StemBlock))) + if (itemStack.getItem().isFood() || (itemStack.getItem() instanceof BlockItem && (((BlockItem) itemStack.getItem()).getBlock() instanceof CropsBlock + || ((BlockItem) itemStack.getItem()).getBlock() instanceof StemBlock))) { return true; } @@ -506,7 +501,8 @@ public Tuple getRandomEnchantmentBook(final int buildingLeve { ench = list.get(random.nextInt(list.size())); } - return new Tuple<>(EnchantedBookItem.getEnchantedItemStack(new EnchantmentData(ForgeRegistries.ENCHANTMENTS.getValue(new ResourceLocation(ench.getA())), ench.getB())), ench.getB()); + return new Tuple<>(EnchantedBookItem.getEnchantedItemStack(new EnchantmentData(ForgeRegistries.ENCHANTMENTS.getValue(new ResourceLocation(ench.getA())), ench.getB())), + ench.getB()); } //------------------------------- Private Utility Methods -------------------------------// diff --git a/src/api/java/com/minecolonies/api/compatibility/ICompatibilityManager.java b/src/api/java/com/minecolonies/api/compatibility/ICompatibilityManager.java old mode 100644 new mode 100755 index 59e9319a7a5..e4de14767c6 --- a/src/api/java/com/minecolonies/api/compatibility/ICompatibilityManager.java +++ b/src/api/java/com/minecolonies/api/compatibility/ICompatibilityManager.java @@ -2,10 +2,10 @@ import com.minecolonies.api.crafting.ItemStorage; import com.minecolonies.api.util.Disease; +import com.minecolonies.api.util.Tuple; import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; -import com.minecolonies.api.util.Tuple; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -14,26 +14,28 @@ import java.util.Set; /** - * Interface for all compatabilityManagers. - * The compatability manager retrieves certain blocks from oreData and stores them. + * Interface for all compatabilityManagers. The compatability manager retrieves certain blocks from oreData and stores them. */ public interface ICompatibilityManager { /** * Getter for the different meshes the sifter is allowed to use. + * * @return a copy of the list of tuples containing the itemStorage and the chance of it breaking. */ List> getMeshes(); /** * Getter for the blocks which can be sieved. + * * @return a copy of the list of itemStorages. */ ArrayList getSievableBlock(); /** * Get a random item return for a certain mesh and certain block which is in the sieve. - * @param mesh the used mesh. + * + * @param mesh the used mesh. * @param block the used block. * @return the ItemStack. */ @@ -41,12 +43,14 @@ public interface ICompatibilityManager /** * Method called to instantiate the requirements. + * * @param serverSide if server side (true) or client side (false). */ void discover(final boolean serverSide); /** * Gets the sapling matching a leave. + * * @param block the leave. * @return the sapling stack. */ @@ -54,30 +58,35 @@ public interface ICompatibilityManager /** * Get a copy of the list of saplings. + * * @return the list of saplings. */ List getCopyOfSaplings(); /** * Get a set of all fuel items. + * * @return an immutable set. */ Set getFuel(); /** * Get a set of all food items. + * * @return an immutable set. */ Set getFood(); /** * Get a set of all smeltable ores. + * * @return an immutable set. */ Set getSmeltableOres(); /** * Check if a stack belongs to a minable ore. + * * @param stack the stack to test. * @return true if so. */ @@ -85,24 +94,28 @@ public interface ICompatibilityManager /** * Get a copy of the list of compostable items. + * * @return the list of compostable items. */ List getCopyOfCompostableItems(); /** * Get a copy of the list of plantables. + * * @return the list of plantables. */ List getCopyOfPlantables(); /** * Get a random disease of the compat manager. + * * @return a randomly chosen disease. */ String getRandomDisease(); /** * Get a disease by the ID. + * * @param disease the id. * @return the disease. */ @@ -110,12 +123,14 @@ public interface ICompatibilityManager /** * Get the list of diseases. + * * @return a copy of the list. */ List getDiseases(); /** * Checks if a certain Block is an ore. + * * @param block the block to check. * @return boolean if so. */ @@ -123,6 +138,7 @@ public interface ICompatibilityManager /** * Test if an itemStack is an ore. + * * @param stack the stack to test. * @return true if so. */ @@ -130,12 +146,14 @@ public interface ICompatibilityManager /** * Get a list of all blocks. + * * @return the immutable list. */ List getBlockList(); /** * Test if an itemStack is compostable + * * @param stack the stack to test * @return true if so */ @@ -143,6 +161,7 @@ public interface ICompatibilityManager /** * Get a map of all the crusher modes. + * * @return the modes. */ Map getCrusherModes(); @@ -163,6 +182,7 @@ public interface ICompatibilityManager /** * Connect a certain block as leave to an ItemStack as sapling. + * * @param block the block to connect the sapling to. * @param stack the sapling. */ @@ -170,12 +190,14 @@ public interface ICompatibilityManager /** * If discovery process ran already. + * * @return true if so. */ boolean isDiscoveredAlready(); /** * Test if an itemStack is plantable for the florist. + * * @param itemStack the stack to check. * @return true if so. */ @@ -183,6 +205,7 @@ public interface ICompatibilityManager /** * If an itemStack is a lucky block which can result in an extra ore drop. + * * @param itemStack the stack to check. * @return true if so. */ @@ -190,6 +213,7 @@ public interface ICompatibilityManager /** * Get a random lucky ore from a luckyblock. + * * @param chanceBonus the chance bonus. * @return the lucky ore. */ @@ -197,6 +221,7 @@ public interface ICompatibilityManager /** * Get a random enchantment book for a certain building level. + * * @param buildingLevel the building level. * @return a tuple containing the stack and the level applied to it. */ diff --git a/src/api/java/com/minecolonies/api/compatibility/IFurnaceRecipes.java b/src/api/java/com/minecolonies/api/compatibility/IFurnaceRecipes.java old mode 100644 new mode 100755 index 956ce7666af..0b903f5301f --- a/src/api/java/com/minecolonies/api/compatibility/IFurnaceRecipes.java +++ b/src/api/java/com/minecolonies/api/compatibility/IFurnaceRecipes.java @@ -12,14 +12,15 @@ public interface IFurnaceRecipes { /** - * Set the map. - * This is called from the client side message. + * Set the map. This is called from the client side message. + * * @param map the map to set. */ void setMap(final Map map); /** * Get the smelting result for a certain itemStack. + * * @param itemStack the itemStack to test. * @return the result or empty if not existent. */ diff --git a/src/api/java/com/minecolonies/api/compatibility/candb/AbstractChiselAndBitsProxy.java b/src/api/java/com/minecolonies/api/compatibility/candb/AbstractChiselAndBitsProxy.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/compatibility/candb/ChiselAndBitsCheck.java b/src/api/java/com/minecolonies/api/compatibility/candb/ChiselAndBitsCheck.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/compatibility/dynamictrees/DynamicTreeCompat.java b/src/api/java/com/minecolonies/api/compatibility/dynamictrees/DynamicTreeCompat.java old mode 100644 new mode 100755 index 86477f48014..b6f1f500e71 --- a/src/api/java/com/minecolonies/api/compatibility/dynamictrees/DynamicTreeCompat.java +++ b/src/api/java/com/minecolonies/api/compatibility/dynamictrees/DynamicTreeCompat.java @@ -26,6 +26,7 @@ private DynamicTreeCompat() /** * Check whether dynamic tree's mod is present + * * @return true */ @Override @@ -266,7 +267,7 @@ protected boolean hasFittingTreeFamilyCompat(@NotNull final BlockPos block1, @No * * @param block1 First blockpos to compare * @param block2 Second blockpos to compare - * @param world the world. + * @param world the world. * @return true when same family */ public static boolean hasFittingTreeFamily(@NotNull final BlockPos block1, @NotNull final BlockPos block2, @NotNull final IWorld world) diff --git a/src/api/java/com/minecolonies/api/compatibility/dynamictrees/DynamicTreeProxy.java b/src/api/java/com/minecolonies/api/compatibility/dynamictrees/DynamicTreeProxy.java old mode 100644 new mode 100755 index 62ee72ece2d..7b8f5387f30 --- a/src/api/java/com/minecolonies/api/compatibility/dynamictrees/DynamicTreeProxy.java +++ b/src/api/java/com/minecolonies/api/compatibility/dynamictrees/DynamicTreeProxy.java @@ -16,6 +16,7 @@ public class DynamicTreeProxy { /** * Default method for when dynamic Tree's mod is not present, returns false + * * @return true if so. */ protected boolean isDynamicTreePresent() @@ -59,11 +60,11 @@ protected boolean checkForDynamicTrunkShellBlock(final Block block) /** * Get the list of Drops from a Dynamic leaf * - * @param leaf The leaf to check - * @param world the world it is in. - * @param pos the pos of the block. + * @param leaf The leaf to check + * @param world the world it is in. + * @param pos the pos of the block. * @param blockstate the blockstate to check. - * @param fortune the fortune effect. + * @param fortune the fortune effect. * @return {@link NonNullList} of {@link ItemStack} Drops */ protected NonNullList getDropsForLeaf( @@ -87,19 +88,21 @@ protected boolean checkForDynamicSapling(final Item item) /** * Default method when dynamic tree's isnt present - * @param world the world it is in. + * + * @param world the world it is in. * @param blockToBreak the block position. - * @param toolToUse the tool - * @param workerPos the pos of the worker + * @param toolToUse the tool + * @param workerPos the pos of the worker * @return Null */ protected Runnable getTreeBreakActionCompat(final World world, final BlockPos blockToBreak, final ItemStack toolToUse, final BlockPos workerPos) {return null;} /** * Default method for trying to plant a dynamic sapling when the mod isnt present. - * @param world the world it is in. + * + * @param world the world it is in. * @param location the position. - * @param sapling the sapling stack. + * @param sapling the sapling stack. * @return false */ protected boolean plantDynamicSaplingCompat(final World world, final BlockPos location, final ItemStack sapling) {return false;} @@ -109,7 +112,7 @@ protected boolean checkForDynamicSapling(final Item item) * * @param block1 First blockpos to compare * @param block2 Second blockpos to compare - * @param world the world it is in. + * @param world the world it is in. * @return if compat exists. */ protected boolean hasFittingTreeFamilyCompat(final BlockPos block1, final BlockPos block2, final IWorld world) {return false;} diff --git a/src/api/java/com/minecolonies/api/compatibility/tinkers/SlimeTreeCheck.java b/src/api/java/com/minecolonies/api/compatibility/tinkers/SlimeTreeCheck.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/compatibility/tinkers/SlimeTreeProxy.java b/src/api/java/com/minecolonies/api/compatibility/tinkers/SlimeTreeProxy.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/compatibility/tinkers/TinkersWeaponHelper.java b/src/api/java/com/minecolonies/api/compatibility/tinkers/TinkersWeaponHelper.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/compatibility/tinkers/TinkersWeaponProxy.java b/src/api/java/com/minecolonies/api/compatibility/tinkers/TinkersWeaponProxy.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/compatibility/tinkers/ToolBrokenCheck.java b/src/api/java/com/minecolonies/api/compatibility/tinkers/ToolBrokenCheck.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/configuration/AbstractConfiguration.java b/src/api/java/com/minecolonies/api/configuration/AbstractConfiguration.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/configuration/ClientConfiguration.java b/src/api/java/com/minecolonies/api/configuration/ClientConfiguration.java old mode 100644 new mode 100755 index 5a8d1727652..c2fb2303aaa --- a/src/api/java/com/minecolonies/api/configuration/ClientConfiguration.java +++ b/src/api/java/com/minecolonies/api/configuration/ClientConfiguration.java @@ -3,8 +3,7 @@ import net.minecraftforge.common.ForgeConfigSpec; /** - * Mod client configuration. - * Loaded clientside, not synced. + * Mod client configuration. Loaded clientside, not synced. */ public class ClientConfiguration extends AbstractConfiguration { diff --git a/src/api/java/com/minecolonies/api/configuration/CommonConfiguration.java b/src/api/java/com/minecolonies/api/configuration/CommonConfiguration.java old mode 100644 new mode 100755 index 3d8b10c2724..9a6b893f350 --- a/src/api/java/com/minecolonies/api/configuration/CommonConfiguration.java +++ b/src/api/java/com/minecolonies/api/configuration/CommonConfiguration.java @@ -10,8 +10,7 @@ import static com.minecolonies.api.util.constant.Constants.*; /** - * Mod common configuration. - * Loaded everywhere, not synced. + * Mod common configuration. Loaded everywhere, not synced. */ public class CommonConfiguration extends AbstractConfiguration { @@ -19,31 +18,31 @@ public class CommonConfiguration extends AbstractConfiguration * ------------------- ######## Gameplay settings ######## ------------------- * * --------------------------------------------------------------------------- */ - public final ForgeConfigSpec.IntValue initialCitizenAmount; + public final ForgeConfigSpec.IntValue initialCitizenAmount; public final ForgeConfigSpec.BooleanValue builderPlaceConstructionTape; public final ForgeConfigSpec.BooleanValue playerGetsGuidebookOnFirstJoin; public final ForgeConfigSpec.BooleanValue allowInfiniteSupplyChests; public final ForgeConfigSpec.BooleanValue allowInfiniteColonies; public final ForgeConfigSpec.BooleanValue allowOtherDimColonies; - public final ForgeConfigSpec.IntValue citizenRespawnInterval; - public final ForgeConfigSpec.IntValue maxCitizenPerColony; + public final ForgeConfigSpec.IntValue citizenRespawnInterval; + public final ForgeConfigSpec.IntValue maxCitizenPerColony; public final ForgeConfigSpec.BooleanValue builderInfiniteResources; public final ForgeConfigSpec.BooleanValue limitToOneWareHousePerColony; - public final ForgeConfigSpec.IntValue builderBuildBlockDelay; - public final ForgeConfigSpec.IntValue blockMiningDelayModifier; - public final ForgeConfigSpec.IntValue maxBlocksCheckedByBuilder; - public final ForgeConfigSpec.IntValue chatFrequency; + public final ForgeConfigSpec.IntValue builderBuildBlockDelay; + public final ForgeConfigSpec.IntValue blockMiningDelayModifier; + public final ForgeConfigSpec.IntValue maxBlocksCheckedByBuilder; + public final ForgeConfigSpec.IntValue chatFrequency; public final ForgeConfigSpec.BooleanValue enableInDevelopmentFeatures; public final ForgeConfigSpec.BooleanValue alwaysRenderNameTag; - public final ForgeConfigSpec.DoubleValue growthModifier; + public final ForgeConfigSpec.DoubleValue growthModifier; public final ForgeConfigSpec.BooleanValue workersAlwaysWorkInRain; public final ForgeConfigSpec.BooleanValue sendEnteringLeavingMessages; public final ForgeConfigSpec.BooleanValue allowPlayerSchematics; - public final ForgeConfigSpec.IntValue allowGlobalNameChanges; + public final ForgeConfigSpec.IntValue allowGlobalNameChanges; public final ForgeConfigSpec.BooleanValue holidayFeatures; - public final ForgeConfigSpec.IntValue updateRate; - public final ForgeConfigSpec.IntValue dirtFromCompost; - public final ForgeConfigSpec.IntValue luckyBlockChance; + public final ForgeConfigSpec.IntValue updateRate; + public final ForgeConfigSpec.IntValue dirtFromCompost; + public final ForgeConfigSpec.IntValue luckyBlockChance; public final ForgeConfigSpec.BooleanValue fixOrphanedChunks; public final ForgeConfigSpec.BooleanValue restrictBuilderUnderground; public final ForgeConfigSpec.DoubleValue fisherSpongeChance; @@ -70,7 +69,7 @@ public class CommonConfiguration extends AbstractConfiguration public final ForgeConfigSpec.BooleanValue canPlayerUseKillCitizensCommand; public final ForgeConfigSpec.BooleanValue canPlayerUseAddOfficerCommand; public final ForgeConfigSpec.BooleanValue canPlayerUseDeleteColonyCommand; - public final ForgeConfigSpec.IntValue numberOfAttemptsForSafeTP; + public final ForgeConfigSpec.IntValue numberOfAttemptsForSafeTP; /* --------------------------------------------------------------------------- * * ------------------- ######## Claim settings ######## ------------------- * @@ -111,11 +110,11 @@ public class CommonConfiguration extends AbstractConfiguration * ------------------- ######## Permission Settings ######## ------------------- * * ----------------------------------------------------------------------------- */ - public final ForgeConfigSpec.BooleanValue enableColonyProtection; - public final ForgeConfigSpec.BooleanValue turnOffExplosionsInColonies; + public final ForgeConfigSpec.BooleanValue enableColonyProtection; + public final ForgeConfigSpec.BooleanValue turnOffExplosionsInColonies; public final ForgeConfigSpec.ConfigValue> specialPermGroup; public final ForgeConfigSpec.ConfigValue> freeToInteractBlocks; - public final ForgeConfigSpec.IntValue secondsBetweenPermissionMessages; + public final ForgeConfigSpec.IntValue secondsBetweenPermissionMessages; /* -------------------------------------------------------------------------------- * * ------------------- ######## Compatibility Settings ######## ------------------- * @@ -127,7 +126,7 @@ public class CommonConfiguration extends AbstractConfiguration public final ForgeConfigSpec.ConfigValue> listOfCompostableItems; public final ForgeConfigSpec.ConfigValue> luckyBlocks; public final ForgeConfigSpec.ConfigValue> luckyOres; - public final ForgeConfigSpec.ConfigValue> crusherProduction ; + public final ForgeConfigSpec.ConfigValue> crusherProduction; public final ForgeConfigSpec.ConfigValue> sifterMeshes; public final ForgeConfigSpec.ConfigValue> siftableBlocks; public final ForgeConfigSpec.ConfigValue> sifterDrops; @@ -143,20 +142,20 @@ public class CommonConfiguration extends AbstractConfiguration * ------------------------------------------------------------------------------ */ public final ForgeConfigSpec.BooleanValue pathfindingDebugDraw; - public final ForgeConfigSpec.IntValue pathfindingDebugVerbosity; - public final ForgeConfigSpec.IntValue pathfindingMaxThreadCount; - public final ForgeConfigSpec.IntValue pathfindingMaxNodes; - public final ForgeConfigSpec.IntValue minimumRailsToPath; + public final ForgeConfigSpec.IntValue pathfindingDebugVerbosity; + public final ForgeConfigSpec.IntValue pathfindingMaxThreadCount; + public final ForgeConfigSpec.IntValue pathfindingMaxNodes; + public final ForgeConfigSpec.IntValue minimumRailsToPath; /* --------------------------------------------------------------------------------- * * ------------------- ######## Request System Settings ######## ------------------- * * --------------------------------------------------------------------------------- */ public final ForgeConfigSpec.BooleanValue enableDebugLogging; - public final ForgeConfigSpec.IntValue maximalRetries; - public final ForgeConfigSpec.IntValue delayBetweenRetries; - public final ForgeConfigSpec.IntValue maximalBuildingsToGather; - public final ForgeConfigSpec.IntValue minimalBuildingsToGather; + public final ForgeConfigSpec.IntValue maximalRetries; + public final ForgeConfigSpec.IntValue delayBetweenRetries; + public final ForgeConfigSpec.IntValue maximalBuildingsToGather; + public final ForgeConfigSpec.IntValue minimalBuildingsToGather; public final ForgeConfigSpec.BooleanValue creativeResolve; public final ForgeConfigSpec.BooleanValue canPlayerUseResetCommand; @@ -178,49 +177,49 @@ public class CommonConfiguration extends AbstractConfiguration public final ForgeConfigSpec.ConfigValue> rapidshot; public final ForgeConfigSpec.ConfigValue> masterbowman; - public final ForgeConfigSpec.ConfigValue> avoidance ; + public final ForgeConfigSpec.ConfigValue> avoidance; - public final ForgeConfigSpec.ConfigValue> parry ; - public final ForgeConfigSpec.ConfigValue> repost ; - public final ForgeConfigSpec.ConfigValue> duelist ; - public final ForgeConfigSpec.ConfigValue> provost ; + public final ForgeConfigSpec.ConfigValue> parry; + public final ForgeConfigSpec.ConfigValue> repost; + public final ForgeConfigSpec.ConfigValue> duelist; + public final ForgeConfigSpec.ConfigValue> provost; public final ForgeConfigSpec.ConfigValue> masterswordsman; - public final ForgeConfigSpec.ConfigValue> dodge ; + public final ForgeConfigSpec.ConfigValue> dodge; public final ForgeConfigSpec.ConfigValue> taunt; public final ForgeConfigSpec.ConfigValue> improveddodge; - public final ForgeConfigSpec.ConfigValue> evasion ; + public final ForgeConfigSpec.ConfigValue> evasion; public final ForgeConfigSpec.ConfigValue> improvedevasion; public final ForgeConfigSpec.ConfigValue> agilearcher; - public final ForgeConfigSpec.ConfigValue> improvedleather ; + public final ForgeConfigSpec.ConfigValue> improvedleather; public final ForgeConfigSpec.ConfigValue> boiledleather; - public final ForgeConfigSpec.ConfigValue> ironskin ; + public final ForgeConfigSpec.ConfigValue> ironskin; public final ForgeConfigSpec.ConfigValue> ironarmour; public final ForgeConfigSpec.ConfigValue> steelarmour; - public final ForgeConfigSpec.ConfigValue> diamondskin ; + public final ForgeConfigSpec.ConfigValue> diamondskin; public final ForgeConfigSpec.ConfigValue> regeneration; public final ForgeConfigSpec.ConfigValue> avoid; - public final ForgeConfigSpec.ConfigValue> evade ; + public final ForgeConfigSpec.ConfigValue> evade; public final ForgeConfigSpec.ConfigValue> flee; public final ForgeConfigSpec.ConfigValue> hotfoot; public final ForgeConfigSpec.ConfigValue> feint; - public final ForgeConfigSpec.ConfigValue> fear ; + public final ForgeConfigSpec.ConfigValue> fear; public final ForgeConfigSpec.ConfigValue> retreat; public final ForgeConfigSpec.ConfigValue> fullretreat; - public final ForgeConfigSpec.ConfigValue> accuracy ; + public final ForgeConfigSpec.ConfigValue> accuracy; public final ForgeConfigSpec.ConfigValue> quickdraw; - public final ForgeConfigSpec.ConfigValue> powerattack ; + public final ForgeConfigSpec.ConfigValue> powerattack; public final ForgeConfigSpec.ConfigValue> cleave; public final ForgeConfigSpec.ConfigValue> mightycleave; public final ForgeConfigSpec.ConfigValue> whirlwind; - public final ForgeConfigSpec.ConfigValue> preciseshot ; + public final ForgeConfigSpec.ConfigValue> preciseshot; public final ForgeConfigSpec.ConfigValue> penetratingshot; - public final ForgeConfigSpec.ConfigValue> piercingshot ; + public final ForgeConfigSpec.ConfigValue> piercingshot; public final ForgeConfigSpec.ConfigValue> woundingshot; public final ForgeConfigSpec.ConfigValue> deadlyaim; @@ -431,7 +430,7 @@ protected CommonConfiguration(final ForgeConfigSpec.Builder builder) doBarbariansSpawn = defineBoolean(builder, "dobarbariansspawn", true); barbarianHordeDifficulty = defineInteger(builder, "barbarianhordedifficulty", DEFAULT_BARBARIAN_DIFFICULTY, MIN_BARBARIAN_DIFFICULTY, MAX_BARBARIAN_DIFFICULTY); - spawnBarbarianSize = defineInteger(builder, "spawnbarbariansize", 5, MIN_SPAWN_BARBARIAN_HORDE_SIZE, MAX_SPAWN_BARBARIAN_HORDE_SIZE); + spawnBarbarianSize = defineInteger(builder, "spawnbarbariansize", 5, MIN_SPAWN_BARBARIAN_HORDE_SIZE, MAX_SPAWN_BARBARIAN_HORDE_SIZE); maxBarbarianSize = defineInteger(builder, "maxBarbarianSize", 80, MIN_BARBARIAN_HORDE_SIZE, MAX_BARBARIAN_HORDE_SIZE); doBarbariansBreakThroughWalls = defineBoolean(builder, "dobarbariansbreakthroughwalls", true); averageNumberOfNightsBetweenRaids = defineInteger(builder, "averagenumberofnightsbetweenraids", 7, 1, 10); @@ -440,27 +439,27 @@ protected CommonConfiguration(final ForgeConfigSpec.Builder builder) shouldRaidersBreakDoors = defineBoolean(builder, "shouldraiderbreakdoors", true); citizenCallForHelp = defineBoolean(builder, "citizencallforhelp", true); rangerEnchants = defineBoolean(builder, "rangerenchants", true); - rangerDamageMult = defineDouble(builder, "rangerdamagemult", 1.0, 0.1, 5.0); - knightDamageMult = defineDouble(builder, "knightdamagemult", 1.0, 0.1, 5.0); - guardHealthMult = defineDouble(builder, "guardhealthmult", 1.0, 0.1, 5.0); - pvp_mode = defineBoolean(builder, "pvp_mode", false); - daysUntilPirateshipsDespawn = defineInteger(builder, "daysuntilpirateshipsdespawn", 3, 1, 10); - maxYForBarbarians = defineInteger(builder, "maxyforbarbarians", 200, 1, 500); + rangerDamageMult = defineDouble(builder, "rangerdamagemult", 1.0, 0.1, 5.0); + knightDamageMult = defineDouble(builder, "knightdamagemult", 1.0, 0.1, 5.0); + guardHealthMult = defineDouble(builder, "guardhealthmult", 1.0, 0.1, 5.0); + pvp_mode = defineBoolean(builder, "pvp_mode", false); + daysUntilPirateshipsDespawn = defineInteger(builder, "daysuntilpirateshipsdespawn", 3, 1, 10); + maxYForBarbarians = defineInteger(builder, "maxyforbarbarians", 200, 1, 500); swapToCategory(builder, "permissions"); - enableColonyProtection = defineBoolean(builder, "enablecolonyprotection", true); + enableColonyProtection = defineBoolean(builder, "enablecolonyprotection", true); turnOffExplosionsInColonies = defineBoolean(builder, "turnoffexplosionsincolonies", true); specialPermGroup = defineList(builder, "specialpermgroup", Arrays.asList - ("_Raycoms_" ), + ("_Raycoms_"), s -> s instanceof String); freeToInteractBlocks = defineList(builder, "freetointeractblocks", Arrays.asList ("dirt", - "0 0 0" ), + "0 0 0"), s -> s instanceof String); - secondsBetweenPermissionMessages = defineInteger(builder, "secondsBetweenPermissionMessages", 30, 1, 1000); + secondsBetweenPermissionMessages = defineInteger(builder, "secondsBetweenPermissionMessages", 30, 1, 1000); swapToCategory(builder, "compatibility"); @@ -468,12 +467,12 @@ protected CommonConfiguration(final ForgeConfigSpec.Builder builder) extraOres = defineList(builder, "extraOres", Arrays.asList ("minestuck:ore_cruxite", - "minestuck:ore_uranium" ), + "minestuck:ore_uranium"), s -> s instanceof String); guardResourceLocations = defineList(builder, "guardresourcelocations", Arrays.asList ("minecraft:slime", - "tconstruct:blueslime" ), + "tconstruct:blueslime"), s -> s instanceof String); configListStudyItems = defineList(builder, "configliststudyitems", Arrays.asList @@ -529,14 +528,14 @@ protected CommonConfiguration(final ForgeConfigSpec.Builder builder) Arrays.asList ("minecraft:cobblestone!minecraft:gravel", "minecraft:gravel!minecraft:sand", - "minecraft:sand!minecraft:clay" ), + "minecraft:sand!minecraft:clay"), s -> s instanceof String); sifterMeshes = defineList(builder, "siftermeshes", Arrays.asList ("minecraft:string,0", "minecraft:flint,0.1", "minecraft:iron_ingot,0.1", - "minecraft:diamond,0.1" ), + "minecraft:diamond,0.1"), s -> s instanceof String); siftableBlocks = defineList(builder, "siftableblocks", Arrays.asList @@ -794,34 +793,34 @@ protected CommonConfiguration(final ForgeConfigSpec.Builder builder) ), s -> s instanceof String); - enchanterExperienceMultiplier = defineDouble(builder, "enchanterexperiencemultiplier", 2, 1, 10); + enchanterExperienceMultiplier = defineDouble(builder, "enchanterexperiencemultiplier", 2, 1, 10); - dynamicTreeHarvestSize = defineInteger(builder, "dynamictreeharvestsize", 5, 1, 5); + dynamicTreeHarvestSize = defineInteger(builder, "dynamictreeharvestsize", 5, 1, 5); diseases = defineList(builder, "diseases", Arrays.asList("Influenza,100,minecraft:carrot,minecraft:potato", - "Measles,10,minecraft:dandelion,minecraft:kelp,minecraft:poppy", - "Smallpox,1,minecraft:honeycomb,minecraft:golden_apple"), + "Measles,10,minecraft:dandelion,minecraft:kelp,minecraft:poppy", + "Smallpox,1,minecraft:honeycomb,minecraft:golden_apple"), s -> s instanceof String); swapToCategory(builder, "pathfinding"); - minimumRailsToPath = defineInteger(builder, "minimumrailstopath", 5, 5, 100); - pathfindingDebugDraw = defineBoolean(builder, "pathfindingdebugdraw", false); - pathfindingDebugVerbosity = defineInteger(builder, "pathfindingdebugverbosity", 0, 0, 10); - pathfindingMaxThreadCount = defineInteger(builder, "pathfindingmaxthreadcount", 2, 1, 10); - pathfindingMaxNodes = defineInteger(builder, "pathfindingmaxnodes", 5000, 1, 10000); + minimumRailsToPath = defineInteger(builder, "minimumrailstopath", 5, 5, 100); + pathfindingDebugDraw = defineBoolean(builder, "pathfindingdebugdraw", false); + pathfindingDebugVerbosity = defineInteger(builder, "pathfindingdebugverbosity", 0, 0, 10); + pathfindingMaxThreadCount = defineInteger(builder, "pathfindingmaxthreadcount", 2, 1, 10); + pathfindingMaxNodes = defineInteger(builder, "pathfindingmaxnodes", 5000, 1, 10000); swapToCategory(builder, "requestSystem"); - enableDebugLogging = defineBoolean(builder, "enabledebuglogging", false); - maximalRetries = defineInteger(builder, "maximalretries", 3, 1, 10); - delayBetweenRetries = defineInteger(builder, "delaybetweenretries", 1200, 30, 10000); - maximalBuildingsToGather = defineInteger(builder, "maximalbuildingstogather", 6, 1, 50); - minimalBuildingsToGather = defineInteger(builder, "minimalbuildingstogather", 3, 1, 50); - creativeResolve = defineBoolean(builder, "creativeresolve", false); - canPlayerUseResetCommand = defineBoolean(builder, "canplayeruseresetcommand", false); + enableDebugLogging = defineBoolean(builder, "enabledebuglogging", false); + maximalRetries = defineInteger(builder, "maximalretries", 3, 1, 10); + delayBetweenRetries = defineInteger(builder, "delaybetweenretries", 1200, 30, 10000); + maximalBuildingsToGather = defineInteger(builder, "maximalbuildingstogather", 6, 1, 50); + minimalBuildingsToGather = defineInteger(builder, "minimalbuildingstogather", 3, 1, 50); + creativeResolve = defineBoolean(builder, "creativeresolve", false); + canPlayerUseResetCommand = defineBoolean(builder, "canplayeruseresetcommand", false); swapToCategory(builder, "research"); @@ -1154,17 +1153,17 @@ protected CommonConfiguration(final ForgeConfigSpec.Builder builder) s -> s instanceof String); whatyaneed = defineList(builder, "whatyaneed", - Collections.singletonList("minecraft:redstone*64"), - s -> s instanceof String); + Collections.singletonList("minecraft:redstone*64"), + s -> s instanceof String); stringwork = defineList(builder, "stringwork", - Collections.singletonList("minecraft:string*16"), - s -> s instanceof String); + Collections.singletonList("minecraft:string*16"), + s -> s instanceof String); thoselungs = defineList(builder, "thoselungs", - Collections.singletonList("minecraft:glass*64"), - s -> s instanceof String); + Collections.singletonList("minecraft:glass*64"), + s -> s instanceof String); rainbowheaven = defineList(builder, "rainbowheaven", - Collections.singletonList("minecraft:poppy*64"), - s -> s instanceof String); + Collections.singletonList("minecraft:poppy*64"), + s -> s instanceof String); this.veinminer = defineList(builder, "veinminer", Collections.singletonList("minecraft:iron_ore*32"), diff --git a/src/api/java/com/minecolonies/api/configuration/Configuration.java b/src/api/java/com/minecolonies/api/configuration/Configuration.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/configuration/ServerConfiguration.java b/src/api/java/com/minecolonies/api/configuration/ServerConfiguration.java old mode 100644 new mode 100755 index b7a22f4903e..9ddd9fb71bc --- a/src/api/java/com/minecolonies/api/configuration/ServerConfiguration.java +++ b/src/api/java/com/minecolonies/api/configuration/ServerConfiguration.java @@ -7,12 +7,11 @@ import java.util.List; /** - * Mod server configuration. - * Loaded serverside, synced on connection. + * Mod server configuration. Loaded serverside, synced on connection. */ public class ServerConfiguration extends AbstractConfiguration { - public final ForgeConfigSpec.BooleanValue useMiddleInitial; + public final ForgeConfigSpec.BooleanValue useMiddleInitial; public final ForgeConfigSpec.ConfigValue> maleFirstNames; public final ForgeConfigSpec.ConfigValue> femaleFirstNames; public final ForgeConfigSpec.ConfigValue> lastNames; diff --git a/src/api/java/com/minecolonies/api/crafting/IItemStorageFactory.java b/src/api/java/com/minecolonies/api/crafting/IItemStorageFactory.java old mode 100644 new mode 100755 index cd54776f6dd..e2b3db6843a --- a/src/api/java/com/minecolonies/api/crafting/IItemStorageFactory.java +++ b/src/api/java/com/minecolonies/api/crafting/IItemStorageFactory.java @@ -22,12 +22,12 @@ default ItemStorage getNewInstance(@NotNull final IFactoryController factoryCont throw new IllegalArgumentException("Unsupported context - Not correct number of parameters. Only 2 are allowed!"); } - if(!(context[0] instanceof ItemStack)) + if (!(context[0] instanceof ItemStack)) { throw new IllegalArgumentException("First parameter is supposed to be an ItemStack!"); } - if(!(context[1] instanceof Integer)) + if (!(context[1] instanceof Integer)) { throw new IllegalArgumentException("Second parameter is supposed to be an Integer!"); } @@ -39,8 +39,9 @@ default ItemStorage getNewInstance(@NotNull final IFactoryController factoryCont /** * Method to get a new Instance of an itemStorage. + * * @param stack the input. - * @param size the grid size. + * @param size the grid size. * @return a new Instance of ItemStorage. */ @NotNull diff --git a/src/api/java/com/minecolonies/api/crafting/IRecipeManager.java b/src/api/java/com/minecolonies/api/crafting/IRecipeManager.java old mode 100644 new mode 100755 index d33413d73f3..74238dcb112 --- a/src/api/java/com/minecolonies/api/crafting/IRecipeManager.java +++ b/src/api/java/com/minecolonies/api/crafting/IRecipeManager.java @@ -12,20 +12,22 @@ public interface IRecipeManager { /** * Get a unmodifiable copy of the recipes map. + * * @return a map of Token, RecipeStorage. */ ImmutableMap, IRecipeStorage> getRecipes(); /** * Add a recipe to the map. + * * @param storage the recipe to add * @return the IToken. */ IToken addRecipe(final IRecipeStorage storage); /** - * Check if recipe is in map already, if not. - * Add a recipe to the map. + * Check if recipe is in map already, if not. Add a recipe to the map. + * * @param storage the recipe to add * @return the iToken. */ @@ -33,6 +35,7 @@ public interface IRecipeManager /** * Get the recipe id of a given recipeStorage. + * * @param storage the storage. * @return the id or null if inexistent. */ @@ -45,7 +48,6 @@ public interface IRecipeManager */ void write(@NotNull final CompoundNBT compound); - /** * Read Colonies from saved NBT data. * diff --git a/src/api/java/com/minecolonies/api/crafting/IRecipeStorage.java b/src/api/java/com/minecolonies/api/crafting/IRecipeStorage.java old mode 100644 new mode 100755 index 61fc4f40115..0504fe62037 --- a/src/api/java/com/minecolonies/api/crafting/IRecipeStorage.java +++ b/src/api/java/com/minecolonies/api/crafting/IRecipeStorage.java @@ -15,18 +15,15 @@ public interface IRecipeStorage { /** - * Get the list of input items. - * Suppressing Sonar Rule Squid:S2384 - * The rule thinks we should return a copy of the list and not the list itself. - * But in this case the rule does not apply because the list is an unmodifiable list already + * Get the list of input items. Suppressing Sonar Rule Squid:S2384 The rule thinks we should return a copy of the list and not the list itself. But in this case the rule does + * not apply because the list is an unmodifiable list already * * @return the list. */ List getInput(); /** - * Get the cleaned up list of the recipes. - * Air gets removed and equal items get put together. + * Get the cleaned up list of the recipes. Air gets removed and equal items get put together. * * @return the list. */ @@ -56,7 +53,7 @@ public interface IRecipeStorage /** * Method to check if with the help of inventories this recipe can be fullfilled. * - * @param qty the quantity to craft. + * @param qty the quantity to craft. * @param inventories the inventories to check. * @return true if possible, else false. */ @@ -69,6 +66,7 @@ default boolean fullFillRecipe(@NotNull final IItemHandler... inventories) /** * Check for space, remove items, and insert crafted items. + * * @param handlers the handlers to use. * @return true if succesful. */ @@ -76,6 +74,7 @@ default boolean fullFillRecipe(@NotNull final IItemHandler... inventories) /** * Get the unique token of the recipe. + * * @return the IToken. */ IToken getToken(); diff --git a/src/api/java/com/minecolonies/api/crafting/IRecipeStorageFactory.java b/src/api/java/com/minecolonies/api/crafting/IRecipeStorageFactory.java old mode 100644 new mode 100755 index 50726c20528..15795ed4082 --- a/src/api/java/com/minecolonies/api/crafting/IRecipeStorageFactory.java +++ b/src/api/java/com/minecolonies/api/crafting/IRecipeStorageFactory.java @@ -27,22 +27,22 @@ default RecipeStorage getNewInstance(@NotNull final IFactoryController factoryCo throw new IllegalArgumentException("Unsupported context - Not correct number of parameters. At least 3 at max 4 are needed.!"); } - if(!(context[0] instanceof List)) + if (!(context[0] instanceof List)) { throw new IllegalArgumentException("First parameter is supposed to be an Arraylist!"); } - if(!(context[1] instanceof Integer)) + if (!(context[1] instanceof Integer)) { throw new IllegalArgumentException("Second parameter is supposed to be an Integer!"); } - if(!(context[2] instanceof ItemStack)) + if (!(context[2] instanceof ItemStack)) { throw new IllegalArgumentException("Third parameter is supposed to be an ItemStack!"); } - if(context.length > MIN_PARAMS_IRECIPESTORAGE && !(context[MAX_PARAMS_IRECIPESTORAGE - 1] instanceof Block)) + if (context.length > MIN_PARAMS_IRECIPESTORAGE && !(context[MAX_PARAMS_IRECIPESTORAGE - 1] instanceof Block)) { throw new IllegalArgumentException("Forth parameter is supposed to be a Block or Null!"); } @@ -56,19 +56,20 @@ default RecipeStorage getNewInstance(@NotNull final IFactoryController factoryCo /** * Method to get a new Instance of an recipe. - * @param token the token of it. - * @param input the input. - * @param gridSize the grid size. + * + * @param token the token of it. + * @param input the input. + * @param gridSize the grid size. * @param primaryOutput the primary output. - * @param intermediate the intermediate. + * @param intermediate the intermediate. * @return a new Instance of IRecipeStorage. */ @NotNull RecipeStorage getNewInstance( - @NotNull final IToken token, - @NotNull final List input, - final int gridSize, - @NotNull final ItemStack primaryOutput, - @Nullable final Block intermediate); + @NotNull final IToken token, + @NotNull final List input, + final int gridSize, + @NotNull final ItemStack primaryOutput, + @Nullable final Block intermediate); } diff --git a/src/api/java/com/minecolonies/api/crafting/ItemStorage.java b/src/api/java/com/minecolonies/api/crafting/ItemStorage.java old mode 100644 new mode 100755 index 5506536277f..8285d0ed04c --- a/src/api/java/com/minecolonies/api/crafting/ItemStorage.java +++ b/src/api/java/com/minecolonies/api/crafting/ItemStorage.java @@ -69,7 +69,8 @@ public ItemStorage(@NotNull final ItemStack stack, final boolean ignoreDamageVal this.stack = stack; this.shouldIgnoreDamageValue = ignoreDamageValue; this.shouldIgnoreNBTValue = shouldIgnoreNBTValue; - this.creativeTabIndex = stack.isEmpty() ? new ArrayList<>() : stack.getItem().getCreativeTabs().stream().filter(Objects::nonNull).map(g -> g.index).collect(Collectors.toList()); + this.creativeTabIndex = + stack.isEmpty() ? new ArrayList<>() : stack.getItem().getCreativeTabs().stream().filter(Objects::nonNull).map(g -> g.index).collect(Collectors.toList()); } /** @@ -162,6 +163,7 @@ public boolean ignoreDamageValue() /** * Getter for the creativeTab index of the storage. + * * @return the index. */ public List getCreativeTabIndex() @@ -183,8 +185,8 @@ public int getPrimaryCreativeTabIndex() public int hashCode() { return Objects.hash(stack.getItem()) - + (this.shouldIgnoreDamageValue ? 0 : (this.stack.getDamage() * 31)) - + (this.shouldIgnoreNBTValue ? 0 : ((this.stack.getTag() == null) ? 0 : this.stack.getTag().hashCode())); + + (this.shouldIgnoreDamageValue ? 0 : (this.stack.getDamage() * 31)) + + (this.shouldIgnoreNBTValue ? 0 : ((this.stack.getTag() == null) ? 0 : this.stack.getTag().hashCode())); } @Override @@ -203,10 +205,10 @@ public boolean equals(final Object o) return stack.isItemEqual(that.getItemStack()) - && (this.shouldIgnoreDamageValue || that.getDamageValue() == this.getDamageValue()) - && (this.shouldIgnoreNBTValue - || (that.getItemStack().getTag() == null && this.getItemStack().getTag() == null) - || that.getItemStack().getTag().equals(this.getItemStack().getTag())); + && (this.shouldIgnoreDamageValue || that.getDamageValue() == this.getDamageValue()) + && (this.shouldIgnoreNBTValue + || (that.getItemStack().getTag() == null && this.getItemStack().getTag() == null) + || that.getItemStack().getTag().equals(this.getItemStack().getTag())); } /** diff --git a/src/api/java/com/minecolonies/api/crafting/RecipeStorage.java b/src/api/java/com/minecolonies/api/crafting/RecipeStorage.java old mode 100644 new mode 100755 index a7ad3bbba6a..5b14eb20524 --- a/src/api/java/com/minecolonies/api/crafting/RecipeStorage.java +++ b/src/api/java/com/minecolonies/api/crafting/RecipeStorage.java @@ -53,11 +53,11 @@ public class RecipeStorage implements IRecipeStorage /** * Create an instance of the recipe storage. * - * @param token the token of the storage. - * @param input the list of input items (required for the recipe). - * @param gridSize the required grid size to make it. - * @param primaryOutput the primary output of the recipe. - * @param intermediate the intermediate to use (e.g furnace). + * @param token the token of the storage. + * @param input the list of input items (required for the recipe). + * @param gridSize the required grid size to make it. + * @param primaryOutput the primary output of the recipe. + * @param intermediate the intermediate to use (e.g furnace). */ public RecipeStorage(final IToken token, final List input, final int gridSize, @NotNull final ItemStack primaryOutput, final Block intermediate) { @@ -85,15 +85,15 @@ public List calculateCleanedInput() { final List items = new ArrayList<>(); - for(final ItemStack stack: input) + for (final ItemStack stack : input) { - if(ItemStackUtils.isEmpty(stack) || stack.getItem() == ModItems.buildTool) + if (ItemStackUtils.isEmpty(stack) || stack.getItem() == ModItems.buildTool) { continue; } ItemStorage storage = new ItemStorage(stack.copy()); - if(items.contains(storage)) + if (items.contains(storage)) { final int index = items.indexOf(storage); final ItemStorage tempStorage = items.remove(index); @@ -127,7 +127,7 @@ public Block getIntermediate() /** * Method to check if with the help of inventories this recipe can be fullfilled. * - * @param qty the quantity to craft. + * @param qty the quantity to craft. * @param inventories the inventories to check. * @return true if possible, else false. */ @@ -167,15 +167,15 @@ public boolean equals(final Object o) final RecipeStorage that = (RecipeStorage) o; if (gridSize != that.gridSize - || input.size() != that.input.size() - || !primaryOutput.isItemEqualIgnoreDurability(that.primaryOutput)) + || input.size() != that.input.size() + || !primaryOutput.isItemEqualIgnoreDurability(that.primaryOutput)) { return false; } - for(int i = 0; i < input.size(); i++) + for (int i = 0; i < input.size(); i++) { - if(!that.input.get(i).isItemEqual(input.get(i))) + if (!that.input.get(i).isItemEqual(input.get(i))) { return false; } @@ -196,13 +196,14 @@ public int hashCode() /** * Check for free space in the handlers. + * * @param handlers the handlers to check. * @return true if enough space. */ private boolean checkForFreeSpace(final List handlers) { final List secondaryStacks = new ArrayList<>(); - for(final ItemStack stack: input) + for (final ItemStack stack : input) { final ItemStack container = stack.getItem().getContainerItem(stack); if (!ItemStackUtils.isEmpty(container)) @@ -211,12 +212,12 @@ private boolean checkForFreeSpace(final List handlers) } } secondaryStacks.add(getPrimaryOutput()); - if(secondaryStacks.size() > getInput().size()) + if (secondaryStacks.size() > getInput().size()) { int freeSpace = 0; for (final IItemHandler handler : handlers) { - freeSpace+= handler.getSlots() - InventoryUtils.getAmountOfStacksInItemHandler(handler); + freeSpace += handler.getSlots() - InventoryUtils.getAmountOfStacksInItemHandler(handler); } return freeSpace >= secondaryStacks.size() - getInput().size(); @@ -226,13 +227,14 @@ private boolean checkForFreeSpace(final List handlers) /** * Check for space, remove items, and insert crafted items. + * * @param handlers the handlers to use. * @return true if succesful. */ @Override public boolean fullfillRecipe(final List handlers) { - if(!checkForFreeSpace(handlers) || !canFullFillRecipe(1, handlers.toArray(new IItemHandler[0]))) + if (!checkForFreeSpace(handlers) || !canFullFillRecipe(1, handlers.toArray(new IItemHandler[0]))) { return false; } @@ -248,7 +250,8 @@ public boolean fullfillRecipe(final List handlers) for (final IItemHandler handler : handlers) { - int slotOfStack = InventoryUtils.findFirstSlotInItemHandlerNotEmptyWith(handler, itemStack -> !ItemStackUtils.isEmpty(itemStack) && itemStack.isItemEqual(stack.getItemStack())); + int slotOfStack = + InventoryUtils.findFirstSlotInItemHandlerNotEmptyWith(handler, itemStack -> !ItemStackUtils.isEmpty(itemStack) && itemStack.isItemEqual(stack.getItemStack())); while (slotOfStack != -1 && amountNeeded > 0) { @@ -291,6 +294,7 @@ public IToken getToken() /** * Inserted the resulting items into the itemHandlers. + * * @param handlers the handlers. */ private void insertCraftedItems(final List handlers) @@ -304,7 +308,7 @@ private void insertCraftedItems(final List handlers) } final List secondaryStacks = new ArrayList<>(); - for(final ItemStack stack: input) + for (final ItemStack stack : input) { if (stack.getItem() == ModItems.buildTool) { diff --git a/src/api/java/com/minecolonies/api/creativetab/ModCreativeTabs.java b/src/api/java/com/minecolonies/api/creativetab/ModCreativeTabs.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/CustomGoalSelector.java b/src/api/java/com/minecolonies/api/entity/CustomGoalSelector.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/MinecoloniesMinecart.java b/src/api/java/com/minecolonies/api/entity/MinecoloniesMinecart.java old mode 100644 new mode 100755 index 34e7e249511..955d9a824ba --- a/src/api/java/com/minecolonies/api/entity/MinecoloniesMinecart.java +++ b/src/api/java/com/minecolonies/api/entity/MinecoloniesMinecart.java @@ -59,7 +59,7 @@ public MinecoloniesMinecart(final EntityType type, final World world) { super(type, world); } - + @Override protected void moveAlongTrack(BlockPos pos, BlockState state) { diff --git a/src/api/java/com/minecolonies/api/entity/ModEntities.java b/src/api/java/com/minecolonies/api/entity/ModEntities.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/ai/DesiredActivity.java b/src/api/java/com/minecolonies/api/entity/ai/DesiredActivity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/ai/Status.java b/src/api/java/com/minecolonies/api/entity/ai/Status.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/ai/citizen/builder/IBuilderUndestroyable.java b/src/api/java/com/minecolonies/api/entity/ai/citizen/builder/IBuilderUndestroyable.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/ai/citizen/guards/GuardGear.java b/src/api/java/com/minecolonies/api/entity/ai/citizen/guards/GuardGear.java old mode 100644 new mode 100755 index 1721d180a59..e649ffb6a78 --- a/src/api/java/com/minecolonies/api/entity/ai/citizen/guards/GuardGear.java +++ b/src/api/java/com/minecolonies/api/entity/ai/citizen/guards/GuardGear.java @@ -149,7 +149,8 @@ public int getMaxBuildingLevelRequired() public boolean test(final ItemStack stack) { return - (ItemStackUtils.hasToolLevel(stack, itemNeeded, minArmorLevel, maxArmorLevel) && stack.getItem() instanceof ArmorItem && ((ArmorItem) stack.getItem()).getEquipmentSlot() == getType()) + (ItemStackUtils.hasToolLevel(stack, itemNeeded, minArmorLevel, maxArmorLevel) && stack.getItem() instanceof ArmorItem + && ((ArmorItem) stack.getItem()).getEquipmentSlot() == getType()) || (stack.getItem() instanceof ShieldItem && getType() == EquipmentSlotType.MAINHAND); } } diff --git a/src/api/java/com/minecolonies/api/entity/ai/citizen/guards/GuardGearBuilder.java b/src/api/java/com/minecolonies/api/entity/ai/citizen/guards/GuardGearBuilder.java old mode 100644 new mode 100755 index f7495a62ea5..5bcab8609b3 --- a/src/api/java/com/minecolonies/api/entity/ai/citizen/guards/GuardGearBuilder.java +++ b/src/api/java/com/minecolonies/api/entity/ai/citizen/guards/GuardGearBuilder.java @@ -21,19 +21,24 @@ private GuardGearBuilder() /** * Build the gear for a certain armor level and level range. - * @param minArmorLevel the min armor level. - * @param maxArmorLevel the max armor level. - * @param levelRange the level range of the guard. + * + * @param minArmorLevel the min armor level. + * @param maxArmorLevel the max armor level. + * @param levelRange the level range of the guard. * @param buildingLevelRange the building level range. * @return the list of items. */ - public static List buildGearForLevel(final int minArmorLevel, final int maxArmorLevel, final Tuple levelRange, final Tuple buildingLevelRange) + public static List buildGearForLevel( + final int minArmorLevel, + final int maxArmorLevel, + final Tuple levelRange, + final Tuple buildingLevelRange) { final List armorList = new ArrayList<>(); - armorList.add(new GuardGear(ToolType.BOOTS, EquipmentSlotType.FEET, minArmorLevel, maxArmorLevel, levelRange, buildingLevelRange)); + armorList.add(new GuardGear(ToolType.BOOTS, EquipmentSlotType.FEET, minArmorLevel, maxArmorLevel, levelRange, buildingLevelRange)); armorList.add(new GuardGear(ToolType.CHESTPLATE, EquipmentSlotType.CHEST, minArmorLevel, maxArmorLevel, levelRange, buildingLevelRange)); - armorList.add(new GuardGear(ToolType.HELMET, EquipmentSlotType.HEAD, minArmorLevel, maxArmorLevel, levelRange, buildingLevelRange)); - armorList.add(new GuardGear(ToolType.LEGGINGS, EquipmentSlotType.LEGS, minArmorLevel, maxArmorLevel, levelRange, buildingLevelRange)); + armorList.add(new GuardGear(ToolType.HELMET, EquipmentSlotType.HEAD, minArmorLevel, maxArmorLevel, levelRange, buildingLevelRange)); + armorList.add(new GuardGear(ToolType.LEGGINGS, EquipmentSlotType.LEGS, minArmorLevel, maxArmorLevel, levelRange, buildingLevelRange)); return armorList; } } diff --git a/src/api/java/com/minecolonies/api/entity/ai/citizen/guards/GuardTask.java b/src/api/java/com/minecolonies/api/entity/ai/citizen/guards/GuardTask.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/ai/pathfinding/AbstractWalkToProxy.java b/src/api/java/com/minecolonies/api/entity/ai/pathfinding/AbstractWalkToProxy.java old mode 100644 new mode 100755 index 3a631dd61b2..60edbcd80b6 --- a/src/api/java/com/minecolonies/api/entity/ai/pathfinding/AbstractWalkToProxy.java +++ b/src/api/java/com/minecolonies/api/entity/ai/pathfinding/AbstractWalkToProxy.java @@ -28,7 +28,7 @@ public abstract class AbstractWalkToProxy implements IWalkToProxy /** * Range to the proxy. */ - private static final int PROXY_RANGE = 3; + private static final int PROXY_RANGE = 3; /** * The entity entity associated with the proxy. @@ -89,7 +89,7 @@ public boolean walkToBlock(@NotNull final BlockPos target, final int range, fina } final double distanceToPath = careAboutY() - ? BlockPosUtil.getDistanceSquared(entity.getPosition(), target) : BlockPosUtil.getDistanceSquared2D(entity.getPosition(), target); + ? BlockPosUtil.getDistanceSquared(entity.getPosition(), target) : BlockPosUtil.getDistanceSquared2D(entity.getPosition(), target); if (distanceToPath <= MIN_RANGE_FOR_DIRECT_PATH) { @@ -203,14 +203,14 @@ private boolean takeTheDirectPath(@NotNull final BlockPos target, final int rang { final int targetY = careAboutY() ? entity.getPosition().getY() : target.getY(); arrived = isLivingAtSiteWithMove(entity, target.getX(), target.getY(), target.getZ(), range) - || EntityUtils.isLivingAtSite(entity, target.getX(), targetY, target.getZ(), range + 1); + || EntityUtils.isLivingAtSite(entity, target.getX(), targetY, target.getZ(), range + 1); } else { arrived = !EntityUtils.isLivingAtSite(entity, target.getX(), target.getY(), target.getZ(), range); } - if(arrived) + if (arrived) { this.target = null; } diff --git a/src/api/java/com/minecolonies/api/entity/ai/pathfinding/IWalkToProxy.java b/src/api/java/com/minecolonies/api/entity/ai/pathfinding/IWalkToProxy.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/ai/registry/IMobAIRegistry.java b/src/api/java/com/minecolonies/api/entity/ai/registry/IMobAIRegistry.java old mode 100644 new mode 100755 index 44ad38d216b..7dde08b9e30 --- a/src/api/java/com/minecolonies/api/entity/ai/registry/IMobAIRegistry.java +++ b/src/api/java/com/minecolonies/api/entity/ai/registry/IMobAIRegistry.java @@ -14,8 +14,7 @@ public interface IMobAIRegistry static IMobAIRegistry getInstance() { return IMinecoloniesAPI.getInstance().getMobAIRegistry(); } /** - * Method to get the AI tasks registered for a given mob. - * Used by minecolonies to get the AIs that are required for a given mob. + * Method to get the AI tasks registered for a given mob. Used by minecolonies to get the AIs that are required for a given mob. * * @param mob The mob that the system is initializing and requests the AI for. * @return The map with the entity AI tasks that are needed for the given mob, with their priorities. @@ -51,8 +50,7 @@ IMobAIRegistry registerNewAiTaskForMobs( Predicate applyPredicate); /** - * Method to get the AI target tasks registered for a given mob. - * Used by minecolonies to get the AIs that are required for a given mob. + * Method to get the AI target tasks registered for a given mob. Used by minecolonies to get the AIs that are required for a given mob. * * @param mob The mob that the system is initializing and requests the AI for. * @return The map with the entity AI tasks that are needed for the given mob, with their priorities. diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/AIEventTarget.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/AIEventTarget.java old mode 100644 new mode 100755 index 141a923bb3f..cb7435fd35d --- a/src/api/java/com/minecolonies/api/entity/ai/statemachine/AIEventTarget.java +++ b/src/api/java/com/minecolonies/api/entity/ai/statemachine/AIEventTarget.java @@ -9,8 +9,7 @@ import java.util.function.Supplier; /** - * Special AI Targets which are used for preState cecks and limits. - * They are checked before normal AITargets always + * Special AI Targets which are used for preState cecks and limits. They are checked before normal AITargets always */ public class AIEventTarget extends TickingEvent { diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/AIOneTimeEventTarget.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/AIOneTimeEventTarget.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/AITarget.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/AITarget.java old mode 100644 new mode 100755 index 1b6b6e1c322..cd3f87519ae --- a/src/api/java/com/minecolonies/api/entity/ai/statemachine/AITarget.java +++ b/src/api/java/com/minecolonies/api/entity/ai/statemachine/AITarget.java @@ -9,12 +9,8 @@ import java.util.function.Supplier; /** - * A simple target the AI tries to accomplish. - * It has a state matcher, - * so it only gets executed on matching state. - * It has a tester function to make more checks - * to tell if execution is wanted. - * And it can change state. + * A simple target the AI tries to accomplish. It has a state matcher, so it only gets executed on matching state. It has a tester function to make more checks to tell if execution + * is wanted. And it can change state. */ public class AITarget extends TickingTransition { @@ -24,7 +20,7 @@ public class AITarget extends TickingTransition * @param state the state it needs to be * @param predicate the predicate for execution * @param action the action to apply - * @param tickRate the tick rate. + * @param tickRate the tick rate. */ public AITarget( @NotNull final IAIState state, @@ -40,7 +36,7 @@ public AITarget( * * @param predicate the predicate for execution * @param action the action to apply - * @param tickRate the tick rate. + * @param tickRate the tick rate. */ protected AITarget( @NotNull final BooleanSupplier predicate, @@ -55,7 +51,7 @@ protected AITarget( * * @param predicateState the state it needs to be | null * @param state the state to switch to - * @param tickRate the tick rate. + * @param tickRate the tick rate. */ public AITarget(@NotNull final IAIState predicateState, @Nullable final IAIState state, final int tickRate) { @@ -65,8 +61,8 @@ public AITarget(@NotNull final IAIState predicateState, @Nullable final IAIState /** * Construct a target. * - * @param state the state it needs to be | null - * @param action the action to apply + * @param state the state it needs to be | null + * @param action the action to apply * @param tickRate the tick rate. */ public AITarget(@NotNull final IAIState state, @NotNull final Supplier action, final int tickRate) diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/BasicEvent.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/BasicEvent.java old mode 100644 new mode 100755 index 47ec01d2fab..c7ad8fbf4b1 --- a/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/BasicEvent.java +++ b/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/BasicEvent.java @@ -9,8 +9,7 @@ import java.util.function.Supplier; /** - * Basic event for statemachines, consists of a condition and a statesupplier to transition the statemachine into. - * Events are always executed before any state transitions happen. + * Basic event for statemachines, consists of a condition and a statesupplier to transition the statemachine into. Events are always executed before any state transitions happen. */ public class BasicEvent extends BasicTransition implements IStateMachineEvent { diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/BasicStateMachine.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/BasicStateMachine.java old mode 100644 new mode 100755 index dd5ffd12bdb..a01e1a794ca --- a/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/BasicStateMachine.java +++ b/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/BasicStateMachine.java @@ -14,8 +14,8 @@ import java.util.function.Consumer; /** - * Basic statemachine class, can be used for any Transition typed which extends the transition interface. - * It contains the current state and a hashmap for events and transitions, which are the minimal requirements to have a working statemachine. + * Basic statemachine class, can be used for any Transition typed which extends the transition interface. It contains the current state and a hashmap for events and transitions, + * which are the minimal requirements to have a working statemachine. */ public class BasicStateMachine, S extends IState> implements IStateMachine { @@ -47,7 +47,8 @@ public class BasicStateMachine, S extends I /** * Construct a new StateMachine - * @param initialState the initial state. + * + * @param initialState the initial state. * @param exceptionHandler the exception handler. */ protected BasicStateMachine(@NotNull final S initialState, @NotNull final Consumer exceptionHandler) @@ -134,10 +135,7 @@ public boolean checkTransition(@NotNull final T transition) } /** - * Continuation of checkTransition. - * applies the transition and changes the state. - * if the state is null, execute more transitions - * and don't change state. + * Continuation of checkTransition. applies the transition and changes the state. if the state is null, execute more transitions and don't change state. * * @param transition the transitions we're looking at * @return true if did transition to a new state diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/BasicTransition.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/BasicTransition.java old mode 100644 new mode 100755 index 015237eabc6..ac6170ee864 --- a/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/BasicTransition.java +++ b/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/BasicTransition.java @@ -9,9 +9,8 @@ import java.util.function.Supplier; /** - * Basic Transition class for statemachines. - * Consists of a state the transition applies in, a statesupplier which determines its next state and - * a condition which has to be true to transition into the next state. + * Basic Transition class for statemachines. Consists of a state the transition applies in, a statesupplier which determines its next state and a condition which has to be true to + * transition into the next state. */ public class BasicTransition implements IStateMachineTransition { @@ -49,6 +48,7 @@ public BasicTransition(@NotNull final S state, @NotNull final BooleanSupplier co /** * Protected Constructor to allow subclasses without a state + * * @param condition the condition. * @param nextState the next state to go to. */ diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/IStateMachine.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/IStateMachine.java old mode 100644 new mode 100755 index f9b46602216..2a33b96031d --- a/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/IStateMachine.java +++ b/src/api/java/com/minecolonies/api/entity/ai/statemachine/basestatemachine/IStateMachine.java @@ -5,8 +5,8 @@ import org.jetbrains.annotations.NotNull; /** - * Statemachine interface, implement to add more statemachine types. - * Contains all needed functions for a basic statemachine + * Statemachine interface, implement to add more statemachine types. Contains all needed functions for a basic statemachine + * * @param the statemachine transition. * @param the State. */ @@ -14,12 +14,14 @@ public interface IStateMachine, S extends I { /** * Adds a transitions to the machine's transition table + * * @param transition the transition to add. */ void addTransition(final T transition); /** * Removes a transition from the machine's transition table + * * @param transition the transition to remove. */ void removeTransition(final T transition); @@ -31,6 +33,7 @@ public interface IStateMachine, S extends I /** * Checks the transitions condition + * * @param transition the transition to check. * @return true if should run. */ @@ -38,6 +41,7 @@ public interface IStateMachine, S extends I /** * Change the state to the next + * * @param transition the next transition. * @return true if transitioned. */ @@ -45,6 +49,7 @@ public interface IStateMachine, S extends I /** * Return the current state of the Statemachine + * * @return the state. */ S getState(); diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/AIBlockingEventType.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/AIBlockingEventType.java old mode 100644 new mode 100755 index 70a3ef56795..58423045352 --- a/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/AIBlockingEventType.java +++ b/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/AIBlockingEventType.java @@ -7,19 +7,17 @@ public enum AIBlockingEventType implements IStateEventType { /*###Priority NonStates###*/ /** - * Highest priority state for AITargets, if returning true it stops further execution of the AI this tick. - * Checked regardless of current state + * Highest priority state for AITargets, if returning true it stops further execution of the AI this tick. Checked regardless of current state */ AI_BLOCKING, /** - * High priority state which is checked right before trying to execute a normal state AITarget, if returning true it blocks further executions. - * Checked regardless of current state + * High priority state which is checked right before trying to execute a normal state AITarget, if returning true it blocks further executions. Checked regardless of current + * state */ STATE_BLOCKING, /** - * Higher priority state used to do one action and then self consume after returning a State. - * Checked right after AI_BLOCKING_PRIO targets, return true if blocking further executions of AITargets - * Checked regardless of current state + * Higher priority state used to do one action and then self consume after returning a State. Checked right after AI_BLOCKING_PRIO targets, return true if blocking further + * executions of AITargets Checked regardless of current state */ EVENT } diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/AIWorkerState.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/AIWorkerState.java old mode 100644 new mode 100755 index 8902e710f12..4d6ac70d45e --- a/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/AIWorkerState.java +++ b/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/AIWorkerState.java @@ -1,9 +1,7 @@ package com.minecolonies.api.entity.ai.statemachine.states; /** - * Basic state enclosing states all ai's use. - * Please extend this class with the states your ai needs. - * And please document each state on what it does. + * Basic state enclosing states all ai's use. Please extend this class with the states your ai needs. And please document each state on what it does. */ public enum AIWorkerState implements IAIState { @@ -12,14 +10,11 @@ public enum AIWorkerState implements IAIState ###GENERAL### */ /** - * this is the idle state for the ai. - * From here on it will start working. - * Use this state in your ai to start your code. + * this is the idle state for the ai. From here on it will start working. Use this state in your ai to start your code. */ IDLE(true), /** - * This state is only used on ai initialization. - * It checks if any important things are null. + * This state is only used on ai initialization. It checks if any important things are null. */ INIT(true), /** diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/IAIState.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/IAIState.java old mode 100644 new mode 100755 index ab1500f66ff..ad779713fad --- a/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/IAIState.java +++ b/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/IAIState.java @@ -1,8 +1,7 @@ package com.minecolonies.api.entity.ai.statemachine.states; /** - * Interface type for IAIState enums - * Implement this interface to add new statetypes + * Interface type for IAIState enums Implement this interface to add new statetypes */ public interface IAIState extends IState { diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/IState.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/IState.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/IStateEventType.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/states/IStateEventType.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/tickratestatemachine/ITickRateStateMachine.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/tickratestatemachine/ITickRateStateMachine.java old mode 100644 new mode 100755 index 14b3d46a07b..6fa60c1e042 --- a/src/api/java/com/minecolonies/api/entity/ai/statemachine/tickratestatemachine/ITickRateStateMachine.java +++ b/src/api/java/com/minecolonies/api/entity/ai/statemachine/tickratestatemachine/ITickRateStateMachine.java @@ -30,6 +30,7 @@ public interface ITickRateStateMachine extends IStateMachine extends BasicStateMachine, S> implements ITickRateStateMachine { @@ -34,8 +33,9 @@ public class TickRateStateMachine extends BasicStateMachine exceptionHandler) { @@ -94,10 +94,10 @@ public void tick() if (!transitionMap.containsKey(getState())) { - // Reached Trap/Sink state we cannot leave. - onException(new RuntimeException("Missing AI transition for state: " + getState())); - reset(); - return; + // Reached Trap/Sink state we cannot leave. + onException(new RuntimeException("Missing AI transition for state: " + getState())); + reset(); + return; } for (final ITickingTransition transition : transitionMap.get(getState())) diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/tickratestatemachine/TickingEvent.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/tickratestatemachine/TickingEvent.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/tickratestatemachine/TickingOneTimeEvent.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/tickratestatemachine/TickingOneTimeEvent.java old mode 100644 new mode 100755 index 82fa27baa74..dd7ec1dccbf --- a/src/api/java/com/minecolonies/api/entity/ai/statemachine/tickratestatemachine/TickingOneTimeEvent.java +++ b/src/api/java/com/minecolonies/api/entity/ai/statemachine/tickratestatemachine/TickingOneTimeEvent.java @@ -9,8 +9,7 @@ import java.util.function.Supplier; /** - * One time event that can be checked at the given tickrate, one time events are removed after causing a state transition. - * (Even when transitioning into the same state again) + * One time event that can be checked at the given tickrate, one time events are removed after causing a state transition. (Even when transitioning into the same state again) */ public class TickingOneTimeEvent extends TickingEvent implements IStateMachineOneTimeEvent { diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/tickratestatemachine/TickingTransition.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/tickratestatemachine/TickingTransition.java old mode 100644 new mode 100755 index 1e7e1fa1e1a..8282f1fec88 --- a/src/api/java/com/minecolonies/api/entity/ai/statemachine/tickratestatemachine/TickingTransition.java +++ b/src/api/java/com/minecolonies/api/entity/ai/statemachine/tickratestatemachine/TickingTransition.java @@ -28,8 +28,8 @@ public class TickingTransition extends BasicTransition impl private final int tickOffset; /** - * The variant used upon creation of the AITarget to uniformly distribute the Tick offset - * Static variable counter that changes with each AITarget creation and affects the next one. + * The variant used upon creation of the AITarget to uniformly distribute the Tick offset Static variable counter that changes with each AITarget creation and affects the next + * one. */ @SuppressWarnings("PMD.AssignmentToNonFinalStatic") private static int tickOffsetVariant = 0; diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/transitions/IStateMachineEvent.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/transitions/IStateMachineEvent.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/transitions/IStateMachineOneTimeEvent.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/transitions/IStateMachineOneTimeEvent.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/ai/statemachine/transitions/IStateMachineTransition.java b/src/api/java/com/minecolonies/api/entity/ai/statemachine/transitions/IStateMachineTransition.java old mode 100644 new mode 100755 index 9efe68a4c0f..c52ac3205e3 --- a/src/api/java/com/minecolonies/api/entity/ai/statemachine/transitions/IStateMachineTransition.java +++ b/src/api/java/com/minecolonies/api/entity/ai/statemachine/transitions/IStateMachineTransition.java @@ -16,6 +16,7 @@ public interface IStateMachineTransition /** * Get the next state the Transition goes into + * * @return the next state to go to. */ S getNextState(); diff --git a/src/api/java/com/minecolonies/api/entity/ai/util/StudyItem.java b/src/api/java/com/minecolonies/api/entity/ai/util/StudyItem.java old mode 100644 new mode 100755 index 76ac7a24cd8..51dd9e38060 --- a/src/api/java/com/minecolonies/api/entity/ai/util/StudyItem.java +++ b/src/api/java/com/minecolonies/api/entity/ai/util/StudyItem.java @@ -27,8 +27,9 @@ public class StudyItem /** * Initializing Study item, making sure the rates are valid. - * @param breakChance the break chance. - * @param item the item. + * + * @param breakChance the break chance. + * @param item the item. * @param skillIncrease the skill increase factor. */ public StudyItem(@NotNull final Item item, final int skillIncrease, final int breakChance) diff --git a/src/api/java/com/minecolonies/api/entity/citizen/AbstractEntityCitizen.java b/src/api/java/com/minecolonies/api/entity/citizen/AbstractEntityCitizen.java old mode 100644 new mode 100755 index 3ff1ab5f68b..e963bde089d --- a/src/api/java/com/minecolonies/api/entity/citizen/AbstractEntityCitizen.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/AbstractEntityCitizen.java @@ -94,7 +94,7 @@ public abstract class AbstractEntityCitizen extends AgeableEntity implements INa /** * Constructor for a new citizen typed entity. * - * @param type the Entity type. + * @param type the Entity type. * @param world the world. */ public AbstractEntityCitizen(final EntityType type, final World world) @@ -193,8 +193,7 @@ public boolean isAIDisabled() } /** - * Sets the textures of all citizens and distinguishes between male and - * female. + * Sets the textures of all citizens and distinguishes between male and female. */ public void setTexture() { @@ -204,10 +203,12 @@ public void setTexture() } texture = getModelType().getTexture(this); + textureDirty = false; } /** * Get the citizen data view. + * * @return the view. */ public abstract ICitizenDataView getCitizenDataView(); @@ -222,8 +223,9 @@ public ResourceLocation getTexture() { if (texture == null || textureDirty - || !getTexture().getPath().contains(getDataManager().get(DATA_STYLE)) - || !getTexture().getPath().contains(getDataManager().get(DATA_TEXTURE_SUFFIX))) + || !texture.getPath().contains(getRenderMetadata()) + || !texture.getPath().contains(getDataManager().get(DATA_STYLE)) + || !texture.getPath().contains(getDataManager().get(DATA_TEXTURE_SUFFIX))) { setTexture(); } @@ -423,8 +425,7 @@ public int getRecentlyHit() } /** - * Entities treat being on ladders as not on ground; this breaks navigation - * logic. + * Entities treat being on ladders as not on ground; this breaks navigation logic. */ @Override protected void updateFallState(final double y, final boolean onGroundIn, @NotNull final BlockState state, @NotNull final BlockPos pos) @@ -469,8 +470,7 @@ public boolean checkCanDropLoot() public abstract ILocation getLocation(); /** - * Checks if a worker is at his working site. - * If he isn't, sets it's path to the location + * Checks if a worker is at his working site. If he isn't, sets it's path to the location * * @param site the place where he should walk to * @param range Range to check in @@ -479,8 +479,7 @@ public boolean checkCanDropLoot() public abstract boolean isWorkerAtSiteWithMove(@NotNull BlockPos site, int range); /** - * Getter for the citizendata. - * Tries to get it from the colony is the data is null. + * Getter for the citizendata. Tries to get it from the colony is the data is null. * * @return the data. */ @@ -565,8 +564,7 @@ public boolean checkCanDropLoot() public abstract void setCitizenId(int id); /** - * Getter for the current position. - * Only approximated position, used for stuck checking. + * Getter for the current position. Only approximated position, used for stuck checking. * * @return the current position. */ @@ -658,7 +656,6 @@ public boolean checkCanDropLoot() */ public abstract ICitizenDiseaseHandler getCitizenDiseaseHandler(); - public abstract void setCitizenDiseaseHandler(ICitizenDiseaseHandler citizenDiseaseHandler); /** diff --git a/src/api/java/com/minecolonies/api/entity/citizen/Skill.java b/src/api/java/com/minecolonies/api/entity/citizen/Skill.java old mode 100644 new mode 100755 index ef893ba634c..75aef6f88aa --- a/src/api/java/com/minecolonies/api/entity/citizen/Skill.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/Skill.java @@ -164,6 +164,7 @@ public Skill getAdverse() /** * The complimentary skill that levels up with the skill. + * * @return the complimentary skill. */ @Nullable @@ -171,6 +172,7 @@ public Skill getAdverse() /** * The adverse skill that loses xp with the skill. + * * @return the adverse skill. */ @Nullable diff --git a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenChatHandler.java b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenChatHandler.java old mode 100644 new mode 100755 index 2489acbae86..061b6a8af15 --- a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenChatHandler.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenChatHandler.java @@ -6,13 +6,13 @@ public interface ICitizenChatHandler { /** * Notify about death of citizen. + * * @param damageSource the damage source. */ void notifyDeath(DamageSource damageSource); /** - * Sends a localized message from the citizen containing a language string - * with a key and arguments. + * Sends a localized message from the citizen containing a language string with a key and arguments. * * @param key the key to retrieve the string. * @param args additional arguments. diff --git a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenColonyHandler.java b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenColonyHandler.java old mode 100644 new mode 100755 index 99b38b9050a..d1559389d4e --- a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenColonyHandler.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenColonyHandler.java @@ -20,7 +20,8 @@ public interface ICitizenColonyHandler /** * Server-specific update for the EntityCitizen. - * @param colonyID the colony id. + * + * @param colonyID the colony id. * @param citizenID the citizen id. */ void registerWithColony(final int colonyID, final int citizenID); @@ -32,12 +33,14 @@ public interface ICitizenColonyHandler /** * Get the amount the worker should decrease its saturation by each action done or x blocks traveled. + * * @return the double describing it. */ double getPerBuildingFoodCost(); /** * Getter for the colony. + * * @return the colony of the citizen or null. */ @Nullable @@ -45,12 +48,14 @@ public interface ICitizenColonyHandler /** * Getter for the colonz id. + * * @return the colony id. */ int getColonyId(); /** * Setter for the colony id. + * * @param colonyId the new colonyId. */ void setColonyId(int colonyId); @@ -62,6 +67,7 @@ public interface ICitizenColonyHandler /** * Check if a citizen is at home. + * * @return true if so. */ boolean isAtHome(); diff --git a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenDiseaseHandler.java b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenDiseaseHandler.java old mode 100644 new mode 100755 index 6b67d344ab3..e99d809fd5c --- a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenDiseaseHandler.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenDiseaseHandler.java @@ -14,24 +14,28 @@ public interface ICitizenDiseaseHandler /** * Check if the citizen is sick and must be healed.. + * * @return true if so. */ boolean isSick(); /** * Write the handler to NBT. + * * @param compound the nbt to write it to. */ void write(final CompoundNBT compound); /** * Read the handler from NBT. + * * @param compound the nbt to read it from. */ void read(final CompoundNBT compound); /** * get the disease identifier. + * * @return the disease identifier. */ String getDisease(); diff --git a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenExperienceHandler.java b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenExperienceHandler.java old mode 100644 new mode 100755 index 50f1eb23a35..af108b54fbb --- a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenExperienceHandler.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenExperienceHandler.java @@ -8,17 +8,14 @@ public interface ICitizenExperienceHandler void updateLevel(); /** - * Add experience points to citizen. - * Increases the citizen level if he has sufficient experience. - * This will reset the experience. + * Add experience points to citizen. Increases the citizen level if he has sufficient experience. This will reset the experience. * * @param xp the amount of points added. */ void addExperience(double xp); /** - * Drop some experience share depending on the experience and - * experienceLevel. + * Drop some experience share depending on the experience and experienceLevel. */ void dropExperience(); diff --git a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenHappinessHandler.java b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenHappinessHandler.java old mode 100644 new mode 100755 index 741ced6fd2f..47e6cfa887d --- a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenHappinessHandler.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenHappinessHandler.java @@ -13,12 +13,14 @@ public interface ICitizenHappinessHandler { /** * Reset a modifier. + * * @param name the name of the modifier. */ void resetModifier(final String name); /** * Get a modifier by the name. + * * @param name the name of the modifier to return. * @return the modifier. */ @@ -26,30 +28,35 @@ public interface ICitizenHappinessHandler /** * Process the happiness factors daily. + * * @param citizenData the citizen to process it for. */ void processDailyHappiness(final ICitizenData citizenData); /** * Get the computed happiness of the citizen. + * * @return the happiness. */ double getHappiness(); /** * Read the handler from NBT. + * * @param compound the compound to read it from. */ void read(CompoundNBT compound); /** * Write the handler to NBT. + * * @param compound the compound to write it to. */ void write(CompoundNBT compound); /** * Get a list of all modifiers. + * * @return the list. */ List getModifiers(); diff --git a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenInventoryHandler.java b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenInventoryHandler.java old mode 100644 new mode 100755 index 717b6b9b366..7d27f4f7efd --- a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenInventoryHandler.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenInventoryHandler.java @@ -16,7 +16,7 @@ public interface ICitizenInventoryHandler /** * Returns the first slot in the inventory with a specific block. * - * @param block the block. + * @param block the block. * @return the slot. */ int findFirstSlotInInventoryWith(Block block); @@ -24,7 +24,7 @@ public interface ICitizenInventoryHandler /** * Returns the amount of a certain block in the inventory. * - * @param block the block. + * @param block the block. * @return the quantity. */ int getItemCountInInventory(Block block); @@ -40,7 +40,7 @@ public interface ICitizenInventoryHandler /** * Checks if citizen has a certain block in the inventory. * - * @param block the block. + * @param block the block. * @return true if so. */ boolean hasItemInInventory(Block block); @@ -48,13 +48,14 @@ public interface ICitizenInventoryHandler /** * Checks if citizen has a certain item in the inventory. * - * @param item the item. + * @param item the item. * @return true if so. */ boolean hasItemInInventory(Item item); /** * Checks whether or not the inventory is full + * * @return true if the inventory is full */ boolean isInventoryFull(); diff --git a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenItemHandler.java b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenItemHandler.java old mode 100644 new mode 100755 index 0a96aebfce5..4234c05171b --- a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenItemHandler.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenItemHandler.java @@ -48,8 +48,7 @@ public interface ICitizenItemHandler /** * Swing entity arm, create sound and particle effects. *

- * If breakBlock is true then it will break the block (different sound and - * particles), and damage the tool in the citizens hand. + * If breakBlock is true then it will break the block (different sound and particles), and damage the tool in the citizens hand. * * @param blockPos Block position. * @param breakBlock if we want to break this block. @@ -58,7 +57,8 @@ public interface ICitizenItemHandler /** * Damage the current held item. - * @param hand hand the item is in. + * + * @param hand hand the item is in. * @param damage amount of damage. */ void damageItemInHand(Hand hand, int damage); @@ -71,8 +71,7 @@ public interface ICitizenItemHandler /** * Swing entity arm, create sound and particle effects. *

- * This will break the block (different sound and particles), - * and damage the tool in the citizens hand. + * This will break the block (different sound and particles), and damage the tool in the citizens hand. * * @param blockPos Block position. */ @@ -95,8 +94,9 @@ public interface ICitizenItemHandler /** * Apply mending to the armour. - * @return the remaining xp. + * * @param localXp the xp to add. + * @return the remaining xp. */ double applyMending(final double localXp); } diff --git a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenJobHandler.java b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenJobHandler.java old mode 100644 new mode 100755 index 87726456740..b5ad82b9569 --- a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenJobHandler.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenJobHandler.java @@ -8,6 +8,7 @@ public interface ICitizenJobHandler { /** * Set Model depending on job. + * * @param job the new job. */ void setModelDependingOnJob(@Nullable IJob job); @@ -31,6 +32,7 @@ public interface ICitizenJobHandler /** * Gets the job of the entity. + * * @return the job or els enull. */ @Nullable @@ -38,6 +40,7 @@ public interface ICitizenJobHandler /** * Method to check if the citizen job allows to run the avoidance task. + * * @return true if so. */ boolean shouldRunAvoidance(); diff --git a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenSkillHandler.java b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenSkillHandler.java old mode 100644 new mode 100755 index e4aa3d54229..2b324dfa025 --- a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenSkillHandler.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenSkillHandler.java @@ -17,20 +17,23 @@ public interface ICitizenSkillHandler { /** * Initiate a citizen skill handler with a level cap. + * * @param levelCap the max level. */ void init(final int levelCap); /** * Initiate a citizen with parent citizen datas. - * @param mom the mother data. - * @param dad the father data. + * + * @param mom the mother data. + * @param dad the father data. * @param rand random var. */ void init(@NotNull final ICitizenData mom, @NotNull final ICitizenData dad, Random rand); /** * Write the handler to NBT. + * * @return the handler written to NBT. */ @NotNull @@ -38,20 +41,23 @@ public interface ICitizenSkillHandler /** * Init the handler from NBT. + * * @param compoundNBT the input nbt. */ void read(@NotNull final CompoundNBT compoundNBT); /** * Attempt an intelligence level up with a base chance. - * @param random the random var. + * + * @param random the random var. * @param customChance the custom chance. - * @param citizen the citizen that is trying to level up. + * @param citizen the citizen that is trying to level up. */ void tryLevelUpIntelligence(@NotNull final Random random, final int customChance, @NotNull final ICitizenData citizen); /** * Get the level for a certain skill. + * * @param skill the skill. * @return the level. */ @@ -59,6 +65,7 @@ public interface ICitizenSkillHandler /** * Increment the level for a certain skill. + * * @param skill the skill to increment. * @param level the quantity. */ @@ -66,28 +73,32 @@ public interface ICitizenSkillHandler /** * Add experience to a skill. + * * @param skill the skill. - * @param xp the xp to add. - * @param data the citizen. + * @param xp the xp to add. + * @param data the citizen. */ void addXpToSkill(Skill skill, double xp, ICitizenData data); /** * Remove xp from a skill. + * * @param skill the skill to remove it from. - * @param xp the qty of xp. - * @param data the citizen. + * @param xp the qty of xp. + * @param data the citizen. */ void removeXpFromSkill(@NotNull final Skill skill, final double xp, @NotNull final ICitizenData data); /** * Level-up actions for the citizen, increases levels and notifies the Citizen's Job + * * @param data the citizen to level up. */ void levelUp(ICitizenData data); /** * Get the job modifier. + * * @param data the citizen data. * @return the job modifier. */ @@ -95,6 +106,7 @@ public interface ICitizenSkillHandler /** * Get the job modifier from the building on the client side. + * * @param workBuilding the building instance. * @return the modifier. */ @@ -102,12 +114,14 @@ public interface ICitizenSkillHandler /** * Get the total xp that the citizen has. + * * @return the total xp. */ double getTotalXP(); /** * Get a copy of the map of skills. + * * @return the skills. */ Map> getSkills(); diff --git a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenSleepHandler.java b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenSleepHandler.java old mode 100644 new mode 100755 index 7b1981b2835..46259b45bf3 --- a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenSleepHandler.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenSleepHandler.java @@ -15,6 +15,7 @@ public interface ICitizenSleepHandler /** * Returns the orientation of the bed in degrees. + * * @return the bed orientation. */ @OnlyIn(Dist.CLIENT) @@ -35,18 +36,21 @@ public interface ICitizenSleepHandler /** * Get the bed location of the citizen. + * * @return the bed location. */ BlockPos getBedLocation(); /** * Get the X render offset. + * * @return the offset. */ float getRenderOffsetX(); /** * Get the z render offset. + * * @return the offset. */ float getRenderOffsetZ(); diff --git a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenStatusHandler.java b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenStatusHandler.java old mode 100644 new mode 100755 index a2cbffee636..ceaa2ef4812 --- a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenStatusHandler.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenStatusHandler.java @@ -20,8 +20,7 @@ public interface ICitizenStatusHandler void setLatestStatus(ITextComponent... status); /** - * Append to the existing latestStatus list. - * This will override the oldest one if full and move the others one down in the array. + * Append to the existing latestStatus list. This will override the oldest one if full and move the others one down in the array. * * @param status the latest status to append */ @@ -29,12 +28,14 @@ public interface ICitizenStatusHandler /** * Getter for the current status. + * * @return the status. */ Status getStatus(); /** * Setter for the current status. + * * @param status the status to set. */ void setStatus(Status status); diff --git a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenStuckHandler.java b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenStuckHandler.java old mode 100644 new mode 100755 index 4640c459e85..9185cd928dc --- a/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenStuckHandler.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/citizenhandlers/ICitizenStuckHandler.java @@ -4,6 +4,7 @@ public interface ICitizenStuckHandler { /** * Let worker AIs check if the citizen is stuck to not track it on their own. + * * @return true if tried to move away already. */ boolean isStuck(); diff --git a/src/api/java/com/minecolonies/api/entity/citizen/happiness/AbstractHappinessModifier.java b/src/api/java/com/minecolonies/api/entity/citizen/happiness/AbstractHappinessModifier.java old mode 100644 new mode 100755 index de0fd901610..4f0186a4fdc --- a/src/api/java/com/minecolonies/api/entity/citizen/happiness/AbstractHappinessModifier.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/happiness/AbstractHappinessModifier.java @@ -21,7 +21,8 @@ public abstract class AbstractHappinessModifier implements IHappinessModifier /** * Create an instance of the happiness modifier. - * @param id its string id. + * + * @param id its string id. * @param weight its weight. */ public AbstractHappinessModifier(final String id, final double weight) diff --git a/src/api/java/com/minecolonies/api/entity/citizen/happiness/ClientHappinessModifier.java b/src/api/java/com/minecolonies/api/entity/citizen/happiness/ClientHappinessModifier.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/citizen/happiness/ExpirationBasedHappinessModifier.java b/src/api/java/com/minecolonies/api/entity/citizen/happiness/ExpirationBasedHappinessModifier.java old mode 100644 new mode 100755 index c48b28217a4..7b727000086 --- a/src/api/java/com/minecolonies/api/entity/citizen/happiness/ExpirationBasedHappinessModifier.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/happiness/ExpirationBasedHappinessModifier.java @@ -7,9 +7,8 @@ import static com.minecolonies.api.util.constant.NbtTagConstants.TAG_DAY; /** - * The Expiration based happiness modifier. - * These modifiers are invoked for a limited period of time and have a happiness buff or boost for this time on the happiness. - * This can also be inverted resulting in a buff or boost if this modifier is not invoked regularly. + * The Expiration based happiness modifier. These modifiers are invoked for a limited period of time and have a happiness buff or boost for this time on the happiness. This can + * also be inverted resulting in a buff or boost if this modifier is not invoked regularly. */ public class ExpirationBasedHappinessModifier extends StaticHappinessModifier { @@ -31,9 +30,9 @@ public class ExpirationBasedHappinessModifier extends StaticHappinessModifier /** * Create an instance of the happiness modifier. * - * @param id its string id. - * @param weight its weight. - * @param period the period. + * @param id its string id. + * @param weight its weight. + * @param period the period. * @param supplier the supplier to get the factor. */ public ExpirationBasedHappinessModifier(final String id, final double weight, final DoubleSupplier supplier, final int period) @@ -44,9 +43,10 @@ public ExpirationBasedHappinessModifier(final String id, final double weight, fi /** * Create an instance of the happiness modifier. - * @param id its string id. - * @param weight its weight. - * @param period the period. + * + * @param id its string id. + * @param weight its weight. + * @param period the period. * @param supplier the supplier to get the factor. * @param inverted if inverted. */ diff --git a/src/api/java/com/minecolonies/api/entity/citizen/happiness/IHappinessModifier.java b/src/api/java/com/minecolonies/api/entity/citizen/happiness/IHappinessModifier.java old mode 100644 new mode 100755 index c57e600e5d7..89dc5c2ea99 --- a/src/api/java/com/minecolonies/api/entity/citizen/happiness/IHappinessModifier.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/happiness/IHappinessModifier.java @@ -9,32 +9,35 @@ public interface IHappinessModifier { /** * Get the unique happiness id. + * * @return the string id. */ String getId(); /** - * get the factor of the happiness. - * value between 0 and 1 if negative. - * value above 1 if positive. + * get the factor of the happiness. value between 0 and 1 if negative. value above 1 if positive. + * * @return the value of the factor. */ double getFactor(); /** * Get the weight of the happiness. + * * @return the weight. */ double getWeight(); /** * Read the modifier from nbt. + * * @param compoundNBT the compound to read it from. */ void read(final CompoundNBT compoundNBT); /** * Write it to NBT. + * * @param compoundNBT the compound to write it to. */ void write(final CompoundNBT compoundNBT); @@ -51,6 +54,7 @@ public interface IHappinessModifier /** * Get the lang string of the happiness factor. + * * @return the lang string. */ default String getLangString() @@ -60,6 +64,7 @@ default String getLangString() /** * Get the days this is active. + * * @return the days. */ int getDays(); diff --git a/src/api/java/com/minecolonies/api/entity/citizen/happiness/StaticHappinessModifier.java b/src/api/java/com/minecolonies/api/entity/citizen/happiness/StaticHappinessModifier.java old mode 100644 new mode 100755 index 89e9e8a5002..75e430c951c --- a/src/api/java/com/minecolonies/api/entity/citizen/happiness/StaticHappinessModifier.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/happiness/StaticHappinessModifier.java @@ -15,8 +15,8 @@ public class StaticHappinessModifier extends AbstractHappinessModifier /** * Create an instance of the happiness modifier. * - * @param id its string id. - * @param weight its weight. + * @param id its string id. + * @param weight its weight. * @param supplier the supplier to get the factor. */ public StaticHappinessModifier(final String id, final double weight, final DoubleSupplier supplier) diff --git a/src/api/java/com/minecolonies/api/entity/citizen/happiness/TimeBasedHappinessModifier.java b/src/api/java/com/minecolonies/api/entity/citizen/happiness/TimeBasedHappinessModifier.java old mode 100644 new mode 100755 index 2d40f38fbdb..98a318487b4 --- a/src/api/java/com/minecolonies/api/entity/citizen/happiness/TimeBasedHappinessModifier.java +++ b/src/api/java/com/minecolonies/api/entity/citizen/happiness/TimeBasedHappinessModifier.java @@ -8,8 +8,7 @@ import static com.minecolonies.api.util.constant.NbtTagConstants.TAG_DAY; /** - * The time based happiness modifier. - * Over a time the buff/boost gets worse. + * The time based happiness modifier. Over a time the buff/boost gets worse. */ public class TimeBasedHappinessModifier extends StaticHappinessModifier { @@ -26,9 +25,9 @@ public class TimeBasedHappinessModifier extends StaticHappinessModifier /** * Create an instance of the happiness modifier. * - * @param id its string id. - * @param weight its weight. - * @param supplier the supplier to get the factor. + * @param id its string id. + * @param weight its weight. + * @param supplier the supplier to get the factor. * @param timeBasedFactor tuples about the boost/buff factor over time. */ public TimeBasedHappinessModifier(final String id, final double weight, final DoubleSupplier supplier, final Tuple[] timeBasedFactor) diff --git a/src/api/java/com/minecolonies/api/entity/mobs/AbstractEntityMinecoloniesMob.java b/src/api/java/com/minecolonies/api/entity/mobs/AbstractEntityMinecoloniesMob.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/IArcherMobEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/IArcherMobEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/IChiefMobEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/IChiefMobEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/IMeleeMobEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/IMeleeMobEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/RaiderMobUtils.java b/src/api/java/com/minecolonies/api/entity/mobs/RaiderMobUtils.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/amazons/AbstractEntityAmazon.java b/src/api/java/com/minecolonies/api/entity/mobs/amazons/AbstractEntityAmazon.java old mode 100644 new mode 100755 index 01dc12a22d5..980a4525d23 --- a/src/api/java/com/minecolonies/api/entity/mobs/amazons/AbstractEntityAmazon.java +++ b/src/api/java/com/minecolonies/api/entity/mobs/amazons/AbstractEntityAmazon.java @@ -20,7 +20,8 @@ public abstract class AbstractEntityAmazon extends AbstractEntityMinecoloniesMob { /** * Constructor method for Abstract egyptian.. - * @param type the type. + * + * @param type the type. * @param world the world. */ public AbstractEntityAmazon(final EntityType type, final World world) diff --git a/src/api/java/com/minecolonies/api/entity/mobs/amazons/IAmazonChief.java b/src/api/java/com/minecolonies/api/entity/mobs/amazons/IAmazonChief.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/amazons/IAmazonEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/amazons/IAmazonEntity.java old mode 100644 new mode 100755 index 08284461e01..e91683b47db --- a/src/api/java/com/minecolonies/api/entity/mobs/amazons/IAmazonEntity.java +++ b/src/api/java/com/minecolonies/api/entity/mobs/amazons/IAmazonEntity.java @@ -7,5 +7,5 @@ public interface IAmazonEntity extends IMob, ICommandSource, ICapabilitySerializable { - + } diff --git a/src/api/java/com/minecolonies/api/entity/mobs/amazons/IArcherAmazon.java b/src/api/java/com/minecolonies/api/entity/mobs/amazons/IArcherAmazon.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/barbarians/AbstractEntityBarbarian.java b/src/api/java/com/minecolonies/api/entity/mobs/barbarians/AbstractEntityBarbarian.java old mode 100644 new mode 100755 index 1b6c8ed0709..c182cb74221 --- a/src/api/java/com/minecolonies/api/entity/mobs/barbarians/AbstractEntityBarbarian.java +++ b/src/api/java/com/minecolonies/api/entity/mobs/barbarians/AbstractEntityBarbarian.java @@ -19,7 +19,7 @@ public abstract class AbstractEntityBarbarian extends AbstractEntityMinecolonies /** * Constructor method for Abstract Barbarians. * - * @param type the type. + * @param type the type. * @param world the world. */ public AbstractEntityBarbarian(final EntityType type, final World world) diff --git a/src/api/java/com/minecolonies/api/entity/mobs/barbarians/IArcherBarbarianEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/barbarians/IArcherBarbarianEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/barbarians/IBarbarianEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/barbarians/IBarbarianEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/barbarians/IChiefBarbarianEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/barbarians/IChiefBarbarianEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/barbarians/IMeleeBarbarianEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/barbarians/IMeleeBarbarianEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/egyptians/AbstractEntityEgyptian.java b/src/api/java/com/minecolonies/api/entity/mobs/egyptians/AbstractEntityEgyptian.java old mode 100644 new mode 100755 index aea684e7384..7a0753afe56 --- a/src/api/java/com/minecolonies/api/entity/mobs/egyptians/AbstractEntityEgyptian.java +++ b/src/api/java/com/minecolonies/api/entity/mobs/egyptians/AbstractEntityEgyptian.java @@ -20,7 +20,8 @@ public abstract class AbstractEntityEgyptian extends AbstractEntityMinecoloniesM { /** * Constructor method for Abstract egyptian.. - * @param type the type. + * + * @param type the type. * @param world the world. */ public AbstractEntityEgyptian(final EntityType type, final World world) diff --git a/src/api/java/com/minecolonies/api/entity/mobs/egyptians/IArcherMummyEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/egyptians/IArcherMummyEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/egyptians/IEgyptianEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/egyptians/IEgyptianEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/egyptians/IMeleeMummyEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/egyptians/IMeleeMummyEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/egyptians/IPharaoEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/egyptians/IPharaoEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/pirates/AbstractEntityPirate.java b/src/api/java/com/minecolonies/api/entity/mobs/pirates/AbstractEntityPirate.java old mode 100644 new mode 100755 index 552552938b2..990e2ac1185 --- a/src/api/java/com/minecolonies/api/entity/mobs/pirates/AbstractEntityPirate.java +++ b/src/api/java/com/minecolonies/api/entity/mobs/pirates/AbstractEntityPirate.java @@ -11,7 +11,6 @@ import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; - import java.util.Random; import static com.minecolonies.api.util.constant.RaiderConstants.ONE; @@ -34,7 +33,8 @@ public abstract class AbstractEntityPirate extends AbstractEntityMinecoloniesMob /** * Constructor method for Abstract Barbarians. - * @param type the type. + * + * @param type the type. * @param world the world. */ public AbstractEntityPirate(final EntityType type, final World world) @@ -69,6 +69,7 @@ public boolean canSpawn(final IWorld worldIn, final SpawnReason spawnReasonIn) /** * Get the unique texture id. + * * @return the texture id. */ public int getTextureId() diff --git a/src/api/java/com/minecolonies/api/entity/mobs/pirates/IArcherPirateEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/pirates/IArcherPirateEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/pirates/ICaptainPirateEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/pirates/ICaptainPirateEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/pirates/IMeleePirateEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/pirates/IMeleePirateEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/pirates/IPirateEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/pirates/IPirateEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/vikings/AbstractEntityNorsemen.java b/src/api/java/com/minecolonies/api/entity/mobs/vikings/AbstractEntityNorsemen.java old mode 100644 new mode 100755 index 3a541c72d75..53c6dd7fc3a --- a/src/api/java/com/minecolonies/api/entity/mobs/vikings/AbstractEntityNorsemen.java +++ b/src/api/java/com/minecolonies/api/entity/mobs/vikings/AbstractEntityNorsemen.java @@ -11,7 +11,6 @@ import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; - import java.util.Random; import static com.minecolonies.api.util.constant.RaiderConstants.ONE; @@ -34,7 +33,8 @@ public abstract class AbstractEntityNorsemen extends AbstractEntityMinecoloniesM /** * Constructor method for Abstract norsemen.. - * @param type the type. + * + * @param type the type. * @param world the world. */ public AbstractEntityNorsemen(final EntityType type, final World world) @@ -67,7 +67,6 @@ protected float getSoundPitch() return (this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F + 1.0F; } - @Override public boolean canSpawn(final IWorld worldIn, final SpawnReason spawnReasonIn) { @@ -76,6 +75,7 @@ public boolean canSpawn(final IWorld worldIn, final SpawnReason spawnReasonIn) /** * Get the unique texture id. + * * @return the texture id. */ public int getTextureId() diff --git a/src/api/java/com/minecolonies/api/entity/mobs/vikings/IArcherNorsemenEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/vikings/IArcherNorsemenEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/vikings/IMeleeNorsemenEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/vikings/IMeleeNorsemenEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/vikings/INorsemenChiefEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/vikings/INorsemenChiefEntity.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/mobs/vikings/INorsemenEntity.java b/src/api/java/com/minecolonies/api/entity/mobs/vikings/INorsemenEntity.java old mode 100644 new mode 100755 index 1fbbd3c5010..125fc6829fb --- a/src/api/java/com/minecolonies/api/entity/mobs/vikings/INorsemenEntity.java +++ b/src/api/java/com/minecolonies/api/entity/mobs/vikings/INorsemenEntity.java @@ -7,5 +7,5 @@ public interface INorsemenEntity extends IMob, ICommandSource, ICapabilitySerializable { - + } diff --git a/src/api/java/com/minecolonies/api/entity/pathfinding/AbstractAdvancedPathNavigate.java b/src/api/java/com/minecolonies/api/entity/pathfinding/AbstractAdvancedPathNavigate.java old mode 100644 new mode 100755 index 29de068e474..7401cf2aa9c --- a/src/api/java/com/minecolonies/api/entity/pathfinding/AbstractAdvancedPathNavigate.java +++ b/src/api/java/com/minecolonies/api/entity/pathfinding/AbstractAdvancedPathNavigate.java @@ -18,7 +18,7 @@ public abstract class AbstractAdvancedPathNavigate extends GroundPathNavigator { // Parent class private members - protected final MobEntity ourEntity; + protected final MobEntity ourEntity; @Nullable protected BlockPos destination; protected double walkSpeed = 1.0D; @@ -60,7 +60,12 @@ public BlockPos getDestination() public abstract boolean tryMoveToBlockPos(final BlockPos position, final double speed); - public abstract TreePathResult moveToTree(final BlockPos startRestriction, final BlockPos endRestriction, final double speed, final List treesToCut, final IColony colony); + public abstract TreePathResult moveToTree( + final BlockPos startRestriction, + final BlockPos endRestriction, + final double speed, + final List treesToCut, + final IColony colony); public abstract TreePathResult moveToTree(final int range, final double speed, final List treesToCut, final IColony colony); diff --git a/src/api/java/com/minecolonies/api/entity/pathfinding/PathFindingStatus.java b/src/api/java/com/minecolonies/api/entity/pathfinding/PathFindingStatus.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/pathfinding/PathResult.java b/src/api/java/com/minecolonies/api/entity/pathfinding/PathResult.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/pathfinding/PathingOptions.java b/src/api/java/com/minecolonies/api/entity/pathfinding/PathingOptions.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/pathfinding/TreePathResult.java b/src/api/java/com/minecolonies/api/entity/pathfinding/TreePathResult.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/pathfinding/WaterPathResult.java b/src/api/java/com/minecolonies/api/entity/pathfinding/WaterPathResult.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/entity/pathfinding/registry/IPathNavigateRegistry.java b/src/api/java/com/minecolonies/api/entity/pathfinding/registry/IPathNavigateRegistry.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/inventory/InventoryCitizen.java b/src/api/java/com/minecolonies/api/inventory/InventoryCitizen.java old mode 100644 new mode 100755 index cc81b790fbb..02d7d8054a8 --- a/src/api/java/com/minecolonies/api/inventory/InventoryCitizen.java +++ b/src/api/java/com/minecolonies/api/inventory/InventoryCitizen.java @@ -281,7 +281,7 @@ public ItemStack insertItem(final int slot, @Nonnull final ItemStack stack, fina { if (!simulate) { - inSlot.setCount(inSlot.getCount() + stack.getCount()); + inSlot.setCount(inSlot.getCount() + avail); } stack.setCount(stack.getCount() - avail); return stack; @@ -344,8 +344,7 @@ else if (slot == 39) } /** - * For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it - * hasn't changed and skip it. + * For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it hasn't changed and skip it. */ public void markDirty() { @@ -366,8 +365,7 @@ public ITextComponent getDisplayName() } /** - * Writes the inventory out as a list of compound tags. This is where the slot indices are used (+100 for armor, +80 - * for crafting). + * Writes the inventory out as a list of compound tags. This is where the slot indices are used (+100 for armor, +80 for crafting). * * @param nbtTagList the taglist in. * @return the filled list. diff --git a/src/api/java/com/minecolonies/api/inventory/ModContainers.java b/src/api/java/com/minecolonies/api/inventory/ModContainers.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/inventory/api/CombinedItemHandler.java b/src/api/java/com/minecolonies/api/inventory/api/CombinedItemHandler.java old mode 100644 new mode 100755 index 871bafa9bb7..c67489cc97d --- a/src/api/java/com/minecolonies/api/inventory/api/CombinedItemHandler.java +++ b/src/api/java/com/minecolonies/api/inventory/api/CombinedItemHandler.java @@ -49,12 +49,10 @@ public CombinedItemHandler(@NotNull final String defaultName, @NotNull final IIt } /** - * Method to create a new combined {@link CombinedItemHandler} with - * a given custom name. + * Method to create a new combined {@link CombinedItemHandler} with a given custom name. * * @param defaultName The name of this {@link CombinedItemHandler}. - * @param customName The preset custom name of this {@link - * CombinedItemHandler}. + * @param customName The preset custom name of this {@link CombinedItemHandler}. * @param handlers The combinging {@link IItemHandlerModifiable}. */ public CombinedItemHandler(@NotNull final String defaultName, @NotNull final String customName, @NotNull final IItemHandlerModifiable... handlers) @@ -120,15 +118,12 @@ public void deserializeNBT(final CompoundNBT nbt) } /** - * Overrides the stack in the given slot. This method is used by the - * standard Forge helper methods and classes. It is not intended for - * general use by other mods, and the handler may throw an error if it - * is called unexpectedly. + * Overrides the stack in the given slot. This method is used by the standard Forge helper methods and classes. It is not intended for general use by other mods, and the + * handler may throw an error if it is called unexpectedly. * * @param slot Slot to modify * @param stack ItemStack to set slot to (may be null) - * @throws RuntimeException if the handler is called in a way that the - * handler was not expecting. + * @throws RuntimeException if the handler is called in a way that the handler was not expecting. **/ @Override public void setStackInSlot(final int slot, final ItemStack stack) @@ -195,13 +190,11 @@ public int getSlots() *

* The result's stack size may be greater than the itemstacks max size. *

- * If the result is null, then the slot is empty. - * If the result is not null but the stack size is zero, then it represents - * an empty slot that will only accept* a specific itemstack. + * If the result is null, then the slot is empty. If the result is not null but the stack size is zero, then it represents an empty slot that will only accept* a specific + * itemstack. *

- * IMPORTANT: This ItemStack MUST NOT be modified. This method is not for - * altering an inventories contents. Any implementers who are able to detect - * modification through this method should throw an exception. + * IMPORTANT: This ItemStack MUST NOT be modified. This method is not for altering an inventories contents. Any implementers who are able to detect modification through this + * method should throw an exception. *

* SERIOUSLY: DO NOT MODIFY THE RETURNED ITEMSTACK * @@ -227,16 +220,14 @@ public ItemStack getStackInSlot(final int slot) } /** - * Inserts an ItemStack into the given slot and return the remainder. - * The ItemStack should not be modified in this function! - * Note: This behaviour is subtly different from IFluidHandlers.fill() + * Inserts an ItemStack into the given slot and return the remainder. The ItemStack should not be modified in this function! Note: This behaviour is subtly different from + * IFluidHandlers.fill() * * @param slot Slot to insert into. * @param stack ItemStack to insert. * @param simulate If true, the insertion is only simulated - * @return The remaining ItemStack that was not inserted (if the entire - * stack is accepted, then return null). May be the same as the input - * ItemStack if unchanged, otherwise a new ItemStack. + * @return The remaining ItemStack that was not inserted (if the entire stack is accepted, then return null). May be the same as the input ItemStack if unchanged, otherwise a + * new ItemStack. **/ @Override public ItemStack insertItem(final int slot, final ItemStack stack, final boolean simulate) @@ -257,16 +248,13 @@ public ItemStack insertItem(final int slot, final ItemStack stack, final boolean } /** - * Extracts an ItemStack from the given slot. The returned value must be - * null if nothing is extracted, otherwise it's stack size must not be - * greater than amount or the itemstacks getMaxStackSize(). + * Extracts an ItemStack from the given slot. The returned value must be null if nothing is extracted, otherwise it's stack size must not be greater than amount or the + * itemstacks getMaxStackSize(). * * @param slot Slot to extract from. - * @param amount Amount to extract (may be greater than the current stacks - * max limit) + * @param amount Amount to extract (may be greater than the current stacks max limit) * @param simulate If true, the extraction is only simulated - * @return ItemStack extracted from the slot, must be null, if nothing can - * be extracted + * @return ItemStack extracted from the slot, must be null, if nothing can be extracted **/ @Override public ItemStack extractItem(final int slot, final int amount, final boolean simulate) diff --git a/src/api/java/com/minecolonies/api/inventory/api/IWorldNameableModifiable.java b/src/api/java/com/minecolonies/api/inventory/api/IWorldNameableModifiable.java old mode 100644 new mode 100755 index e36126064d0..8ac89f7a50e --- a/src/api/java/com/minecolonies/api/inventory/api/IWorldNameableModifiable.java +++ b/src/api/java/com/minecolonies/api/inventory/api/IWorldNameableModifiable.java @@ -11,8 +11,7 @@ public interface IWorldNameableModifiable extends INameable /** * Method to set the name of this {@link INameable}. * - * @param name The new name of this {@link INameable}, or null to reset - * it to its default. + * @param name The new name of this {@link INameable}, or null to reset it to its default. */ void setName(@Nullable String name); } diff --git a/src/api/java/com/minecolonies/api/inventory/container/ContainerBuildingInventory.java b/src/api/java/com/minecolonies/api/inventory/container/ContainerBuildingInventory.java old mode 100644 new mode 100755 index 0cdef219d0f..5d85d31c455 --- a/src/api/java/com/minecolonies/api/inventory/container/ContainerBuildingInventory.java +++ b/src/api/java/com/minecolonies/api/inventory/container/ContainerBuildingInventory.java @@ -118,12 +118,10 @@ public void putStack(final ItemStack stack) } /** - * Handle when the stack in slot {@code index} is shift-clicked. Normally this moves the stack between the player - * inventory and the other inventory(s). + * Handle when the stack in slot {@code index} is shift-clicked. Normally this moves the stack between the player inventory and the other inventory(s). * * @param playerIn Player that interacted with this {@code Container}. - * @param index Index of the {@link Slot}. This index is relative to the list of slots in this {@code Container}, - * {@link #inventorySlots}. + * @param index Index of the {@link Slot}. This index is relative to the list of slots in this {@code Container}, {@link #inventorySlots}. */ @Override public ItemStack transferStackInSlot(final PlayerEntity playerIn, final int index) diff --git a/src/api/java/com/minecolonies/api/inventory/container/ContainerCitizenInventory.java b/src/api/java/com/minecolonies/api/inventory/container/ContainerCitizenInventory.java old mode 100644 new mode 100755 index 0d14f9d1497..4cc9cf85d62 --- a/src/api/java/com/minecolonies/api/inventory/container/ContainerCitizenInventory.java +++ b/src/api/java/com/minecolonies/api/inventory/container/ContainerCitizenInventory.java @@ -30,14 +30,15 @@ public class ContainerCitizenInventory extends Container /** * Amount of rows. */ - private final int inventorySize; - private String displayName; + private final int inventorySize; + private String displayName; /** * Creating the citizen inventory container. + * * @param windowId the window id. - * @param inv the inventory. - * @param extra extra data. + * @param inv the inventory. + * @param extra extra data. */ public ContainerCitizenInventory(final int windowId, final PlayerInventory inv, final PacketBuffer extra) { @@ -94,24 +95,24 @@ public ContainerCitizenInventory(final int windowId, final PlayerInventory inv, if (index < size) { this.addSlot( - new SlotItemHandler(inventory, index, - INVENTORY_BAR_SIZE + k * PLAYER_INVENTORY_OFFSET_EACH, - PLAYER_INVENTORY_OFFSET_EACH + j * PLAYER_INVENTORY_OFFSET_EACH) - { - @Override - public void putStack(@NotNull final ItemStack stack) - { - if (workBuilding != null && !playerInventory.player.world.isRemote && !ItemStackUtils.isEmpty(stack)) - { - final IColony colony = IColonyManager.getInstance().getColonyByWorld(colonyId, inv.player.world); - final IBuilding building = colony.getBuildingManager().getBuilding(workBuilding); - final ICitizenData citizenData = colony.getCitizenManager().getCitizen(citizenId); - - building.overruleNextOpenRequestOfCitizenWithStack(citizenData, stack); - } - super.putStack(stack); - } - }); + new SlotItemHandler(inventory, index, + INVENTORY_BAR_SIZE + k * PLAYER_INVENTORY_OFFSET_EACH, + PLAYER_INVENTORY_OFFSET_EACH + j * PLAYER_INVENTORY_OFFSET_EACH) + { + @Override + public void putStack(@NotNull final ItemStack stack) + { + if (workBuilding != null && !playerInventory.player.world.isRemote && !ItemStackUtils.isEmpty(stack)) + { + final IColony colony = IColonyManager.getInstance().getColonyByWorld(colonyId, inv.player.world); + final IBuilding building = colony.getBuildingManager().getBuilding(workBuilding); + final ICitizenData citizenData = colony.getCitizenManager().getCitizen(citizenId); + + building.overruleNextOpenRequestOfCitizenWithStack(citizenData, stack); + } + super.putStack(stack); + } + }); index++; } } @@ -125,11 +126,11 @@ public void putStack(@NotNull final ItemStack stack) for (int j = 0; j < INVENTORY_COLUMNS; j++) { addSlot(new Slot( - playerInventory, - j + i * INVENTORY_COLUMNS + INVENTORY_COLUMNS, - PLAYER_INVENTORY_INITIAL_X_OFFSET + j * PLAYER_INVENTORY_OFFSET_EACH, - PLAYER_INVENTORY_INITIAL_Y_OFFSET + extraOffset + PLAYER_INVENTORY_OFFSET_EACH * Math.min(this.inventorySize, INVENTORY_BAR_SIZE) - + i * PLAYER_INVENTORY_OFFSET_EACH + playerInventory, + j + i * INVENTORY_COLUMNS + INVENTORY_COLUMNS, + PLAYER_INVENTORY_INITIAL_X_OFFSET + j * PLAYER_INVENTORY_OFFSET_EACH, + PLAYER_INVENTORY_INITIAL_Y_OFFSET + extraOffset + PLAYER_INVENTORY_OFFSET_EACH * Math.min(this.inventorySize, INVENTORY_BAR_SIZE) + + i * PLAYER_INVENTORY_OFFSET_EACH )); } } @@ -137,21 +138,19 @@ public void putStack(@NotNull final ItemStack stack) for (i = 0; i < INVENTORY_COLUMNS; i++) { addSlot(new Slot( - playerInventory, i, - PLAYER_INVENTORY_INITIAL_X_OFFSET + i * PLAYER_INVENTORY_OFFSET_EACH, - PLAYER_INVENTORY_HOTBAR_OFFSET + extraOffset + PLAYER_INVENTORY_OFFSET_EACH * Math.min(this.inventorySize, - INVENTORY_BAR_SIZE) + playerInventory, i, + PLAYER_INVENTORY_INITIAL_X_OFFSET + i * PLAYER_INVENTORY_OFFSET_EACH, + PLAYER_INVENTORY_HOTBAR_OFFSET + extraOffset + PLAYER_INVENTORY_OFFSET_EACH * Math.min(this.inventorySize, + INVENTORY_BAR_SIZE) )); } } /** - * Handle when the stack in slot {@code index} is shift-clicked. Normally this moves the stack between the player - * inventory and the other inventory(s). + * Handle when the stack in slot {@code index} is shift-clicked. Normally this moves the stack between the player inventory and the other inventory(s). * * @param playerIn Player that interacted with this {@code Container}. - * @param index Index of the {@link Slot}. This index is relative to the list of slots in this {@code Container}, - * {@link #inventorySlots}. + * @param index Index of the {@link Slot}. This index is relative to the list of slots in this {@code Container}, {@link #inventorySlots}. */ @NotNull @Override @@ -203,6 +202,7 @@ public boolean canInteractWith(@NotNull final PlayerEntity playerIn) /** * Getter for the display name. + * * @return the display name. */ public String getDisplayName() diff --git a/src/api/java/com/minecolonies/api/inventory/container/ContainerCrafting.java b/src/api/java/com/minecolonies/api/inventory/container/ContainerCrafting.java old mode 100644 new mode 100755 index f7682b4a630..e467f80991d --- a/src/api/java/com/minecolonies/api/inventory/container/ContainerCrafting.java +++ b/src/api/java/com/minecolonies/api/inventory/container/ContainerCrafting.java @@ -68,9 +68,10 @@ public class ContainerCrafting extends Container /** * Creates a crafting container. + * * @param windowId the window id. - * @param inv the inventory. - * @param extra some extra data. + * @param inv the inventory. + * @param extra some extra data. */ public ContainerCrafting(final int windowId, final PlayerInventory inv, final PacketBuffer extra) { @@ -79,7 +80,7 @@ public ContainerCrafting(final int windowId, final PlayerInventory inv, final Pa this.inv = inv; this.complete = extra.readBoolean(); this.pos = extra.readBlockPos(); - if(complete) + if (complete) { craftMatrix = new CraftingInventory(this, 3, 3); } @@ -101,7 +102,7 @@ public boolean canTakeStack(final PlayerEntity playerIn) { for (int j = 0; j < craftMatrix.getHeight(); ++j) { - this.addSlot(new Slot(this.craftMatrix, j + i * (complete ? 3 : 2) , X_OFFSET_CRAFTING + j * INVENTORY_OFFSET_EACH, Y_OFFSET_CRAFTING + i * INVENTORY_OFFSET_EACH) + this.addSlot(new Slot(this.craftMatrix, j + i * (complete ? 3 : 2), X_OFFSET_CRAFTING + j * INVENTORY_OFFSET_EACH, Y_OFFSET_CRAFTING + i * INVENTORY_OFFSET_EACH) { @Override public int getSlotStackLimit() @@ -147,9 +148,9 @@ public boolean canTakeStack(final PlayerEntity par1PlayerEntity) { addSlot(new Slot( inv, - j + i * INVENTORY_COLUMNS + INVENTORY_COLUMNS, - PLAYER_INVENTORY_INITIAL_X_OFFSET + j * PLAYER_INVENTORY_OFFSET_EACH, - PLAYER_INVENTORY_INITIAL_Y_OFFSET_CRAFTING + i * PLAYER_INVENTORY_OFFSET_EACH + j + i * INVENTORY_COLUMNS + INVENTORY_COLUMNS, + PLAYER_INVENTORY_INITIAL_X_OFFSET + j * PLAYER_INVENTORY_OFFSET_EACH, + PLAYER_INVENTORY_INITIAL_Y_OFFSET_CRAFTING + i * PLAYER_INVENTORY_OFFSET_EACH )); } } @@ -158,7 +159,7 @@ public boolean canTakeStack(final PlayerEntity par1PlayerEntity) { addSlot(new Slot( inv, i, - PLAYER_INVENTORY_INITIAL_X_OFFSET + i * PLAYER_INVENTORY_OFFSET_EACH, + PLAYER_INVENTORY_INITIAL_X_OFFSET + i * PLAYER_INVENTORY_OFFSET_EACH, PLAYER_INVENTORY_HOTBAR_OFFSET_CRAFTING )); } @@ -178,9 +179,9 @@ public void onCraftMatrixChanged(final IInventory inventoryIn) final Optional iRecipe = ((ServerPlayerEntity) inv.player).server.getRecipeManager().getRecipe(IRecipeType.CRAFTING, craftMatrix, world); final ItemStack stack; if (iRecipe.isPresent() && (iRecipe.get().isDynamic() - || !world.getGameRules().getBoolean(GameRules.DO_LIMITED_CRAFTING) - || player.getRecipeBook().isUnlocked(iRecipe.get()) - || player.isCreative())) + || !world.getGameRules().getBoolean(GameRules.DO_LIMITED_CRAFTING) + || player.getRecipeBook().isUnlocked(iRecipe.get()) + || player.isCreative())) { stack = iRecipe.get().getCraftingResult(this.craftMatrix); this.craftResultSlot.putStack(stack); @@ -210,8 +211,8 @@ public ItemStack slotClick(final int slotId, final int clickedButton, final Clic { // 1 is shift-click if (mode == ClickType.PICKUP - || mode == ClickType.PICKUP_ALL - || mode == ClickType.SWAP) + || mode == ClickType.PICKUP_ALL + || mode == ClickType.SWAP) { final Slot slot = this.inventorySlots.get(slotId); @@ -223,7 +224,7 @@ public ItemStack slotClick(final int slotId, final int clickedButton, final Clic return ItemStack.EMPTY; } - if(mode == ClickType.QUICK_MOVE) + if (mode == ClickType.QUICK_MOVE) { return ItemStack.EMPTY; } @@ -233,7 +234,8 @@ public ItemStack slotClick(final int slotId, final int clickedButton, final Clic /** * Handle a slot click. - * @param slot the clicked slot. + * + * @param slot the clicked slot. * @param stack the used stack. * @return the result. */ @@ -287,8 +289,8 @@ else if (index < HOTBAR_START) } } else if ((index < total_slots - && !this.mergeItemStack(itemstack1, total_crafting_slots, HOTBAR_START, false)) - || !this.mergeItemStack(itemstack1, total_crafting_slots, total_slots, false)) + && !this.mergeItemStack(itemstack1, total_crafting_slots, HOTBAR_START, false)) + || !this.mergeItemStack(itemstack1, total_crafting_slots, total_slots, false)) { return ItemStack.EMPTY; } @@ -316,6 +318,7 @@ public boolean canMergeSlot(final ItemStack stack, final Slot slotIn) /** * Getter for the world obj. + * * @return the world obj. */ public World getWorldObj() @@ -325,6 +328,7 @@ public World getWorldObj() /** * Getter for the player. + * * @return the player. */ public PlayerEntity getPlayer() @@ -334,6 +338,7 @@ public PlayerEntity getPlayer() /** * Getter for completeness. + * * @return true if 3x3 and false for 2x2. */ public boolean isComplete() @@ -343,6 +348,7 @@ public boolean isComplete() /** * Get the craft matrix inv. + * * @return the inv. */ public CraftingInventory getInv() @@ -352,6 +358,7 @@ public CraftingInventory getInv() /** * Get for the container position. + * * @return the position. */ public BlockPos getPos() diff --git a/src/api/java/com/minecolonies/api/inventory/container/ContainerCraftingFurnace.java b/src/api/java/com/minecolonies/api/inventory/container/ContainerCraftingFurnace.java old mode 100644 new mode 100755 index 9a7af81c5af..0e84bda050b --- a/src/api/java/com/minecolonies/api/inventory/container/ContainerCraftingFurnace.java +++ b/src/api/java/com/minecolonies/api/inventory/container/ContainerCraftingFurnace.java @@ -45,14 +45,16 @@ public class ContainerCraftingFurnace extends Container /** * Constructs the GUI with the player. + * * @param windowId the window id. - * @param inv the player inventory. - * @param extra extra data. + * @param inv the player inventory. + * @param extra extra data. */ public ContainerCraftingFurnace(final int windowId, final PlayerInventory inv, final PacketBuffer extra) { super(ModContainers.craftingFurnace, windowId); - this.furnaceInventory = new IItemHandlerModifiable() { + this.furnaceInventory = new IItemHandlerModifiable() + { ItemStack input = ItemStack.EMPTY; ItemStack output = ItemStack.EMPTY; @@ -137,7 +139,7 @@ public boolean isItemValid(final int slot, @Nonnull final ItemStack stack) }; this.playerInventory = inv; buildingPos = extra.readBlockPos(); - this.addSlot(new SlotItemHandler(furnaceInventory, 0 , 56, 17) + this.addSlot(new SlotItemHandler(furnaceInventory, 0, 56, 17) { @Override public int getSlotStackLimit() @@ -223,7 +225,7 @@ public ItemStack slotClick(final int slotId, final int clickedButton, final Clic clickResult = ItemStack.EMPTY; } } - else if(mode == ClickType.QUICK_MOVE) + else if (mode == ClickType.QUICK_MOVE) { clickResult = ItemStack.EMPTY; } @@ -248,7 +250,8 @@ else if(mode == ClickType.QUICK_MOVE) /** * Handle a slot click. - * @param slot the clicked slot. + * + * @param slot the clicked slot. * @param stack the used stack. * @return the result. */ @@ -334,6 +337,7 @@ public boolean canMergeSlot(final ItemStack stack, final Slot slotIn) /** * Get the position of the container. + * * @return the position. */ public BlockPos getPos() diff --git a/src/api/java/com/minecolonies/api/inventory/container/ContainerField.java b/src/api/java/com/minecolonies/api/inventory/container/ContainerField.java old mode 100644 new mode 100755 index cd01cff7d79..79d0d22aff1 --- a/src/api/java/com/minecolonies/api/inventory/container/ContainerField.java +++ b/src/api/java/com/minecolonies/api/inventory/container/ContainerField.java @@ -46,9 +46,10 @@ public class ContainerField extends Container /** * Constructs the GUI with the player. - * @param windowId the window id. + * + * @param windowId the window id. * @param playerInventory the player inventory. - * @param extra extra data. + * @param extra extra data. */ public ContainerField(final int windowId, final PlayerInventory playerInventory, final PacketBuffer extra) { @@ -77,11 +78,11 @@ public ContainerField(final int windowId, final PlayerInventory playerInventory, for (int j = 0; j < INVENTORY_COLUMNS; j++) { addSlot(new Slot( - playerInventory, - j + i * INVENTORY_COLUMNS + INVENTORY_COLUMNS, - PLAYER_INVENTORY_INITIAL_X_OFFSET + j * PLAYER_INVENTORY_OFFSET_EACH, - PLAYER_INVENTORY_INITIAL_Y_OFFSET + extraOffset + PLAYER_INVENTORY_OFFSET_EACH * LINES_PER_OFFSET - + i * PLAYER_INVENTORY_OFFSET_EACH + playerInventory, + j + i * INVENTORY_COLUMNS + INVENTORY_COLUMNS, + PLAYER_INVENTORY_INITIAL_X_OFFSET + j * PLAYER_INVENTORY_OFFSET_EACH, + PLAYER_INVENTORY_INITIAL_Y_OFFSET + extraOffset + PLAYER_INVENTORY_OFFSET_EACH * LINES_PER_OFFSET + + i * PLAYER_INVENTORY_OFFSET_EACH )); } } @@ -89,9 +90,9 @@ public ContainerField(final int windowId, final PlayerInventory playerInventory, for (i = 0; i < INVENTORY_COLUMNS; i++) { addSlot(new Slot( - playerInventory, i, - PLAYER_INVENTORY_INITIAL_X_OFFSET + i * PLAYER_INVENTORY_OFFSET_EACH, - PLAYER_INVENTORY_HOTBAR_OFFSET + extraOffset + PLAYER_INVENTORY_OFFSET_EACH * LINES_PER_OFFSET + playerInventory, i, + PLAYER_INVENTORY_INITIAL_X_OFFSET + i * PLAYER_INVENTORY_OFFSET_EACH, + PLAYER_INVENTORY_HOTBAR_OFFSET + extraOffset + PLAYER_INVENTORY_OFFSET_EACH * LINES_PER_OFFSET )); } } @@ -103,13 +104,17 @@ public ItemStack transferStackInSlot(@NotNull final PlayerEntity playerIn, final ItemStack transfer = ItemStackUtils.EMPTY; Slot slot = this.inventorySlots.get(index); - if (slot == null || !slot.getHasStack()) return transfer; + if (slot == null || !slot.getHasStack()) + { + return transfer; + } transfer = slot.getStack(); if (index == 0) { - if (!mergeItemStack(transfer, 1, 37, true)) { + if (!mergeItemStack(transfer, 1, 37, true)) + { return ItemStackUtils.EMPTY; } } @@ -128,12 +133,15 @@ public ItemStack transferStackInSlot(@NotNull final PlayerEntity playerIn, final public boolean canInteractWith(@NotNull final PlayerEntity playerIn) { if (colony == null) + { return false; + } return colony.getPermissions().hasPermission(playerIn, Action.ACCESS_HUTS); } /** * Get the assigned tile entity. + * * @return the tile. */ public AbstractScarescrowTileEntity getTileEntity() diff --git a/src/api/java/com/minecolonies/api/inventory/container/ContainerRack.java b/src/api/java/com/minecolonies/api/inventory/container/ContainerRack.java old mode 100644 new mode 100755 index 2010d8c586e..9a143fb7a4d --- a/src/api/java/com/minecolonies/api/inventory/container/ContainerRack.java +++ b/src/api/java/com/minecolonies/api/inventory/container/ContainerRack.java @@ -43,9 +43,10 @@ public class ContainerRack extends Container /** * The container constructor. + * * @param windowId the window id. - * @param inv the inventory. - * @param extra some extra data. + * @param inv the inventory. + * @param extra some extra data. */ public ContainerRack(final int windowId, final PlayerInventory inv, final PacketBuffer extra) { @@ -54,7 +55,7 @@ public ContainerRack(final int windowId, final PlayerInventory inv, final Packet final BlockPos neighbor = extra.readBlockPos(); final AbstractTileEntityRack abstractTileEntityRack = (AbstractTileEntityRack) inv.player.world.getTileEntity(rack); - final AbstractTileEntityRack neighborRack = (AbstractTileEntityRack) inv.player.world.getTileEntity(neighbor); + final AbstractTileEntityRack neighborRack = (AbstractTileEntityRack) inv.player.world.getTileEntity(neighbor); if (neighborRack != null) { @@ -89,8 +90,8 @@ public ContainerRack(final int windowId, final PlayerInventory inv, final Packet { this.addSlot( new SlotItemHandler(inventory, index, - INVENTORY_BAR_SIZE + k * PLAYER_INVENTORY_OFFSET_EACH, - PLAYER_INVENTORY_OFFSET_EACH + j * PLAYER_INVENTORY_OFFSET_EACH)); + INVENTORY_BAR_SIZE + k * PLAYER_INVENTORY_OFFSET_EACH, + PLAYER_INVENTORY_OFFSET_EACH + j * PLAYER_INVENTORY_OFFSET_EACH)); index++; } } @@ -105,10 +106,10 @@ public ContainerRack(final int windowId, final PlayerInventory inv, final Packet { addSlot(new Slot( inv, - j + i * INVENTORY_COLUMNS + INVENTORY_COLUMNS, - PLAYER_INVENTORY_INITIAL_X_OFFSET + j * PLAYER_INVENTORY_OFFSET_EACH, - PLAYER_INVENTORY_INITIAL_Y_OFFSET + extraOffset + PLAYER_INVENTORY_OFFSET_EACH * Math.min(this.inventorySize, INVENTORY_BAR_SIZE) - + i * PLAYER_INVENTORY_OFFSET_EACH + j + i * INVENTORY_COLUMNS + INVENTORY_COLUMNS, + PLAYER_INVENTORY_INITIAL_X_OFFSET + j * PLAYER_INVENTORY_OFFSET_EACH, + PLAYER_INVENTORY_INITIAL_Y_OFFSET + extraOffset + PLAYER_INVENTORY_OFFSET_EACH * Math.min(this.inventorySize, INVENTORY_BAR_SIZE) + + i * PLAYER_INVENTORY_OFFSET_EACH )); } } @@ -117,9 +118,9 @@ public ContainerRack(final int windowId, final PlayerInventory inv, final Packet { addSlot(new Slot( inv, i, - PLAYER_INVENTORY_INITIAL_X_OFFSET + i * PLAYER_INVENTORY_OFFSET_EACH, - PLAYER_INVENTORY_HOTBAR_OFFSET + extraOffset + PLAYER_INVENTORY_OFFSET_EACH * Math.min(this.inventorySize, - INVENTORY_BAR_SIZE) + PLAYER_INVENTORY_INITIAL_X_OFFSET + i * PLAYER_INVENTORY_OFFSET_EACH, + PLAYER_INVENTORY_HOTBAR_OFFSET + extraOffset + PLAYER_INVENTORY_OFFSET_EACH * Math.min(this.inventorySize, + INVENTORY_BAR_SIZE) )); } } diff --git a/src/api/java/com/minecolonies/api/items/IChiefSwordItem.java b/src/api/java/com/minecolonies/api/items/IChiefSwordItem.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/items/ModItems.java b/src/api/java/com/minecolonies/api/items/ModItems.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/network/IMessage.java b/src/api/java/com/minecolonies/api/network/IMessage.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/network/PacketUtils.java b/src/api/java/com/minecolonies/api/network/PacketUtils.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/research/IGlobalResearch.java b/src/api/java/com/minecolonies/api/research/IGlobalResearch.java old mode 100644 new mode 100755 index 3a65e242dde..544b2efb724 --- a/src/api/java/com/minecolonies/api/research/IGlobalResearch.java +++ b/src/api/java/com/minecolonies/api/research/IGlobalResearch.java @@ -16,6 +16,7 @@ public interface IGlobalResearch { /** * Check if this research can be executed at this moment. + * * @param uni_level the level of the university. * @param localTree the local tree of the colony. * @return true if so. @@ -24,6 +25,7 @@ public interface IGlobalResearch /** * Check if this research can be displayed in the GUI. + * * @param uni_level the level of the university. * @return true if so. */ @@ -36,6 +38,7 @@ public interface IGlobalResearch /** * Check whether all resources are available to execute the research. + * * @param inventory the inventory to check in. * @return true if so */ @@ -43,62 +46,71 @@ public interface IGlobalResearch /** * Get the cost list from the research. + * * @return the list. */ List getCostList(); /** * Start the research. - * @param player the player starting it. - * @param localResearchTree the local research tree to store in the colony. + * + * @param player the player starting it. + * @param localResearchTree the local research tree to store in the colony. */ void startResearch(@NotNull final PlayerEntity player, @NotNull final ILocalResearchTree localResearchTree); /** * Human readable description of research. + * * @return the description. */ String getDesc(); /** * Getter of the id of the research. + * * @return the String id. */ String getId(); /** * Get the id of the parent IResearch. + * * @return the string id. */ String getParent(); /** * Get the string name of the branch. + * * @return the branch name. */ String getBranch(); /** * Get the depth in the research tree. + * * @return the depth. */ int getDepth(); /** - * Check if this research is an only child research. - * This means, after researching one child no other childs can be researched. + * Check if this research is an only child research. This means, after researching one child no other childs can be researched. + * * @return true if so. */ boolean hasOnlyChild(); /** * Set if a research should only allow one child. + * * @param onlyChild the param to set. */ void setOnlyChild(boolean onlyChild); /** * Check if this research has other children and if one of these children has been research already. + * * @param localTree the local tree of the colony. * @return true if so. */ @@ -106,35 +118,42 @@ public interface IGlobalResearch /** * Add a child to a research. + * * @param child the child to add. */ void addChild(IGlobalResearch child); /** * Get the list of children of the research. + * * @return a copy of the list of child identifiers. */ ImmutableList getChilds(); /** * Set the parent of a research. + * * @param id the id of the parent. */ void setParent(String id); /** * Set the research requirement. + * * @param requirement the requirement. */ void setRequirement(final IResearchRequirement requirement); + /** * Getter for the research requirement. + * * @return the requirement. */ IResearchRequirement getResearchRequirement(); /** * Get the effect of the research. + * * @return the effect. */ IResearchEffect getEffect(); diff --git a/src/api/java/com/minecolonies/api/research/IGlobalResearchTree.java b/src/api/java/com/minecolonies/api/research/IGlobalResearchTree.java old mode 100644 new mode 100755 index 75a594db277..7e2e2afcea2 --- a/src/api/java/com/minecolonies/api/research/IGlobalResearchTree.java +++ b/src/api/java/com/minecolonies/api/research/IGlobalResearchTree.java @@ -12,6 +12,7 @@ public interface IGlobalResearchTree { /** * Get an instance of this Tree. + * * @return the instance. */ static IGlobalResearchTree getInstance() @@ -21,7 +22,8 @@ static IGlobalResearchTree getInstance() /** * Get a research by id. - * @param id the id of the research. + * + * @param id the id of the research. * @param branch the branch of the research. * @return the IResearch object. */ @@ -29,19 +31,22 @@ static IGlobalResearchTree getInstance() /** * Add a research to the tree. + * * @param research the research to add. - * @param branch the branch of the research. + * @param branch the branch of the research. */ void addResearch(final String branch, final IGlobalResearch research); /** * Get the list of all branches. + * * @return the list of branches. */ List getBranches(); /** * Get the primary research of a certain branch. + * * @param branch the branch it belongs to. * @return the list of research without parent. */ @@ -49,14 +54,15 @@ static IGlobalResearchTree getInstance() /** * Write the research tree to NBT. + * * @param compound the compound. */ void writeToNBT(final CompoundNBT compound); /** * Read the research tree from NBT. - * @param compound the compound to read it from. - + + * + * @param compound the compound to read it from. + */ void readFromNBT(final CompoundNBT compound); diff --git a/src/api/java/com/minecolonies/api/research/ILocalResearch.java b/src/api/java/com/minecolonies/api/research/ILocalResearch.java old mode 100644 new mode 100755 index 823e148e5a2..8dbf22d8159 --- a/src/api/java/com/minecolonies/api/research/ILocalResearch.java +++ b/src/api/java/com/minecolonies/api/research/ILocalResearch.java @@ -4,57 +4,64 @@ import com.minecolonies.api.research.util.ResearchState; /** - * Interface defining how a local research at a colony is. - * This represents how a colony stores researches they finished or started. + * Interface defining how a local research at a colony is. This represents how a colony stores researches they finished or started. */ public interface ILocalResearch { /** * Getter for the progress of the research. + * * @return the progress in ticks. */ int getProgress(); /** * Getter of the id of the research. + * * @return the String id. */ String getId(); /** * Get the ResearchState of the research. + * * @return the current state. */ ResearchState getState(); /** * Get the string name of the branch. + * * @return the branch name. */ String getBranch(); /** * Getter for the research depth. + * * @return the depth. */ int getDepth(); /** * Set the current research state. + * * @param value the state to set. */ void setState(ResearchState value); /** * Set the research progress. + * * @param progress the progress to set. */ void setProgress(int progress); /** * Tick the research to execute it. + * * @param effects the research effects class which holds the information of the colony. - * @param tree the research tree which holds the currently explored tree. + * @param tree the research tree which holds the currently explored tree. * @return true if effective. */ boolean research(IResearchEffectManager effects, ILocalResearchTree tree); diff --git a/src/api/java/com/minecolonies/api/research/ILocalResearchTree.java b/src/api/java/com/minecolonies/api/research/ILocalResearchTree.java old mode 100644 new mode 100755 index d42b7cb4193..f408a1fe45a --- a/src/api/java/com/minecolonies/api/research/ILocalResearchTree.java +++ b/src/api/java/com/minecolonies/api/research/ILocalResearchTree.java @@ -12,7 +12,8 @@ public interface ILocalResearchTree { /** * Get a research by id. - * @param id the id of the research. + * + * @param id the id of the research. * @param branch the branch of the research. * @return the IResearch object. */ @@ -20,14 +21,15 @@ public interface ILocalResearchTree /** * Add a research to the tree. + * * @param research the research to add. - * @param branch the branch of the research. + * @param branch the branch of the research. */ void addResearch(final String branch, final ILocalResearch research); /** - * Check if a branch already researched a level 6 research. - * This is important since only 1 of these can be researched for each branch. + * Check if a branch already researched a level 6 research. This is important since only 1 of these can be researched for each branch. + * * @param branch the branch to check. * @return true if so. */ @@ -35,26 +37,30 @@ public interface ILocalResearchTree /** * Get a list of all research in progress. + * * @return the list. */ List getResearchInProgress(); /** * Finish a research and remove it from the inProgress list. + * * @param id the id of the research to remove. */ void finishResearch(final String id); /** * Write the research tree to NBT. + * * @param compound the compound. */ void writeToNBT(final CompoundNBT compound); /** * Read the research tree from NBT. + * * @param compound the compound to read it from. - * @param effects the effects. + * @param effects the effects. */ void readFromNBT(final CompoundNBT compound, final IResearchEffectManager effects); } diff --git a/src/api/java/com/minecolonies/api/research/IResearchManager.java b/src/api/java/com/minecolonies/api/research/IResearchManager.java old mode 100644 new mode 100755 index badd17fbc9f..c44b0eb068a --- a/src/api/java/com/minecolonies/api/research/IResearchManager.java +++ b/src/api/java/com/minecolonies/api/research/IResearchManager.java @@ -11,24 +11,28 @@ public interface IResearchManager { /** * Reads all stats from nbt. + * * @param compound the compound. */ void readFromNBT(@NotNull final CompoundNBT compound); /** * Write all stats to nbt. + * * @param statsCompound the compound. */ void writeToNBT(@NotNull final CompoundNBT statsCompound); /** * Get the instance of the researchTree. + * * @return the ResearchTree object. */ ILocalResearchTree getResearchTree(); /** * Get an instance of the research effects. + * * @return the ResearchEffects object. */ IResearchEffectManager getResearchEffects(); diff --git a/src/api/java/com/minecolonies/api/research/IResearchRequirement.java b/src/api/java/com/minecolonies/api/research/IResearchRequirement.java old mode 100644 new mode 100755 index f840ffb4e59..03138889722 --- a/src/api/java/com/minecolonies/api/research/IResearchRequirement.java +++ b/src/api/java/com/minecolonies/api/research/IResearchRequirement.java @@ -10,6 +10,7 @@ public interface IResearchRequirement { /** * Check if this requirement is fulfilled for a certain colony. + * * @param colony the colony to check. * @return true if so. */ @@ -17,6 +18,7 @@ public interface IResearchRequirement /** * Get a description of the requirement. + * * @return translation text component. */ TranslationTextComponent getDesc(); diff --git a/src/api/java/com/minecolonies/api/research/effects/AbstractResearchEffect.java b/src/api/java/com/minecolonies/api/research/effects/AbstractResearchEffect.java old mode 100644 new mode 100755 index a63f2cbd0ca..2b398171475 --- a/src/api/java/com/minecolonies/api/research/effects/AbstractResearchEffect.java +++ b/src/api/java/com/minecolonies/api/research/effects/AbstractResearchEffect.java @@ -12,6 +12,7 @@ public abstract class AbstractResearchEffect implements IResearchEffect /** * The constructor to create a new research effect. + * * @param id the id to unlock. */ public AbstractResearchEffect(final String id) diff --git a/src/api/java/com/minecolonies/api/research/effects/IResearchEffect.java b/src/api/java/com/minecolonies/api/research/effects/IResearchEffect.java old mode 100644 new mode 100755 index 11d2a4c9715..9db71d6ed42 --- a/src/api/java/com/minecolonies/api/research/effects/IResearchEffect.java +++ b/src/api/java/com/minecolonies/api/research/effects/IResearchEffect.java @@ -5,36 +5,42 @@ /** * The effect of a research. + * * @param the type of the value. */ public interface IResearchEffect { /** * Get the effect of the research. + * * @return the effect. */ T getEffect(); /** * Set the research effect. + * * @param effect the value to set it to. */ void setEffect(T effect); /** * Getter for the ID of the effect. + * * @return the String id. */ String getId(); /** * Effect description. + * * @return the desc. */ TranslationTextComponent getDesc(); /** * Does this effect override another effect with the same id? + * * @param other the effect to check. * @return true if so. */ diff --git a/src/api/java/com/minecolonies/api/research/effects/IResearchEffectManager.java b/src/api/java/com/minecolonies/api/research/effects/IResearchEffectManager.java old mode 100644 new mode 100755 index 2726ffee3f7..74c88405459 --- a/src/api/java/com/minecolonies/api/research/effects/IResearchEffectManager.java +++ b/src/api/java/com/minecolonies/api/research/effects/IResearchEffectManager.java @@ -9,15 +9,17 @@ public interface IResearchEffectManager { /** * Get the research effect which is assigned to a particular string. - * @param id the id of the effect. + * + * @param id the id of the effect. * @param type it's type. - * @param the Generic type. + * @param the Generic type. * @return one of the expected type or null. */ > W getEffect(final String id, @NotNull final Class type); /** * Apply the effect to the research effects class. + * * @param effect the effect to apply. */ void applyEffect(final IResearchEffect effect); diff --git a/src/api/java/com/minecolonies/api/research/factories/IGlobalResearchFactory.java b/src/api/java/com/minecolonies/api/research/factories/IGlobalResearchFactory.java old mode 100644 new mode 100755 index d4dbf9f3ac8..5fc2357c5c4 --- a/src/api/java/com/minecolonies/api/research/factories/IGlobalResearchFactory.java +++ b/src/api/java/com/minecolonies/api/research/factories/IGlobalResearchFactory.java @@ -20,35 +20,35 @@ default IGlobalResearch getNewInstance(@NotNull final IFactoryController factory { if (context.length < PARAMS_GLOBAL_RESEARCH) { - throw new IllegalArgumentException("Unsupported context - Not correct number of parameters. Only " + PARAMS_GLOBAL_RESEARCH + " are allowed!"); + throw new IllegalArgumentException("Unsupported context - Not correct number of parameters. Only " + PARAMS_GLOBAL_RESEARCH + " are allowed!"); } - if(!(context[0] instanceof String)) + if (!(context[0] instanceof String)) { throw new IllegalArgumentException("First parameter is supposed to be the String ID!"); } - if(!(context[1] instanceof String)) + if (!(context[1] instanceof String)) { throw new IllegalArgumentException("Second parameter is supposed to be the IResearch parent!"); } - if(!(context[2] instanceof String)) + if (!(context[2] instanceof String)) { throw new IllegalArgumentException("Third parameter is supposed to be the Branch (String)!"); } - if(!(context[3] instanceof String)) + if (!(context[3] instanceof String)) { throw new IllegalArgumentException("Fourth parameter is supposed to be the Desc (String)!"); } - if(!(context[4] instanceof Integer)) + if (!(context[4] instanceof Integer)) { throw new IllegalArgumentException("Fifth parameter is supposed to be the Depth (int)!"); } - if(!(context[5] instanceof IResearchEffect)) + if (!(context[5] instanceof IResearchEffect)) { throw new IllegalArgumentException("Last parameter is supposed to be the IResearchEffect!"); } @@ -65,11 +65,11 @@ default IGlobalResearch getNewInstance(@NotNull final IFactoryController factory /** * Method to get a new Instance of a Research. * - * @param id the id. + * @param id the id. * @param parent the parent. * @param branch the branch. - * @param desc the description. - * @param depth the depth. + * @param desc the description. + * @param depth the depth. * @param effect the effect. * @return a new Instance of Research. */ diff --git a/src/api/java/com/minecolonies/api/research/factories/ILocalResearchFactory.java b/src/api/java/com/minecolonies/api/research/factories/ILocalResearchFactory.java old mode 100644 new mode 100755 index 20d8f5fa6fd..6af92adf404 --- a/src/api/java/com/minecolonies/api/research/factories/ILocalResearchFactory.java +++ b/src/api/java/com/minecolonies/api/research/factories/ILocalResearchFactory.java @@ -22,17 +22,17 @@ default ILocalResearch getNewInstance(@NotNull final IFactoryController factoryC throw new IllegalArgumentException("Unsupported context - Not correct number of parameters. Only " + PARAMS_LOCAL_RESEARCH + " are allowed!"); } - if(!(context[0] instanceof String)) + if (!(context[0] instanceof String)) { throw new IllegalArgumentException("First parameter is supposed to be the String ID!"); } - if(!(context[2] instanceof String)) + if (!(context[2] instanceof String)) { throw new IllegalArgumentException("Third parameter is supposed to be the Branch (String)!"); } - if(!(context[4] instanceof Integer)) + if (!(context[4] instanceof Integer)) { throw new IllegalArgumentException("Fifth parameter is supposed to be the Depth (int)!"); } @@ -46,9 +46,9 @@ default ILocalResearch getNewInstance(@NotNull final IFactoryController factoryC /** * Method to get a new Instance of a Research. * - * @param id the id. + * @param id the id. * @param branch the branch. - * @param depth the depth. + * @param depth the depth. * @return a new Instance of Research. */ @NotNull diff --git a/src/api/java/com/minecolonies/api/research/factories/IResearchEffectFactory.java b/src/api/java/com/minecolonies/api/research/factories/IResearchEffectFactory.java old mode 100644 new mode 100755 index 52976aaca05..08d1ab250c2 --- a/src/api/java/com/minecolonies/api/research/factories/IResearchEffectFactory.java +++ b/src/api/java/com/minecolonies/api/research/factories/IResearchEffectFactory.java @@ -22,12 +22,12 @@ default T getNewInstance(@NotNull final IFactoryController factoryController, @N throw new IllegalArgumentException("Unsupported context - Not correct number of parameters. Only 2 are allowed!"); } - if(!(context[0] instanceof String)) + if (!(context[0] instanceof String)) { throw new IllegalArgumentException("First parameter is supposed to be an ItemStack!"); } - if(context[1] == null) + if (context[1] == null) { throw new IllegalArgumentException("Second parameter is supposed to be an Object!"); } @@ -39,7 +39,8 @@ default T getNewInstance(@NotNull final IFactoryController factoryController, @N /** * Method to get a new Instance of a ResearchEffect. - * @param id the input. + * + * @param id the input. * @param obj the grid size. * @return a new Instance of ResearchEffect. */ diff --git a/src/api/java/com/minecolonies/api/research/factories/package-info.java b/src/api/java/com/minecolonies/api/research/factories/package-info.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/research/package-info.java b/src/api/java/com/minecolonies/api/research/package-info.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/research/util/ResearchConstants.java b/src/api/java/com/minecolonies/api/research/util/ResearchConstants.java old mode 100644 new mode 100755 index c03c6ee2ca9..c7c3baef11d --- a/src/api/java/com/minecolonies/api/research/util/ResearchConstants.java +++ b/src/api/java/com/minecolonies/api/research/util/ResearchConstants.java @@ -18,47 +18,47 @@ public final class ResearchConstants /** * Constants to write the research to NBT. */ - public static final String TAG_PARENT = "parent"; - public static final String TAG_STATE = "state"; - public static final String TAG_ID = "id"; - public static final String TAG_BRANCH = "branch"; - public static final String TAG_DESC = "desc"; - public static final String TAG_EFFECT = "effect"; - public static final String TAG_DEPTH = "depth"; - public static final String TAG_PROGRESS = "progress"; - public static final String TAG_CHILDS = "hasResearchedChild"; + public static final String TAG_PARENT = "parent"; + public static final String TAG_STATE = "state"; + public static final String TAG_ID = "id"; + public static final String TAG_BRANCH = "branch"; + public static final String TAG_DESC = "desc"; + public static final String TAG_EFFECT = "effect"; + public static final String TAG_DEPTH = "depth"; + public static final String TAG_PROGRESS = "progress"; + public static final String TAG_CHILDS = "hasResearchedChild"; public static final String TAG_ONLY_CHILD = "onlyChild"; public static final String TAG_RESEARCH_CHILD = "child"; /** * Research constants for window. */ - public static final String DRAG_VIEW_ID = "dragView"; - public static final int GRADIENT_WIDTH = 175; - public static final int X_SPACING = 40; - public static final int GRADIENT_HEIGHT = 50; - public static final int Y_SPACING = 20; - public static final int COST_OFFSET = 20; - public static final int TIMELABEL_Y_POSITION = 10; - public static final int MAX_DEPTH = 6; - public static final int INITIAL_X_OFFSET = 10; - public static final int NAME_OFFSET = 50; - public static final int INITIAL_Y_OFFSET = 10; - public static final int TEXT_X_OFFSET = 5; - public static final int XPBAR_Y_OFFSET = 30; - public static final int XPBAR_LENGTH = 90; - public static final int TEXT_Y_OFFSET = 10; - public static final int DEFAULT_COST_SIZE = 16; - public static final int LOCK_WIDTH = 15; - public static final int LOCK_HEIGHT = 17; - public static final int OR_X_OFFSET = 14; - public static final int OR_Y_OFFSET = 10; + public static final String DRAG_VIEW_ID = "dragView"; + public static final int GRADIENT_WIDTH = 175; + public static final int X_SPACING = 40; + public static final int GRADIENT_HEIGHT = 50; + public static final int Y_SPACING = 20; + public static final int COST_OFFSET = 20; + public static final int TIMELABEL_Y_POSITION = 10; + public static final int MAX_DEPTH = 6; + public static final int INITIAL_X_OFFSET = 10; + public static final int NAME_OFFSET = 50; + public static final int INITIAL_Y_OFFSET = 10; + public static final int TEXT_X_OFFSET = 5; + public static final int XPBAR_Y_OFFSET = 30; + public static final int XPBAR_LENGTH = 90; + public static final int TEXT_Y_OFFSET = 10; + public static final int DEFAULT_COST_SIZE = 16; + public static final int LOCK_WIDTH = 15; + public static final int LOCK_HEIGHT = 17; + public static final int OR_X_OFFSET = 14; + public static final int OR_Y_OFFSET = 10; /** * Research effects. */ - public static final String ARCHER_ARMOR = "Archer Armour"; - public static final String MELEE_ARMOR = "Melee Armour"; + public static final String ARCHER_ARMOR = "Archer Armour"; + public static final String MELEE_ARMOR = "Melee Armour"; public static final String ARMOR_DURABILITY = "Armor Durability"; public static final String FLEEING_DAMAGE = "Fleeing Damage"; public static final String FLEEING_SPEED = "Fleeing Speed"; @@ -73,30 +73,30 @@ public final class ResearchConstants public static final String SLEEP_LESS = "Sleep Less"; public static final String TEACHING = "Teaching"; - public static final String GROWTH = "Growth"; - public static final String CAP = "Citizen-Cap"; - public static final String RAILS = "Rails"; - public static final String WALKING = "Walking"; + public static final String GROWTH = "Growth"; + public static final String CAP = "Citizen-Cap"; + public static final String RAILS = "Rails"; + public static final String WALKING = "Walking"; - public static final String HEALTH = "Health"; + public static final String HEALTH = "Health"; public static final String REGENERATION = "Regeneration"; - public static final String SATLIMIT = "Healing Saturation Limit"; - public static final String HAPPINESS = "Happiness"; - public static final String SATURATION = "Saturation"; + public static final String SATLIMIT = "Healing Saturation Limit"; + public static final String HAPPINESS = "Happiness"; + public static final String SATURATION = "Saturation"; - public static final String FARMING = "Farming"; + public static final String FARMING = "Farming"; public static final String BLOCK_BREAK_SPEED = "Block Break Speed"; - public static final String MINIMUM_STOCK = "Minimum Stock"; - public static final String RECIPES = "Recipes"; + public static final String MINIMUM_STOCK = "Minimum Stock"; + public static final String RECIPES = "Recipes"; public static final String BLOCK_PLACE_SPEED = "Block Place Speed"; - public static final String MORE_ORES = "More Ores"; - public static final String WORKING_IN_RAIN = "Working in Rain"; - public static final String TOOL_DURABILITY = "Tool Durability"; - public static final String INV_SLOTS = "Citizen Inv Slots"; + public static final String MORE_ORES = "More Ores"; + public static final String WORKING_IN_RAIN = "Working in Rain"; + public static final String TOOL_DURABILITY = "Tool Durability"; + public static final String INV_SLOTS = "Citizen Inv Slots"; - public static final String PLANT_2 = "Plant 2"; - public static final String CRUSHING_11 = "1:1 Crushing"; - public static final String FIRE_RES = "Miner Fire Res"; + public static final String PLANT_2 = "Plant 2"; + public static final String CRUSHING_11 = "1:1 Crushing"; + public static final String FIRE_RES = "Miner Fire Res"; /** * Private constructor to hide implicit public one. diff --git a/src/api/java/com/minecolonies/api/research/util/ResearchState.java b/src/api/java/com/minecolonies/api/research/util/ResearchState.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/sounds/BarbarianSounds.java b/src/api/java/com/minecolonies/api/sounds/BarbarianSounds.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/sounds/EventType.java b/src/api/java/com/minecolonies/api/sounds/EventType.java old mode 100644 new mode 100755 index d7ba13bce22..f3cf25caedb --- a/src/api/java/com/minecolonies/api/sounds/EventType.java +++ b/src/api/java/com/minecolonies/api/sounds/EventType.java @@ -29,6 +29,7 @@ public enum EventType /** * Create a sound event. + * * @param chance the chance for the sound to be played. */ EventType(final double chance) @@ -38,6 +39,7 @@ public enum EventType /** * Get the chance for the sound to play. + * * @return the chance. */ public double getChance() diff --git a/src/api/java/com/minecolonies/api/sounds/ModSoundEvents.java b/src/api/java/com/minecolonies/api/sounds/ModSoundEvents.java old mode 100644 new mode 100755 index 87e7b16d535..b7b9cb2b9ae --- a/src/api/java/com/minecolonies/api/sounds/ModSoundEvents.java +++ b/src/api/java/com/minecolonies/api/sounds/ModSoundEvents.java @@ -34,6 +34,7 @@ private ModSoundEvents() /** * Register the {@link SoundEvent}s. + * * @param registry the registry to register at. */ public static void registerSounds(final IForgeRegistry registry) diff --git a/src/api/java/com/minecolonies/api/sounds/RaidSounds.java b/src/api/java/com/minecolonies/api/sounds/RaidSounds.java old mode 100644 new mode 100755 index 09149fe8af6..16b6af9a369 --- a/src/api/java/com/minecolonies/api/sounds/RaidSounds.java +++ b/src/api/java/com/minecolonies/api/sounds/RaidSounds.java @@ -14,5 +14,4 @@ public class RaidSounds public static final SoundEvent DESERT_RAID_WARNING = ModSoundEvents.getSoundID("raid.desert.desert_raid_warning"); public static final SoundEvent DESERT_RAID = ModSoundEvents.getSoundID("raid.desert.desert_raid"); public static final SoundEvent AMAZON_RAID = ModSoundEvents.getSoundID("raid.amazon.amazon_raid"); - } diff --git a/src/api/java/com/minecolonies/api/sounds/TavernSounds.java b/src/api/java/com/minecolonies/api/sounds/TavernSounds.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/tileentities/AbstractScarescrowTileEntity.java b/src/api/java/com/minecolonies/api/tileentities/AbstractScarescrowTileEntity.java old mode 100644 new mode 100755 index caaf2df1bdc..67cf767ed20 --- a/src/api/java/com/minecolonies/api/tileentities/AbstractScarescrowTileEntity.java +++ b/src/api/java/com/minecolonies/api/tileentities/AbstractScarescrowTileEntity.java @@ -164,6 +164,7 @@ public AbstractScarescrowTileEntity() /** * Getter for the ownerId of the field. + * * @return the int id. */ public abstract int getOwnerId(); @@ -171,13 +172,14 @@ public AbstractScarescrowTileEntity() /** * Sets the owner of the field. * - * @param ownerId the name of the citizen. + * @param ownerId the name of the citizen. * @param tempColony the colony view. */ public abstract void setOwner(int ownerId, IColonyView tempColony); /** * Get the inventory of the scarecrow. + * * @return the IItemHandler. */ public abstract IItemHandler getInventory(); diff --git a/src/api/java/com/minecolonies/api/tileentities/AbstractTileEntityBarrel.java b/src/api/java/com/minecolonies/api/tileentities/AbstractTileEntityBarrel.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/tileentities/AbstractTileEntityColonyBuilding.java b/src/api/java/com/minecolonies/api/tileentities/AbstractTileEntityColonyBuilding.java old mode 100644 new mode 100755 index 3e3ede0bb06..9d7f6e2021b --- a/src/api/java/com/minecolonies/api/tileentities/AbstractTileEntityColonyBuilding.java +++ b/src/api/java/com/minecolonies/api/tileentities/AbstractTileEntityColonyBuilding.java @@ -45,10 +45,8 @@ public AbstractTileEntityColonyBuilding(final TileEntityType> positionedTags) tagPosMap = positionedTags; } - @Override public Tuple getCornerPositions() { diff --git a/src/api/java/com/minecolonies/api/tileentities/AbstractTileEntityRack.java b/src/api/java/com/minecolonies/api/tileentities/AbstractTileEntityRack.java old mode 100644 new mode 100755 index 412525b04b0..d03e2ea58fe --- a/src/api/java/com/minecolonies/api/tileentities/AbstractTileEntityRack.java +++ b/src/api/java/com/minecolonies/api/tileentities/AbstractTileEntityRack.java @@ -39,9 +39,7 @@ public abstract class AbstractTileEntityRack extends TileEntity implements IName protected boolean main = false; /** - * whether this rack is in a warehouse or not. - * defaults to not - * set by the warehouse building upon being built + * whether this rack is in a warehouse or not. defaults to not set by the warehouse building upon being built */ protected boolean inWarehouse = false; @@ -108,6 +106,7 @@ public ItemStack extractItem(final int slot, final int amount, final boolean sim /** * Update the warehouse if available with the updated stack. + * * @param stack the incoming stack. */ private void updateWarehouseIfAvailable(final ItemStack stack) @@ -116,7 +115,7 @@ private void updateWarehouseIfAvailable(final ItemStack stack) { if (inWarehouse || !buildingPos.equals(BlockPos.ZERO)) { - if ( IColonyManager.getInstance().isCoordinateInAnyColony(world, pos)) + if (IColonyManager.getInstance().isCoordinateInAnyColony(world, pos)) { final IColony colony = IColonyManager.getInstance().getClosestColony(world, pos); if (inWarehouse && colony != null && colony.getRequestManager() != null) @@ -153,6 +152,7 @@ else if (!buildingPos.equals(BlockPos.ZERO)) /** * Set the building pos it belongs to. + * * @param pos the pos of the building. */ public void setBuildingPos(final BlockPos pos) diff --git a/src/api/java/com/minecolonies/api/tileentities/AbstractTileEntityWareHouse.java b/src/api/java/com/minecolonies/api/tileentities/AbstractTileEntityWareHouse.java old mode 100644 new mode 100755 index 3ae7f47bb87..4f741d530e5 --- a/src/api/java/com/minecolonies/api/tileentities/AbstractTileEntityWareHouse.java +++ b/src/api/java/com/minecolonies/api/tileentities/AbstractTileEntityWareHouse.java @@ -21,8 +21,7 @@ public AbstractTileEntityWareHouse(final TileEntityType getMatchingItemStacksInWarehouse(@NotNull Predicate itemStackSelectionPredicate); /** - * Dump the inventory of a citizen into the warehouse. - * Go through all items and search the right chest to dump it in. + * Dump the inventory of a citizen into the warehouse. Go through all items and search the right chest to dump it in. * * @param inventoryCitizen the inventory of the citizen */ diff --git a/src/api/java/com/minecolonies/api/tileentities/MinecoloniesTileEntities.java b/src/api/java/com/minecolonies/api/tileentities/MinecoloniesTileEntities.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/tileentities/ScareCrowType.java b/src/api/java/com/minecolonies/api/tileentities/ScareCrowType.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/tileentities/ScarecrowFieldStage.java b/src/api/java/com/minecolonies/api/tileentities/ScarecrowFieldStage.java old mode 100644 new mode 100755 index 12c27d5e1f1..80cc827f026 --- a/src/api/java/com/minecolonies/api/tileentities/ScarecrowFieldStage.java +++ b/src/api/java/com/minecolonies/api/tileentities/ScarecrowFieldStage.java @@ -1,8 +1,7 @@ package com.minecolonies.api.tileentities; /** - * Describes the stage the field is in. - * Like if it has been hoed, planted or is empty. + * Describes the stage the field is in. Like if it has been hoed, planted or is empty. */ public enum ScarecrowFieldStage { diff --git a/src/api/java/com/minecolonies/api/tileentities/TileEntityColonyBuilding.java b/src/api/java/com/minecolonies/api/tileentities/TileEntityColonyBuilding.java old mode 100644 new mode 100755 index ca6cdcd29cd..7994cbb4f55 --- a/src/api/java/com/minecolonies/api/tileentities/TileEntityColonyBuilding.java +++ b/src/api/java/com/minecolonies/api/tileentities/TileEntityColonyBuilding.java @@ -106,6 +106,7 @@ public TileEntityColonyBuilding() /** * Alternative overriden constructor. + * * @param type the entity type. */ public TileEntityColonyBuilding(final TileEntityType type) @@ -457,7 +458,11 @@ public LazyOptional getCapability(@NotNull final Capability capability .map(world::getTileEntity) .collect(Collectors.toSet())); providers.removeIf(Objects::isNull); - building.getAdditionalCountainers().stream().map(world::getTileEntity).filter(entity -> entity instanceof TileEntityRack).forEach(entity -> ((TileEntityRack) entity).setBuildingPos(this.pos)); + building.getAdditionalCountainers() + .stream() + .map(world::getTileEntity) + .filter(entity -> entity instanceof TileEntityRack) + .forEach(entity -> ((TileEntityRack) entity).setBuildingPos(this.pos)); } final List handlers = providers.stream() diff --git a/src/api/java/com/minecolonies/api/tileentities/TileEntityEnchanter.java b/src/api/java/com/minecolonies/api/tileentities/TileEntityEnchanter.java old mode 100644 new mode 100755 index ed796bfb82d..076357ac218 --- a/src/api/java/com/minecolonies/api/tileentities/TileEntityEnchanter.java +++ b/src/api/java/com/minecolonies/api/tileentities/TileEntityEnchanter.java @@ -35,6 +35,7 @@ public TileEntityEnchanter() /** * Alternative overriden constructor. + * * @param type the entity type. */ public TileEntityEnchanter(final TileEntityType type) diff --git a/src/api/java/com/minecolonies/api/tileentities/TileEntityRack.java b/src/api/java/com/minecolonies/api/tileentities/TileEntityRack.java old mode 100644 new mode 100755 index 9264c1797ac..63647e7f2b5 --- a/src/api/java/com/minecolonies/api/tileentities/TileEntityRack.java +++ b/src/api/java/com/minecolonies/api/tileentities/TileEntityRack.java @@ -53,9 +53,7 @@ public class TileEntityRack extends AbstractTileEntityRack private final Map content = new HashMap<>(); /** - * Size multiplier of the inventory. - * 0 = default value. - * 1 = 1*9 additional slots, and so on. + * Size multiplier of the inventory. 0 = default value. 1 = 1*9 additional slots, and so on. */ private int size = 0; @@ -167,6 +165,7 @@ public boolean hasItemStack(@NotNull final Predicate itemStackSelecti /** * Gets the content of the Rack + * * @return the map of content. */ public Map getAllContent() {return content;} diff --git a/src/api/java/com/minecolonies/api/tileentities/TileEntityStash.java b/src/api/java/com/minecolonies/api/tileentities/TileEntityStash.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/util/BlockPosUtil.java b/src/api/java/com/minecolonies/api/util/BlockPosUtil.java old mode 100644 new mode 100755 index 09332f76b52..8af3551f115 --- a/src/api/java/com/minecolonies/api/util/BlockPosUtil.java +++ b/src/api/java/com/minecolonies/api/util/BlockPosUtil.java @@ -37,8 +37,7 @@ public final class BlockPosUtil { /** - * Max depth of the floor check to avoid endless void searching - * (Stackoverflow). + * Max depth of the floor check to avoid endless void searching (Stackoverflow). */ private static final int MAX_DEPTH = 50; @@ -157,8 +156,7 @@ public static void writeToListNBT(@NotNull final ListNBT tagList, @NotNull final * Reads a Chunk Coordinate from a tag list. * * @param tagList Tag list to read compound with chunk coordinate from. - * @param index Index in the tag list where the required chunk coordinate - * is. + * @param index Index in the tag list where the required chunk coordinate is. * @return Chunk coordinate read from the tag list. */ @NotNull @@ -214,8 +212,7 @@ public static String getString(@NotNull final BlockPos position) } /** - * this checks that you are not in liquid. Will check for all liquids, even - * those from other mods before TP + * this checks that you are not in liquid. Will check for all liquids, even those from other mods before TP * * @param sender uses the player to get the world * @param blockPos for the current block LOC @@ -230,8 +227,7 @@ public static boolean isPositionSafe(@NotNull final World sender, final BlockPos } /** - * this checks that you are not in the air or underground. - * If so it will look up and down for a good landing spot before TP. + * this checks that you are not in the air or underground. If so it will look up and down for a good landing spot before TP. * * @param blockPos for the current block LOC. * @param world the world to search in. @@ -387,8 +383,7 @@ public static TileEntity getTileEntity(@NotNull final World world, @NotNull fina } /** - * Returns a list of drops possible mining a specific block with specific - * fortune level. + * Returns a list of drops possible mining a specific block with specific fortune level. * * @param world World the block is in. * @param coords Coordinates of the block. @@ -472,8 +467,7 @@ public static boolean tryMoveLivingToXYZ(@NotNull final MobEntity living, @NotNu } /** - * Create a method for using a {@link BlockPos} when using {@link - * net.minecraft.util.math.BlockPos.Mutable#setPos(int, int, int)}. + * Create a method for using a {@link BlockPos} when using {@link net.minecraft.util.math.BlockPos.Mutable#setPos(int, int, int)}. * * @param pos {@link net.minecraft.util.math.BlockPos.Mutable}. * @param newPos The new position to set. diff --git a/src/api/java/com/minecolonies/api/util/BlockStateStorage.java b/src/api/java/com/minecolonies/api/util/BlockStateStorage.java old mode 100644 new mode 100755 index 97a67eef552..e5fb7a231aa --- a/src/api/java/com/minecolonies/api/util/BlockStateStorage.java +++ b/src/api/java/com/minecolonies/api/util/BlockStateStorage.java @@ -27,8 +27,7 @@ public class BlockStateStorage private int hashCode; /** - * True: states are compared ignoring the properties in the given propertyList. - * False: states are only compared within the properties on the propertyList. + * True: states are compared ignoring the properties in the given propertyList. False: states are only compared within the properties on the propertyList. */ private final boolean exclude; @@ -37,8 +36,7 @@ public class BlockStateStorage * * @param state The blockstate to store * @param compareProperties the list of properties to compare - * @param exclude True: states are compared ignoring the properties in the given list. - * False: states are only compared within the properties on the list. + * @param exclude True: states are compared ignoring the properties in the given list. False: states are only compared within the properties on the list. */ public BlockStateStorage(@NotNull final BlockState state, @NotNull final List> compareProperties, final boolean exclude) { diff --git a/src/api/java/com/minecolonies/api/util/BlockStateUtils.java b/src/api/java/com/minecolonies/api/util/BlockStateUtils.java old mode 100644 new mode 100755 index a8e34383ba6..f1204cb98be --- a/src/api/java/com/minecolonies/api/util/BlockStateUtils.java +++ b/src/api/java/com/minecolonies/api/util/BlockStateUtils.java @@ -15,8 +15,7 @@ public class BlockStateUtils { /** - * Hashmap which links a block class + property name to its IProperty object - * Used to shorten name searches + * Hashmap which links a block class + property name to its IProperty object Used to shorten name searches */ private static final Map> propertyBlockMap = new HashMap<>(); @@ -53,8 +52,7 @@ public static boolean stateEqualsStateByBlockAndProp(@NotNull final BlockState s } /** - * Compares two states by a property matching the given propertyName. - * Compared by the name of the Property-value, use when property is an enum without an actual value. + * Compares two states by a property matching the given propertyName. Compared by the name of the Property-value, use when property is an enum without an actual value. * * @param state1 First state to compare * @param state2 Second state to compare @@ -80,8 +78,7 @@ public static boolean stateEqualsStateInPropertyByName(@NotNull final BlockState } /** - * Get the property object of a state matching the given name - * Caches lookups in the propertyBlockMap hashmap + * Get the property object of a state matching the given name Caches lookups in the propertyBlockMap hashmap * * @param state Blockstate we're checking for a property * @param name name of the property to find @@ -135,7 +132,10 @@ public static IProperty getPropertyByName(@NotNull final Collection> boolean stateEqualsStateWithoutProp(@NotNull final BlockState state1, @NotNull final BlockState state2, @NotNull final IProperty prop) + public static > boolean stateEqualsStateWithoutProp( + @NotNull final BlockState state1, + @NotNull final BlockState state2, + @NotNull final IProperty prop) { if (!state1.getProperties().contains(prop) || !state2.getProperties().contains(prop)) { diff --git a/src/api/java/com/minecolonies/api/util/ChunkLoadStorage.java b/src/api/java/com/minecolonies/api/util/ChunkLoadStorage.java old mode 100644 new mode 100755 index 5787ed96d4f..0c0f7b1128f --- a/src/api/java/com/minecolonies/api/util/ChunkLoadStorage.java +++ b/src/api/java/com/minecolonies/api/util/ChunkLoadStorage.java @@ -219,8 +219,9 @@ public int hashCode() /** * Apply this ChunkLoadStorage to a capability. + * * @param chunk the chunk to apply it to. - * @param cap the capability to apply it to. + * @param cap the capability to apply it to. */ public void applyToCap(final IColonyTagCapability cap, final Chunk chunk) { @@ -294,7 +295,6 @@ public void merge(final ChunkLoadStorage newStorage) coloniesToAdd.clear(); coloniesToRemove.clear(); } - } else { diff --git a/src/api/java/com/minecolonies/api/util/CompatibilityUtils.java b/src/api/java/com/minecolonies/api/util/CompatibilityUtils.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/util/CraftingUtils.java b/src/api/java/com/minecolonies/api/util/CraftingUtils.java old mode 100644 new mode 100755 index bca85ff1d55..cc7a75d461a --- a/src/api/java/com/minecolonies/api/util/CraftingUtils.java +++ b/src/api/java/com/minecolonies/api/util/CraftingUtils.java @@ -18,17 +18,19 @@ private CraftingUtils() /** * Calculate the max time a recipe has to be executed. + * * @param outputStack the output stack. - * @param storage the storage. + * @param storage the storage. * @return the quantity. */ public static int calculateMaxCraftingCount(@NotNull final ItemStack outputStack, @NotNull final IRecipeStorage storage) { //Calculate the initial crafting count from the request and the storage output. - int craftingCount = (int)Math.ceil(Math.max(ItemStackUtils.getSize(outputStack), ItemStackUtils.getSize(storage.getPrimaryOutput())) / (double)ItemStackUtils.getSize(storage.getPrimaryOutput())); + int craftingCount = (int) Math.ceil( + Math.max(ItemStackUtils.getSize(outputStack), ItemStackUtils.getSize(storage.getPrimaryOutput())) / (double) ItemStackUtils.getSize(storage.getPrimaryOutput())); //Now check if we excede an ingredients max stack size. - for(final ItemStorage ingredientStorage : storage.getCleanedInput()) + for (final ItemStorage ingredientStorage : storage.getCleanedInput()) { final ItemStack ingredient = ingredientStorage.getItemStack(); //Calculate the input count for the ingredient. @@ -46,17 +48,18 @@ public static int calculateMaxCraftingCount(@NotNull final ItemStack outputStack /** * Calculate the max time a recipe has to be executed. - * @param count the count. + * + * @param count the count. * @param storage the storage. * @return the quantity. */ public static int calculateMaxCraftingCount(@NotNull final int count, @NotNull final IRecipeStorage storage) { //Calculate the initial crafting count from the request and the storage output. - int craftingCount = (int)Math.ceil(Math.max(count, ItemStackUtils.getSize(storage.getPrimaryOutput())) / (double)ItemStackUtils.getSize(storage.getPrimaryOutput())); + int craftingCount = (int) Math.ceil(Math.max(count, ItemStackUtils.getSize(storage.getPrimaryOutput())) / (double) ItemStackUtils.getSize(storage.getPrimaryOutput())); //Now check if we excede an ingredients max stack size. - for(final ItemStorage ingredientStorage : storage.getCleanedInput()) + for (final ItemStorage ingredientStorage : storage.getCleanedInput()) { final ItemStack ingredient = ingredientStorage.getItemStack(); //Calculate the input count for the ingredient. diff --git a/src/api/java/com/minecolonies/api/util/CreativeBuildingStructureHandler.java b/src/api/java/com/minecolonies/api/util/CreativeBuildingStructureHandler.java old mode 100644 new mode 100755 index 89e0d7564f2..88617f4fd80 --- a/src/api/java/com/minecolonies/api/util/CreativeBuildingStructureHandler.java +++ b/src/api/java/com/minecolonies/api/util/CreativeBuildingStructureHandler.java @@ -28,8 +28,7 @@ import java.util.List; /** - * Minecolonies specific creative structure handler. - * Main difference related to registering blocks to colonies. + * Minecolonies specific creative structure handler. Main difference related to registering blocks to colonies. */ public final class CreativeBuildingStructureHandler extends CreativeStructureHandler { @@ -40,10 +39,11 @@ public final class CreativeBuildingStructureHandler extends CreativeStructureHan /** * The minecolonies specific creative structure placer. - * @param world the world. - * @param pos the pos it is placed at. - * @param structureName the name of the structure. - * @param settings the placement settings. + * + * @param world the world. + * @param pos the pos it is placed at. + * @param structureName the name of the structure. + * @param settings the placement settings. * @param fancyPlacement if fancy or complete. */ public CreativeBuildingStructureHandler(final World world, final BlockPos pos, final String structureName, final PlacementSettings settings, final boolean fancyPlacement) @@ -99,22 +99,21 @@ public boolean shouldBlocksBeConsideredEqual(final BlockState state1, final Bloc public boolean isStackFree(@Nullable final ItemStack itemStack) { return itemStack == null - ||itemStack.isEmpty() + || itemStack.isEmpty() || itemStack.getItem().isIn(ItemTags.LEAVES) || itemStack.getItem() == new ItemStack(ModBlocks.blockDecorationPlaceholder, 1).getItem(); } /** - * Load a structure into this world - * and place it in the right position and rotation. + * Load a structure into this world and place it in the right position and rotation. * - * @param worldObj the world to load it in - * @param name the structures name - * @param pos coordinates - * @param rotation the rotation. - * @param mirror the mirror used. + * @param worldObj the world to load it in + * @param name the structures name + * @param pos coordinates + * @param rotation the rotation. + * @param mirror the mirror used. * @param fancyPlacement if fancy or complete. - * @param player the placing player. + * @param player the placing player. * @return the placed blueprint. */ public static Blueprint loadAndPlaceStructureWithRotation( diff --git a/src/api/java/com/minecolonies/api/util/DebugUtil.java b/src/api/java/com/minecolonies/api/util/DebugUtil.java old mode 100644 new mode 100755 index 2bfe56d2947..ec8b589af7d --- a/src/api/java/com/minecolonies/api/util/DebugUtil.java +++ b/src/api/java/com/minecolonies/api/util/DebugUtil.java @@ -17,6 +17,7 @@ private DebugUtil() /** * Called either in watchlist or debug condition to release the mouse automatically. + * * @return true always on call. */ public static boolean hasReleaseMouse() diff --git a/src/api/java/com/minecolonies/api/util/Disease.java b/src/api/java/com/minecolonies/api/util/Disease.java old mode 100644 new mode 100755 index c2ac1d7b662..7ee0934a20c --- a/src/api/java/com/minecolonies/api/util/Disease.java +++ b/src/api/java/com/minecolonies/api/util/Disease.java @@ -27,9 +27,10 @@ public class Disease /** * Create a disease. - * @param name the name of it. + * + * @param name the name of it. * @param rarity its rarity. - * @param cure the cure. + * @param cure the cure. */ public Disease(final String name, final int rarity, final List cure) { @@ -40,6 +41,7 @@ public Disease(final String name, final int rarity, final List cure) /** * Get the name of the disease. + * * @return the name. */ public String getName() @@ -49,6 +51,7 @@ public String getName() /** * Get the rarity modifier of the disease. + * * @return the rarity. */ public int getRarity() @@ -58,6 +61,7 @@ public int getRarity() /** * Get the cure list. + * * @return the cure. */ public List getCure() @@ -67,6 +71,7 @@ public List getCure() /** * The Cure String. + * * @return the cure string. */ public String getCureString() @@ -77,7 +82,7 @@ public String getCureString() cureString.append(cureStack.getDisplayName().getString()); cureString.append("+"); } - cureString.deleteCharAt(cureString.length()-1); + cureString.deleteCharAt(cureString.length() - 1); return cureString.toString(); } } diff --git a/src/api/java/com/minecolonies/api/util/EntityUtils.java b/src/api/java/com/minecolonies/api/util/EntityUtils.java old mode 100644 new mode 100755 index 785c3376618..31b1ffeb821 --- a/src/api/java/com/minecolonies/api/util/EntityUtils.java +++ b/src/api/java/com/minecolonies/api/util/EntityUtils.java @@ -49,8 +49,7 @@ private EntityUtils() } /** - * Checks if a player is a fakePlayer and tries to get the owning player if - * possible. + * Checks if a player is a fakePlayer and tries to get the owning player if possible. * * @param player the incoming player. * @param world the world. @@ -97,12 +96,10 @@ public static List getEntitiesFromID(@NotNull final World world, @NotNul } /** - * Returns the new rotation degree calculated from the current and intended - * rotation up to a max. + * Returns the new rotation degree calculated from the current and intended rotation up to a max. * * @param currentRotation the current rotation the citizen has. - * @param intendedRotation the wanted rotation he should have after applying - * this. + * @param intendedRotation the wanted rotation he should have after applying this. * @param maxIncrement the 'movement speed. * @return a rotation value he should move. */ @@ -147,8 +144,7 @@ public static boolean checkForFreeSpace(@NotNull final World world, @NotNull fin /** * Checks if a blockPos in a world is solid or liquid. *

- * Useful to find a suitable Place to stand. - * (avoid these blocks to find one) + * Useful to find a suitable Place to stand. (avoid these blocks to find one) * * @param world the world to look in * @param blockPos the blocks position @@ -185,9 +181,7 @@ public static BlockPos getSpawnPoint(final World world, final BlockPos nearPoint } /** - * Sets the movement of the entity to specific point. - * Returns true if direction is set, otherwise false. - * {@link #tryMoveLivingToXYZ(MobEntity, int, int, int, double)} + * Sets the movement of the entity to specific point. Returns true if direction is set, otherwise false. {@link #tryMoveLivingToXYZ(MobEntity, int, int, int, double)} * * @param living Entity to move * @param x x-coordinate @@ -201,8 +195,7 @@ public static boolean tryMoveLivingToXYZ(@NotNull final MobEntity living, final } /** - * Sets the movement of the entity to specific point. - * Returns true if direction is set, otherwise false. + * Sets the movement of the entity to specific point. Returns true if direction is set, otherwise false. * * @param living Entity to move * @param x x-coordinate @@ -233,8 +226,7 @@ public static boolean isLivingAtSiteWithMove(@NotNull final LivingEntity entity, } /** - * Checks if a entity is at his working site. - * If he isn't, sets it's path to the location. + * Checks if a entity is at his working site. If he isn't, sets it's path to the location. * * @param entity entity to check * @param x X-coordinate @@ -306,8 +298,7 @@ public static boolean isEntityAtPosition(final Entity entity, final World world, } /** - * Returns whether or not the entity is within a specific range of his - * working site. + * Returns whether or not the entity is within a specific range of his working site. * * @param entityLiving entity to check * @param x X-coordinate diff --git a/src/api/java/com/minecolonies/api/util/FireworkUtils.java b/src/api/java/com/minecolonies/api/util/FireworkUtils.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/util/InventoryFunctions.java b/src/api/java/com/minecolonies/api/util/InventoryFunctions.java old mode 100644 new mode 100755 index 72df213f6d4..a2553a1bf57 --- a/src/api/java/com/minecolonies/api/util/InventoryFunctions.java +++ b/src/api/java/com/minecolonies/api/util/InventoryFunctions.java @@ -9,9 +9,8 @@ import java.util.function.*; /** - * Java8 functional interfaces for {@link net.minecraft.inventory.IInventory} - * Most methods will be remapping of parameters to reduce duplication. - * Because of erasure clashes, not all combinations are supported. + * Java8 functional interfaces for {@link net.minecraft.inventory.IInventory} Most methods will be remapping of parameters to reduce duplication. Because of erasure clashes, not + * all combinations are supported. */ public final class InventoryFunctions { @@ -38,19 +37,17 @@ public static boolean matchFirstInProvider(final ICapabilityProvider provider, @ } /** - * Topmost function to actually loop over the provider. - * Will return if it found something. + * Topmost function to actually loop over the provider. Will return if it found something. * * @param provider the provider to loop over * @param tester the function to use for testing slots - * @param stopAfterFirst if it should stop executing after finding one stack - * that applies + * @param stopAfterFirst if it should stop executing after finding one stack that applies * @return true if it found a stack */ private static boolean matchInProvider( - @Nullable final ICapabilityProvider provider, - @NotNull final Function>> tester, - final boolean stopAfterFirst) + @Nullable final ICapabilityProvider provider, + @NotNull final Function>> tester, + final boolean stopAfterFirst) { if (provider == null) { @@ -105,9 +102,9 @@ private static boolean matchFirstInProvider( * @return true if it found a stack */ public static boolean matchFirstInProviderWithAction( - final ICapabilityProvider provider, - @NotNull final Predicate tester, - @NotNull final IMatchActionResult action) + final ICapabilityProvider provider, + @NotNull final Predicate tester, + @NotNull final IMatchActionResult action) { return matchInProvider( provider, @@ -132,9 +129,9 @@ public static boolean matchFirstInProviderWithAction( * @return true if it found a stack */ public static boolean matchFirstInHandlerWithAction( - @NotNull final IItemHandler itemHandler, - @NotNull final Predicate tester, - @NotNull final IMatchActionResultHandler action) + @NotNull final IItemHandler itemHandler, + @NotNull final Predicate tester, + @NotNull final IMatchActionResultHandler action) { return matchInHandler( itemHandler, @@ -152,13 +149,13 @@ public static boolean matchFirstInHandlerWithAction( /** * Will return if it found something in the handler. * - * @param handler the handler to check - * @param tester the function to use for testing slots + * @param handler the handler to check + * @param tester the function to use for testing slots * @return true if it found a stack */ private static boolean matchInHandler( - @Nullable final IItemHandler handler, - @NotNull final Function>> tester) + @Nullable final IItemHandler handler, + @NotNull final Function>> tester) { if (handler == null) { @@ -188,9 +185,9 @@ private static boolean matchInHandler( * @return true if it found a stack */ public static boolean matchFirstInProviderWithSimpleAction( - final ICapabilityProvider provider, - @NotNull final Predicate tester, - @NotNull final Consumer action) + final ICapabilityProvider provider, + @NotNull final Predicate tester, + @NotNull final Consumer action) { return matchInProvider( provider, @@ -207,8 +204,7 @@ public static boolean matchFirstInProviderWithSimpleAction( } /** - * Search for a stack in an Inventory matching the predicate. - * (IInventory, Integer) -> Boolean + * Search for a stack in an Inventory matching the predicate. (IInventory, Integer) -> Boolean * * @param inventory the inventory to search in * @param tester the function to use for testing slots @@ -220,8 +216,7 @@ public static boolean matchFirstInProvider(final ICapabilityProvider inventory, } /** - * Functional interface describing a Action that is executed ones a Match - * (the given ItemStack) is found in the given slot. + * Functional interface describing a Action that is executed ones a Match (the given ItemStack) is found in the given slot. */ @FunctionalInterface public interface IMatchActionResult extends ObjIntConsumer @@ -229,8 +224,7 @@ public interface IMatchActionResult extends ObjIntConsumer /** * Method executed when a match has been found. * - * @param provider The itemstack that matches the predicate for the - * search. + * @param provider The itemstack that matches the predicate for the search. * @param slotIndex The slotindex in which this itemstack was found. */ @Override diff --git a/src/api/java/com/minecolonies/api/util/InventoryUtils.java b/src/api/java/com/minecolonies/api/util/InventoryUtils.java old mode 100644 new mode 100755 index 2d05c60ccd8..2e581f6d6a9 --- a/src/api/java/com/minecolonies/api/util/InventoryUtils.java +++ b/src/api/java/com/minecolonies/api/util/InventoryUtils.java @@ -54,10 +54,8 @@ private InventoryUtils() } /** - * Filters a list of items, matches the stack using {@link - * #compareItems(ItemStack, Item)}, in an {@link IItemHandler}. Uses - * the MetaData and {@link #getItemFromBlock(Block)} as parameters for the - * Predicate. + * Filters a list of items, matches the stack using {@link #compareItems(ItemStack, Item)}, in an {@link IItemHandler}. Uses the MetaData and {@link #getItemFromBlock(Block)} + * as parameters for the Predicate. * * @param itemHandler Inventory to filter in * @param block Block to filter @@ -70,8 +68,7 @@ public static List filterItemHandler(@NotNull final IItemHandler item } /** - * Filters a list of items, that match the given predicate, in an {@link - * IItemHandler}. + * Filters a list of items, that match the given predicate, in an {@link IItemHandler}. * * @param itemHandler The IItemHandler to get items from. * @param itemStackSelectionPredicate The predicate to match the stack to. @@ -94,8 +91,7 @@ public static List filterItemHandler(@NotNull final IItemHandler item } /** - * Compares whether or not the item in an itemstack is equal to a given - * item. + * Compares whether or not the item in an itemstack is equal to a given item. * * @param itemStack ItemStack to check. * @param targetItem Item to check. @@ -118,13 +114,10 @@ public static Item getItemFromBlock(final Block block) } /** - * Filters a list of items, matches the stack using {@link - * #compareItems(ItemStack, Item)}, with targetItem and itemDamage as - * parameters, in an {@link IItemHandler}. + * Filters a list of items, matches the stack using {@link #compareItems(ItemStack, Item)}, with targetItem and itemDamage as parameters, in an {@link IItemHandler}. * * @param itemHandler Inventory to get items from * @param targetItem Item to look for - * @return List of item stacks with the given item in inventory */ @NotNull @@ -134,8 +127,7 @@ public static List filterItemHandler(@NotNull final IItemHandler item } /** - * Returns the index of the first occurrence of the block in the {@link - * IItemHandler}. + * Returns the index of the first occurrence of the block in the {@link IItemHandler}. * * @param itemHandler {@link IItemHandler} to check. * @param block Block to find. @@ -147,8 +139,7 @@ public static int findFirstSlotInItemHandlerWith(@NotNull final IItemHandler ite } /** - * Returns the index of the first occurrence of the Item with the given - * ItemDamage in the {@link IItemHandler}. + * Returns the index of the first occurrence of the Item with the given ItemDamage in the {@link IItemHandler}. * * @param itemHandler {@link IItemHandler} to check * @param targetItem Item to find. @@ -160,8 +151,7 @@ public static int findFirstSlotInItemHandlerWith(@NotNull final IItemHandler ite } /** - * Returns the index of the first occurrence of an ItemStack that matches - * the given predicate in the {@link IItemHandler}. + * Returns the index of the first occurrence of an ItemStack that matches the given predicate in the {@link IItemHandler}. * * @param itemHandler ItemHandler to check * @param itemStackSelectionPredicate The predicate to match. @@ -184,7 +174,8 @@ public static int findFirstSlotInItemHandlerWith(@NotNull final IItemHandler ite /** * Shrinks a specific stack in an item handler. - * @param itemHandler the handler.. + * + * @param itemHandler the handler.. * @param itemStackSelectionPredicate the predicate.. * @return true if successful. */ @@ -203,8 +194,7 @@ public static boolean shrinkItemCountInItemHandler(final IItemHandler itemHandle } /** - * Returns the indexes of all occurrences of an ItemStack that matches - * the given predicate in the {@link IItemHandler}. + * Returns the indexes of all occurrences of an ItemStack that matches the given predicate in the {@link IItemHandler}. * * @param itemHandler ItemHandler to check * @param itemStackSelectionPredicate The predicate to match. @@ -229,8 +219,7 @@ public static List findAllSlotsInItemHandlerWith(@NotNull final IItemHa * * @param itemHandler {@link IItemHandler} to scan. * @param block The block to count - * @return Amount of occurrences of stacks that match the given block and - * ItemDamage + * @return Amount of occurrences of stacks that match the given block and ItemDamage */ public static int getItemCountInItemHandler(@Nullable final IItemHandler itemHandler, @NotNull final Block block) { @@ -246,8 +235,7 @@ public static int getItemCountInItemHandler(@Nullable final IItemHandler itemHan * * @param itemHandler {@link IItemHandler} to scan. * @param targetItem Item to count - * @return Amount of occurrences of stacks that match the given item and - * ItemDamage + * @return Amount of occurrences of stacks that match the given item and ItemDamage */ public static int getItemCountInItemHandler(@Nullable final IItemHandler itemHandler, @NotNull final Item targetItem) { @@ -262,8 +250,7 @@ public static int getItemCountInItemHandler(@Nullable final IItemHandler itemHan * Returns the amount of occurrences in the {@link IItemHandler}. * * @param itemHandler {@link IItemHandler} to scan. - * @param itemStackSelectionPredicate The predicate used to select the - * stacks to count. + * @param itemStackSelectionPredicate The predicate used to select the stacks to count. * @return Amount of occurrences of stacks that match the given predicate. */ public static int getItemCountInItemHandler(@Nullable final IItemHandler itemHandler, @NotNull final Predicate itemStackSelectionPredicate) @@ -284,12 +271,10 @@ public static int getItemCountInItemHandlers(@Nullable final Collection itemStackSelectionPredicate) @@ -334,7 +315,7 @@ public static boolean hasItemInItemHandler(@Nullable final IItemHandler itemHand { Log.getLogger().error("This is not supposed to happen, please notify the developers!", new Exception("hasItemInItemHandler got a null itemHandler")); } - return itemHandler != null && findFirstSlotInItemHandlerNotEmptyWith(itemHandler,itemStackSelectionPredicate) > -1; + return itemHandler != null && findFirstSlotInItemHandlerNotEmptyWith(itemHandler, itemStackSelectionPredicate) > -1; } /** @@ -374,6 +355,7 @@ public static int getFirstOpenSlotFromItemHandler(@Nullable final IItemHandler i /** * Count all open slots in inventory. + * * @param itemHandler the inventory. * @return the amount of open slots. */ @@ -392,20 +374,16 @@ public static long openSlotCount(@Nullable final IItemHandler itemHandler) /** * Adapted from {@link net.minecraft.entity.player.PlayerInventory#addItemStackToInventory(ItemStack)}. * - * @param itemHandler {@link IItemHandler} to add itemstack - * to. + * @param itemHandler {@link IItemHandler} to add itemstack to. * @param itemStack ItemStack to add. - * @param itemStackToKeepPredicate The {@link Predicate} that determines - * which ItemStacks to keep in the - * inventory. Return false to replace. - * @return itemStack which has been replaced, null if none has been - * replaced. + * @param itemStackToKeepPredicate The {@link Predicate} that determines which ItemStacks to keep in the inventory. Return false to replace. + * @return itemStack which has been replaced, null if none has been replaced. */ @Nullable public static ItemStack forceItemStackToItemHandler( - @NotNull final IItemHandler itemHandler, - @NotNull final ItemStack itemStack, - @NotNull final Predicate itemStackToKeepPredicate) + @NotNull final IItemHandler itemHandler, + @NotNull final ItemStack itemStack, + @NotNull final Predicate itemStackToKeepPredicate) { final ItemStack standardInsertionResult = addItemStackToItemHandlerWithResult(itemHandler, itemStack); @@ -436,8 +414,7 @@ public static ItemStack forceItemStackToItemHandler( } /** - * Returns the amount of item stacks in an inventory. This equals {@link - * #getItemHandlerAsList(IItemHandler)}.length();. + * Returns the amount of item stacks in an inventory. This equals {@link #getItemHandlerAsList(IItemHandler)}.length();. * * @param itemHandler {@link IItemHandler} to count item stacks of. * @return Amount of item stacks in the {@link IItemHandler}. @@ -460,10 +437,8 @@ public static List getItemHandlerAsList(@NotNull final IItemHandler i } /** - * Filters a list of items, matches the stack using {@link - * #compareItems(ItemStack, Item)}, in an {@link ICapabilityProvider}. - * Uses the MetaData and {@link #getItemFromBlock(Block)} as parameters for - * the Predicate. + * Filters a list of items, matches the stack using {@link #compareItems(ItemStack, Item)}, in an {@link ICapabilityProvider}. Uses the MetaData and {@link + * #getItemFromBlock(Block)} as parameters for the Predicate. * * @param provider Provider to filter in * @param block Block to filter @@ -476,11 +451,9 @@ public static List filterProvider(@NotNull final ICapabilityProvider } /** - * Filters a list of items, that match the given predicate, in an {@link - * ICapabilityProvider}. + * Filters a list of items, that match the given predicate, in an {@link ICapabilityProvider}. * - * @param provider The ICapabilityProvider to get items - * from. + * @param provider The ICapabilityProvider to get items from. * @param itemStackSelectionPredicate The predicate to match the stack to. * @return List of item stacks that match the given predicate. */ @@ -491,15 +464,11 @@ public static List filterProvider(@NotNull final ICapabilityProvider } /** - * Method to process the given predicate for all {@link Direction} of a - * {@link ICapabilityProvider}, including the internal one (passing null as - * argument). + * Method to process the given predicate for all {@link Direction} of a {@link ICapabilityProvider}, including the internal one (passing null as argument). * * @param provider The provider to process all the - * @param predicate The predicate to match the ItemStacks in the {@link - * IItemHandler} for each side with. - * @return A combined {@link List}<{@link ItemStack}> as if the given predicate was - * called on all ItemStacks in all {@link IItemHandler}s of the given provider. + * @param predicate The predicate to match the ItemStacks in the {@link IItemHandler} for each side with. + * @return A combined {@link List}<{@link ItemStack}> as if the given predicate was called on all ItemStacks in all {@link IItemHandler}s of the given provider. */ @NotNull private static List getFromProviderForAllSides(@NotNull final ICapabilityProvider provider, @NotNull final Predicate predicate) @@ -508,7 +477,7 @@ private static List getFromProviderForAllSides(@NotNull final ICapabi for (final IItemHandler handler : getItemHandlersFromProvider(provider)) { - if(handler != null) + if (handler != null) { combinedList.addAll(filterItemHandler(handler, predicate)); } @@ -526,10 +495,10 @@ private static List getFromProviderForAllSides(@NotNull final ICapabi public static Set getItemHandlersFromProvider(@NotNull final ICapabilityProvider provider) { final Set handlerList = Arrays.stream(Direction.values()) - .filter(facing -> provider.getCapability(ITEM_HANDLER_CAPABILITY, facing).isPresent()) - .map(facing -> provider.getCapability(ITEM_HANDLER_CAPABILITY, facing).orElse(null)) - .filter(Objects::nonNull) - .collect(Collectors.toSet()); + .filter(facing -> provider.getCapability(ITEM_HANDLER_CAPABILITY, facing).isPresent()) + .map(facing -> provider.getCapability(ITEM_HANDLER_CAPABILITY, facing).orElse(null)) + .filter(Objects::nonNull) + .collect(Collectors.toSet()); if (provider.getCapability(ITEM_HANDLER_CAPABILITY, null).isPresent()) @@ -546,9 +515,7 @@ public static Set getItemHandlersFromProvider(@NotNull final ICapa } /** - * Filters a list of items, matches the stack using {@link - * #compareItems(ItemStack, Item)}, with targetItem and itemDamage as - * parameters, in an {@link ICapabilityProvider}. + * Filters a list of items, matches the stack using {@link #compareItems(ItemStack, Item)}, with targetItem and itemDamage as parameters, in an {@link ICapabilityProvider}. * * @param provider Provider to get items from * @param targetItem Item to look for @@ -561,11 +528,10 @@ public static List filterProvider(@NotNull final ICapabilityProvider } /** - * Returns the index of the first occurrence of the block in the {@link - * ICapabilityProvider}. + * Returns the index of the first occurrence of the block in the {@link ICapabilityProvider}. * - * @param provider {@link ICapabilityProvider} to check. - * @param block Block to find. + * @param provider {@link ICapabilityProvider} to check. + * @param block Block to find. * @return Index of the first occurrence. */ public static int findFirstSlotInProviderWith(@NotNull final ICapabilityProvider provider, final Block block) @@ -574,8 +540,7 @@ public static int findFirstSlotInProviderWith(@NotNull final ICapabilityProvider } /** - * Returns the index of the first occurrence of the Item with the given - * ItemDamage in the {@link ICapabilityProvider}. + * Returns the index of the first occurrence of the Item with the given ItemDamage in the {@link ICapabilityProvider}. * * @param provider {@link ICapabilityProvider} to check * @param targetItem Item to find. @@ -587,8 +552,7 @@ public static int findFirstSlotInProviderWith(@NotNull final ICapabilityProvider } /** - * Returns a map with all itemhandlers and slots matching the predicate in the provider. - * the given predicate in the {@link ICapabilityProvider}. + * Returns a map with all itemhandlers and slots matching the predicate in the provider. the given predicate in the {@link ICapabilityProvider}. * * @param provider Provider to check * @param itemStackSelectionPredicate The predicate to match. @@ -610,8 +574,7 @@ public static Map> findAllSlotsInProviderWith(@NotNu } /** - * Returns the index of the first occurrence of an ItemStack that matches - * the given predicate in the {@link ICapabilityProvider}. + * Returns the index of the first occurrence of an ItemStack that matches the given predicate in the {@link ICapabilityProvider}. * * @param provider Provider to check * @param itemStackSelectionPredicate The predicate to match. @@ -632,8 +595,7 @@ public static int findFirstSlotInProviderNotEmptyWith(@NotNull final ICapability } /** - * Returns the index of the first occurrence of an ItemStack that matches - * the given predicate in the {@link ICapabilityProvider}. + * Returns the index of the first occurrence of an ItemStack that matches the given predicate in the {@link ICapabilityProvider}. * * @param provider Provider to check * @param itemStackSelectionPredicate The list of predicates to match. @@ -654,9 +616,7 @@ public static int findFirstSlotInProviderNotEmptyWith(@NotNull final ICapability } /** - * Returns the index of the first occurrence of an ItemStack that matches - * the given predicate in the {@link IItemHandler}. - * Also applies the not empty check. + * Returns the index of the first occurrence of an ItemStack that matches the given predicate in the {@link IItemHandler}. Also applies the not empty check. * * @param itemHandler ItemHandler to check * @param itemStackSelectionPredicate The list of predicates to match. @@ -679,9 +639,7 @@ private static int findFirstSlotInItemHandlerNotEmptyWith(final IItemHandler ite } /** - * Returns the index of the first occurrence of an ItemStack that matches - * the given predicate in the {@link IItemHandler}. - * Also applies the not empty check. + * Returns the index of the first occurrence of an ItemStack that matches the given predicate in the {@link IItemHandler}. Also applies the not empty check. * * @param itemHandler ItemHandler to check * @param itemStackSelectionPredicate The predicate to match. @@ -707,10 +665,9 @@ public static int findFirstSlotInItemHandlerNotEmptyWith(@NotNull final IItemHan /** * Returns the amount of occurrences in the {@link ICapabilityProvider}. * - * @param provider {@link ICapabilityProvider} to scan. - * @param block The block to count - * @return Amount of occurrences of stacks that match the given block and - * ItemDamage + * @param provider {@link ICapabilityProvider} to scan. + * @param block The block to count + * @return Amount of occurrences of stacks that match the given block and ItemDamage */ public static int getItemCountInProvider(@NotNull final ICapabilityProvider provider, @NotNull final Block block) { @@ -722,8 +679,7 @@ public static int getItemCountInProvider(@NotNull final ICapabilityProvider prov * * @param provider {@link ICapabilityProvider} to scan. * @param targetItem Item to count. - * @return Amount of occurrences of stacks that match the given item and - * ItemDamage + * @return Amount of occurrences of stacks that match the given item and ItemDamage */ public static int getItemCountInProvider(@NotNull final ICapabilityProvider provider, @NotNull final Item targetItem) { @@ -734,8 +690,7 @@ public static int getItemCountInProvider(@NotNull final ICapabilityProvider prov * Returns the amount of occurrences in the {@link ICapabilityProvider}. * * @param provider {@link ICapabilityProvider} to scan. - * @param itemStackSelectionPredicate The predicate used to select the - * stacks to count. + * @param itemStackSelectionPredicate The predicate used to select the stacks to count. * @return Amount of occurrences of stacks that match the given predicate. */ public static int getItemCountInProvider(@NotNull final ICapabilityProvider provider, @NotNull final Predicate itemStackSelectionPredicate) @@ -749,7 +704,7 @@ public static int getItemCountInProvider(@NotNull final ICapabilityProvider prov * Check if a building has more than a count in stack. Return the count it has if it has less. * * @param provider building to check in. - * @param stack the stack to check. + * @param stack the stack to check. * @return Amount of occurrences of stacks that match the given predicate. */ public static int hasBuildingEnoughElseCount(@NotNull final IBuilding provider, @NotNull final ItemStorage stack, final int count) @@ -767,7 +722,7 @@ public static int hasBuildingEnoughElseCount(@NotNull final IBuilding provider, final World world = provider.getColony().getWorld(); - for (final BlockPos pos: provider.getAdditionalCountainers()) + for (final BlockPos pos : provider.getAdditionalCountainers()) { if (world.getChunkProvider().isChunkLoaded(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4))) { @@ -784,7 +739,7 @@ public static int hasBuildingEnoughElseCount(@NotNull final IBuilding provider, return totalCount; } - for (final BlockPos pos: provider.getAdditionalCountainers()) + for (final BlockPos pos : provider.getAdditionalCountainers()) { if (world.getChunkProvider().isChunkLoaded(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4))) { @@ -807,11 +762,10 @@ public static int hasBuildingEnoughElseCount(@NotNull final IBuilding provider, } /** - * Checks if a player has a block in the {@link ICapabilityProvider}. - * Checked by {@link #getItemCountInProvider(ICapabilityProvider, Block)} > 0; + * Checks if a player has a block in the {@link ICapabilityProvider}. Checked by {@link #getItemCountInProvider(ICapabilityProvider, Block)} > 0; * - * @param Provider {@link ICapabilityProvider} to scan - * @param block Block to count + * @param Provider {@link ICapabilityProvider} to scan + * @param block Block to count * @return True when in {@link ICapabilityProvider}, otherwise false */ public static boolean hasItemInProvider(@NotNull final ICapabilityProvider Provider, @NotNull final Block block) @@ -820,11 +774,10 @@ public static boolean hasItemInProvider(@NotNull final ICapabilityProvider Provi } /** - * Checks if a player has an item in the {@link ICapabilityProvider}. - * Checked by {@link #getItemCountInProvider(ICapabilityProvider, Item)} > 0; + * Checks if a player has an item in the {@link ICapabilityProvider}. Checked by {@link #getItemCountInProvider(ICapabilityProvider, Item)} > 0; * - * @param Provider {@link ICapabilityProvider} to scan - * @param item Item to count + * @param Provider {@link ICapabilityProvider} to scan + * @param item Item to count * @return True when in {@link ICapabilityProvider}, otherwise false */ public static boolean hasItemInProvider(@NotNull final ICapabilityProvider Provider, @NotNull final Item item) @@ -833,13 +786,10 @@ public static boolean hasItemInProvider(@NotNull final ICapabilityProvider Provi } /** - * Checks if a player has an item in the {@link ICapabilityProvider}. - * Checked by {@link InventoryUtils#getItemCountInProvider(ICapabilityProvider, - * Predicate)} > 0; + * Checks if a player has an item in the {@link ICapabilityProvider}. Checked by {@link InventoryUtils#getItemCountInProvider(ICapabilityProvider, Predicate)} > 0; * * @param Provider {@link ICapabilityProvider} to scan - * @param itemStackSelectionPredicate The predicate to match the ItemStack - * to. + * @param itemStackSelectionPredicate The predicate to match the ItemStack to. * @return True when in {@link ICapabilityProvider}, otherwise false */ public static boolean hasItemInProvider(@NotNull final ICapabilityProvider Provider, @NotNull final Predicate itemStackSelectionPredicate) @@ -881,15 +831,13 @@ public static int getFirstOpenSlotFromProvider(@NotNull final ICapabilityProvide } /** - * Checks if the {@link ICapabilityProvider} contains the following toolName - * with the given minimal Level. + * Checks if the {@link ICapabilityProvider} contains the following toolName with the given minimal Level. * * @param provider The {@link ICapabilityProvider} to scan. * @param toolType The toolTypeName of the tool to find. * @param minimalLevel The minimal level to find. * @param maximumLevel The maximum level to find. - * @return True if a Tool with the given toolTypeName was found in the given - * {@link ICapabilityProvider}, false when not. + * @return True if a Tool with the given toolTypeName was found in the given {@link ICapabilityProvider}, false when not. */ public static boolean isToolInProvider(@NotNull final ICapabilityProvider provider, @NotNull final IToolType toolType, final int minimalLevel, final int maximumLevel) { @@ -1047,19 +995,16 @@ public static ItemStack addItemStackToItemHandlerWithResult(@NotNull final IItem /** * Adapted from {@link net.minecraft.entity.player.PlayerInventory#addItemStackToInventory(ItemStack)}. * - * @param provider {@link ICapabilityProvider} to add - * itemstack to. + * @param provider {@link ICapabilityProvider} to add itemstack to. * @param itemStack ItemStack to add. - * @param itemStackToKeepPredicate The {@link Predicate} that determines - * which ItemStacks to keep in the - * inventory. Return false to replace. + * @param itemStackToKeepPredicate The {@link Predicate} that determines which ItemStacks to keep in the inventory. Return false to replace. * @return itemStack which has been replaced. */ @Nullable public static ItemStack forceItemStackToProvider( - @NotNull final ICapabilityProvider provider, - @NotNull final ItemStack itemStack, - @NotNull final Predicate itemStackToKeepPredicate) + @NotNull final ICapabilityProvider provider, + @NotNull final ItemStack itemStack, + @NotNull final Predicate itemStackToKeepPredicate) { final ItemStack standardInsertionResult = addItemStackToProviderWithResult(provider, itemStack); @@ -1079,8 +1024,7 @@ public static ItemStack forceItemStackToProvider( } /** - * Returns the amount of item stacks in an inventory. This equals {@link - * #getProviderAsList(ICapabilityProvider)}.length();. + * Returns the amount of item stacks in an inventory. This equals {@link #getProviderAsList(ICapabilityProvider)}.length();. * * @param provider {@link ICapabilityProvider} to count item stacks of. * @return Amount of item stacks in the {@link ICapabilityProvider}. @@ -1103,12 +1047,10 @@ public static List getProviderAsList(@NotNull final ICapabilityProvid } /** - * Method used to check if a {@link ICapabilityProvider} has any {@link - * IItemHandler} + * Method used to check if a {@link ICapabilityProvider} has any {@link IItemHandler} * * @param provider The provider to check. - * @return True when the provider has any {@link IItemHandler}, false when - * not. + * @return True when the provider has any {@link IItemHandler}, false when not. */ @NotNull public static boolean hasProviderIItemHandler(@NotNull final ICapabilityProvider provider) @@ -1120,8 +1062,7 @@ public static boolean hasProviderIItemHandler(@NotNull final ICapabilityProvider * Method used to check if this provider is sided. * * @param provider The provider to check for. - * @return True when the provider has multiple distinct IItemHandler of - * different sides, false when not + * @return True when the provider has multiple distinct IItemHandler of different sides, false when not */ @NotNull public static boolean isProviderSided(@NotNull final ICapabilityProvider provider) @@ -1132,10 +1073,8 @@ public static boolean isProviderSided(@NotNull final ICapabilityProvider provide /** * Returns an {@link IItemHandler} as list of item stacks. * - * @param provider The {@link ICapabilityProvider} that holds the {@link - * IItemHandler} for the given {@link Direction} - * @param facing The facing to get the {@link IItemHandler} from. Can be - * null for the internal one + * @param provider The {@link ICapabilityProvider} that holds the {@link IItemHandler} for the given {@link Direction} + * @param facing The facing to get the {@link IItemHandler} from. Can be null for the internal one * @return List of item stacks. */ @NotNull @@ -1145,68 +1084,55 @@ public static List getInventoryAsListFromProviderForSide(@NotNull fin } /** - * Filters a list of items, matches the stack using {@link - * #compareItems(ItemStack, Item)}, in an {@link IItemHandler}. Uses - * the MetaData and {@link #getItemFromBlock(Block)} as parameters for the - * Predicate. + * Filters a list of items, matches the stack using {@link #compareItems(ItemStack, Item)}, in an {@link IItemHandler}. Uses the MetaData and {@link #getItemFromBlock(Block)} + * as parameters for the Predicate. * - * @param provider The {@link ICapabilityProvider} that holds the {@link - * IItemHandler} for the given {@link Direction} - * @param facing The facing to get the {@link IItemHandler} from. Can be - * null for the internal one + * @param provider The {@link ICapabilityProvider} that holds the {@link IItemHandler} for the given {@link Direction} + * @param facing The facing to get the {@link IItemHandler} from. Can be null for the internal one * @param block Block to filter * @return List of item stacks */ @NotNull public static List filterItemHandlerFromProviderForSide( - @NotNull final ICapabilityProvider provider, - @Nullable final Direction facing, - @NotNull final Block block) + @NotNull final ICapabilityProvider provider, + @Nullable final Direction facing, + @NotNull final Block block) { return filterItemHandler(provider.getCapability(ITEM_HANDLER_CAPABILITY, facing).orElse(null), (ItemStack stack) -> compareItems(stack, getItemFromBlock(block))); } /** - * Filters a list of items, matches the stack using {@link - * #compareItems(ItemStack, Item)}, with targetItem and itemDamage as - * parameters, in an {@link IItemHandler}. + * Filters a list of items, matches the stack using {@link #compareItems(ItemStack, Item)}, with targetItem and itemDamage as parameters, in an {@link IItemHandler}. * - * @param provider The {@link ICapabilityProvider} that holds the {@link - * IItemHandler} for the given {@link Direction} - * @param facing The facing to get the {@link IItemHandler} from. Can be - * null for the internal one + * @param provider The {@link ICapabilityProvider} that holds the {@link IItemHandler} for the given {@link Direction} + * @param facing The facing to get the {@link IItemHandler} from. Can be null for the internal one * @param targetItem Item to look for * @param itemDamage the damage value. * @return List of item stacks with the given item in inventory */ @NotNull public static List filterItemHandlerFromProviderForSide( - @NotNull final ICapabilityProvider provider, - @Nullable final Direction facing, - @NotNull final Item targetItem, - final int itemDamage) + @NotNull final ICapabilityProvider provider, + @Nullable final Direction facing, + @NotNull final Item targetItem, + final int itemDamage) { return filterItemHandler(provider.getCapability(ITEM_HANDLER_CAPABILITY, facing).orElse(null), (ItemStack stack) -> compareItems(stack, targetItem)); } /** - * Filters a list of items, that match the given predicate, in an {@link - * IItemHandler}. + * Filters a list of items, that match the given predicate, in an {@link IItemHandler}. * - * @param provider The {@link ICapabilityProvider} that - * holds the {@link IItemHandler} for the - * given {@link Direction} - * @param facing The facing to get the {@link - * IItemHandler} from. Can be null for - * the internal one + * @param provider The {@link ICapabilityProvider} that holds the {@link IItemHandler} for the given {@link Direction} + * @param facing The facing to get the {@link IItemHandler} from. Can be null for the internal one * @param itemStackSelectionPredicate The predicate to match the stack to. * @return List of item stacks that match the given predicate. */ @NotNull public static List filterItemHandlerFromProviderForSide( - @NotNull final ICapabilityProvider provider, - @Nullable final Direction facing, - @NotNull final Predicate itemStackSelectionPredicate) + @NotNull final ICapabilityProvider provider, + @Nullable final Direction facing, + @NotNull final Predicate itemStackSelectionPredicate) { if (!provider.getCapability(ITEM_HANDLER_CAPABILITY, facing).isPresent()) { @@ -1217,8 +1143,7 @@ public static List filterItemHandlerFromProviderForSide( } /** - * Returns the index of the first occurrence of the block in the {@link - * ICapabilityProvider} for a given {@link Direction}. + * Returns the index of the first occurrence of the block in the {@link ICapabilityProvider} for a given {@link Direction}. * * @param provider {@link ICapabilityProvider} to check. * @param facing The facing to check for. @@ -1227,18 +1152,16 @@ public static List filterItemHandlerFromProviderForSide( * @return Index of the first occurrence. */ public static int findFirstSlotInProviderForSideWith( - @NotNull final ICapabilityProvider provider, - @Nullable final Direction facing, - @NotNull final Block block, - final int itemDamage) + @NotNull final ICapabilityProvider provider, + @Nullable final Direction facing, + @NotNull final Block block, + final int itemDamage) { return findFirstSlotInProviderForSideWith(provider, facing, getItemFromBlock(block)); } /** - * Returns the index of the first occurrence of the Item with the given - * ItemDamage in the {@link ICapabilityProvider} for a given {@link - * Direction}. + * Returns the index of the first occurrence of the Item with the given ItemDamage in the {@link ICapabilityProvider} for a given {@link Direction}. * * @param provider {@link ICapabilityProvider} to check * @param facing The facing to check for. @@ -1246,17 +1169,15 @@ public static int findFirstSlotInProviderForSideWith( * @return Index of the first occurrence */ public static int findFirstSlotInProviderForSideWith( - @NotNull final ICapabilityProvider provider, - @Nullable final Direction facing, - @NotNull final Item targetItem) + @NotNull final ICapabilityProvider provider, + @Nullable final Direction facing, + @NotNull final Item targetItem) { return findFirstSlotInProviderForSideWith(provider, facing, (ItemStack stack) -> compareItems(stack, targetItem)); } /** - * Returns the index of the first occurrence of an ItemStack that matches - * the given predicate in the {@link ICapabilityProvider} for a given {@link - * Direction}. + * Returns the index of the first occurrence of an ItemStack that matches the given predicate in the {@link ICapabilityProvider} for a given {@link Direction}. * * @param provider Provider to check * @param facing The facing to check for. @@ -1264,9 +1185,9 @@ public static int findFirstSlotInProviderForSideWith( * @return Index of the first occurrence */ public static int findFirstSlotInProviderForSideWith( - @NotNull final ICapabilityProvider provider, - @Nullable final Direction facing, - @NotNull final Predicate itemStackSelectionPredicate) + @NotNull final ICapabilityProvider provider, + @Nullable final Direction facing, + @NotNull final Predicate itemStackSelectionPredicate) { if (!provider.getCapability(ITEM_HANDLER_CAPABILITY, facing).isPresent()) { @@ -1279,72 +1200,67 @@ public static int findFirstSlotInProviderForSideWith( } /** - * Returns the amount of occurrences in the {@link ICapabilityProvider} for - * a given {@link Direction}. + * Returns the amount of occurrences in the {@link ICapabilityProvider} for a given {@link Direction}. * - * @param provider {@link ICapabilityProvider} to scan. - * @param facing The facing to count in. - * @param block The block to count - * @return Amount of occurrences of stacks that match the given block and - * ItemDamage + * @param provider {@link ICapabilityProvider} to scan. + * @param facing The facing to count in. + * @param block The block to count + * @return Amount of occurrences of stacks that match the given block and ItemDamage */ public static int getItemCountInProviderForSide( - @NotNull final ICapabilityProvider provider, - @Nullable final Direction facing, - @NotNull final Block block) + @NotNull final ICapabilityProvider provider, + @Nullable final Direction facing, + @NotNull final Block block) { return getItemCountInProviderForSide(provider, facing, getItemFromBlock(block)); } /** - * Returns the amount of occurrences in the {@link ICapabilityProvider} for - * a given {@link Direction}. + * Returns the amount of occurrences in the {@link ICapabilityProvider} for a given {@link Direction}. * * @param provider {@link ICapabilityProvider} to scan. * @param facing The facing to count in. * @param targetItem Item to count - * @return Amount of occurrences of stacks that match the given item and - * ItemDamage + * @return Amount of occurrences of stacks that match the given item and ItemDamage */ public static int getItemCountInProviderForSide( - @NotNull final ICapabilityProvider provider, - @Nullable final Direction facing, - @NotNull final Item targetItem) + @NotNull final ICapabilityProvider provider, + @Nullable final Direction facing, + @NotNull final Item targetItem) { return getItemCountInProviderForSide(provider, facing, (ItemStack stack) -> compareItems(stack, targetItem)); } /** - * Returns the amount of occurrences in the {@link ICapabilityProvider} for - * a given {@link Direction}. + * Returns the amount of occurrences in the {@link ICapabilityProvider} for a given {@link Direction}. * * @param provider {@link ICapabilityProvider} to scan. * @param facing The facing to count in. - * @param itemStackSelectionPredicate The predicate used to select the - * stacks to count. + * @param itemStackSelectionPredicate The predicate used to select the stacks to count. * @return Amount of occurrences of stacks that match the given predicate. */ public static int getItemCountInProviderForSide( - @NotNull final ICapabilityProvider provider, - @Nullable final Direction facing, - @NotNull final Predicate itemStackSelectionPredicate) + @NotNull final ICapabilityProvider provider, + @Nullable final Direction facing, + @NotNull final Predicate itemStackSelectionPredicate) { if (!provider.getCapability(ITEM_HANDLER_CAPABILITY, facing).isPresent()) { return 0; } - return filterItemHandler(provider.getCapability(ITEM_HANDLER_CAPABILITY, facing).orElse(null), itemStackSelectionPredicate).stream().mapToInt(ItemStackUtils::getSize).sum(); + return filterItemHandler(provider.getCapability(ITEM_HANDLER_CAPABILITY, facing).orElse(null), itemStackSelectionPredicate).stream() + .mapToInt(ItemStackUtils::getSize) + .sum(); } /** - * Checks if a player has a block in the {@link ICapabilityProvider}, for a - * given {@link Direction}. Checked by {@link #getItemCountInProvider(ICapabilityProvider, - * Block)} > 0; + * Checks if a player has a block in the {@link ICapabilityProvider}, for a given {@link Direction}. Checked by {@link #getItemCountInProvider(ICapabilityProvider, Block)} > + * 0; * - * @param provider {@link ICapabilityProvider} to scan - * @param facing The side to check for. - * @param block Block to count + * @param provider {@link ICapabilityProvider} to scan + * @param facing The side to check for. + * @param block Block to count * @return True when in {@link ICapabilityProvider}, otherwise false */ public static boolean hasItemInProviderForSide(@NotNull final ICapabilityProvider provider, @Nullable final Direction facing, @NotNull final Block block) @@ -1353,13 +1269,12 @@ public static boolean hasItemInProviderForSide(@NotNull final ICapabilityProvide } /** - * Checks if a player has an item in the {@link ICapabilityProvider}, for a - * given {@link Direction}. Checked by {@link #getItemCountInProvider(ICapabilityProvider, - * Item)} > 0; + * Checks if a player has an item in the {@link ICapabilityProvider}, for a given {@link Direction}. Checked by {@link #getItemCountInProvider(ICapabilityProvider, Item)} > + * 0; * - * @param provider {@link ICapabilityProvider} to scan - * @param facing The side to check for. - * @param item Item to count + * @param provider {@link ICapabilityProvider} to scan + * @param facing The side to check for. + * @param item Item to count * @return True when in {@link ICapabilityProvider}, otherwise false */ public static boolean hasItemInProviderForSide(@NotNull final ICapabilityProvider provider, @Nullable final Direction facing, @NotNull final Item item) @@ -1368,20 +1283,18 @@ public static boolean hasItemInProviderForSide(@NotNull final ICapabilityProvide } /** - * Checks if a player has an item in the {@link ICapabilityProvider}, for a - * given {@link Direction}. Checked by {@link InventoryUtils#getItemCountInProvider(ICapabilityProvider, + * Checks if a player has an item in the {@link ICapabilityProvider}, for a given {@link Direction}. Checked by {@link InventoryUtils#getItemCountInProvider(ICapabilityProvider, * Predicate)} > 0; * * @param provider {@link ICapabilityProvider} to scan * @param facing The side to check for. - * @param itemStackSelectionPredicate The predicate to match the ItemStack - * to. + * @param itemStackSelectionPredicate The predicate to match the ItemStack to. * @return True when in {@link ICapabilityProvider}, otherwise false */ public static boolean hasItemInProviderForSide( - @NotNull final ICapabilityProvider provider, - @Nullable final Direction facing, - @NotNull final Predicate itemStackSelectionPredicate) + @NotNull final ICapabilityProvider provider, + @Nullable final Direction facing, + @NotNull final Predicate itemStackSelectionPredicate) { if (!provider.getCapability(ITEM_HANDLER_CAPABILITY, facing).isPresent()) { @@ -1392,8 +1305,7 @@ public static boolean hasItemInProviderForSide( } /** - * Returns if the {@link ICapabilityProvider} is full, for a given {@link - * Direction}. + * Returns if the {@link ICapabilityProvider} is full, for a given {@link Direction}. * * @param provider The {@link ICapabilityProvider}. * @param facing The side to check for. @@ -1405,8 +1317,7 @@ public static boolean isProviderFull(@NotNull final ICapabilityProvider provider } /** - * Returns the first open slot in the {@link ICapabilityProvider}, for a - * given {@link Direction}. + * Returns the first open slot in the {@link ICapabilityProvider}, for a given {@link Direction}. * * @param provider The {@link ICapabilityProvider} to check. * @param facing The side to check for. @@ -1423,20 +1334,18 @@ public static int getFirstOpenSlotFromProviderForSide(@NotNull final ICapability } /** - * Checks if the {@link ICapabilityProvider} contains the following toolName - * with the given minimal Level, for a given {@link Direction}. + * Checks if the {@link ICapabilityProvider} contains the following toolName with the given minimal Level, for a given {@link Direction}. * * @param provider The {@link ICapabilityProvider} to scan. * @param facing The side to check for. * @param toolType The tool type to find. * @param minimalLevel The minimal level to find. * @param maximumLevel The maximum level to find. - * @return True if a Tool with the given toolTypeName was found in the given - * {@link ICapabilityProvider}, false when not. + * @return True if a Tool with the given toolTypeName was found in the given {@link ICapabilityProvider}, false when not. */ public static boolean isToolInProviderForSide( - @NotNull final ICapabilityProvider provider, @Nullable final Direction facing, @NotNull final IToolType toolType, - final int minimalLevel, final int maximumLevel) + @NotNull final ICapabilityProvider provider, @Nullable final Direction facing, @NotNull final IToolType toolType, + final int minimalLevel, final int maximumLevel) { if (!provider.getCapability(ITEM_HANDLER_CAPABILITY, facing).isPresent()) { @@ -1447,15 +1356,13 @@ public static boolean isToolInProviderForSide( } /** - * Checks if the {@link IItemHandler} contains the following toolName with - * the given minimal Level. + * Checks if the {@link IItemHandler} contains the following toolName with the given minimal Level. * * @param itemHandler The {@link IItemHandler} to scan. * @param toolType The toolType of the tool to find. * @param minimalLevel The minimal level to find. * @param maximumLevel The maximum level to find. - * @return True if a Tool with the given toolTypeName was found in the given - * {@link IItemHandler}, false when not. + * @return True if a Tool with the given toolTypeName was found in the given {@link IItemHandler}, false when not. */ public static boolean isToolInItemHandler(@NotNull final IItemHandler itemHandler, @NotNull final IToolType toolType, final int minimalLevel, final int maximumLevel) { @@ -1477,8 +1384,7 @@ public static void clearItemHandler(@NotNull final IItemHandler itemHandler) } /** - * Returns a slot number if an {@link IItemHandler} contains given tool - * type. + * Returns a slot number if an {@link IItemHandler} contains given tool type. * * @param itemHandler the {@link IItemHandler} to get the slot from. * @param toolType the tool type to look for. @@ -1487,16 +1393,15 @@ public static void clearItemHandler(@NotNull final IItemHandler itemHandler) * @return slot number if found, -1 if not found. */ public static int getFirstSlotOfItemHandlerContainingTool( - @NotNull final IItemHandler itemHandler, @NotNull final IToolType toolType, final int minimalLevel, - final int maximumLevel) + @NotNull final IItemHandler itemHandler, @NotNull final IToolType toolType, final int minimalLevel, + final int maximumLevel) { return findFirstSlotInItemHandlerWith(itemHandler, (ItemStack stack) -> ItemStackUtils.hasToolLevel(stack, toolType, minimalLevel, maximumLevel)); } /** - * Verifies if there is one tool with an acceptable level - * in a worker's inventory. + * Verifies if there is one tool with an acceptable level in a worker's inventory. * * @param itemHandler the worker's inventory * @param toolType the type of tool needed @@ -1513,20 +1418,17 @@ public static boolean hasItemHandlerToolWithLevel(@NotNull final IItemHandler it } /** - * Method to swap the ItemStacks from the given source {@link IItemHandler} - * to the given target {@link ICapabilityProvider}. + * Method to swap the ItemStacks from the given source {@link IItemHandler} to the given target {@link ICapabilityProvider}. * * @param sourceHandler The {@link IItemHandler} that works as Source. - * @param sourceIndex The index of the slot that is being extracted - * from. - * @param targetProvider The {@link ICapabilityProvider} that works as - * Target. + * @param sourceIndex The index of the slot that is being extracted from. + * @param targetProvider The {@link ICapabilityProvider} that works as Target. * @return True when the swap was successful, false when not. */ public static boolean transferItemStackIntoNextFreeSlotInProvider( - @NotNull final IItemHandler sourceHandler, - @NotNull final int sourceIndex, - @NotNull final ICapabilityProvider targetProvider) + @NotNull final IItemHandler sourceHandler, + @NotNull final int sourceIndex, + @NotNull final ICapabilityProvider targetProvider) { for (final IItemHandler handler : getItemHandlersFromProvider(targetProvider)) { @@ -1540,8 +1442,7 @@ public static boolean transferItemStackIntoNextFreeSlotInProvider( } /** - * Method to swap the ItemStacks from the given source {@link IItemHandler} - * to the given target {@link IItemHandler}. + * Method to swap the ItemStacks from the given source {@link IItemHandler} to the given target {@link IItemHandler}. * * @param sourceHandler The {@link IItemHandler} that works as Source. * @param sourceIndex The index of the slot that is being extracted from. @@ -1549,13 +1450,13 @@ public static boolean transferItemStackIntoNextFreeSlotInProvider( * @return True when the swap was successful, false when not. */ public static boolean transferItemStackIntoNextFreeSlotInItemHandler( - @NotNull final IItemHandler sourceHandler, - final int sourceIndex, - @NotNull final IItemHandler targetHandler) + @NotNull final IItemHandler sourceHandler, + final int sourceIndex, + @NotNull final IItemHandler targetHandler) { ItemStack sourceStack = sourceHandler.extractItem(sourceIndex, Integer.MAX_VALUE, true); - if(ItemStackUtils.isEmpty(sourceStack)) + if (ItemStackUtils.isEmpty(sourceStack)) { return true; } @@ -1592,12 +1493,11 @@ public static boolean transferItemStackIntoNextFreeSlotInItemHandler( } /** - * Method to swap the ItemStacks from the given source {@link IItemHandler} - * to the given target {@link IItemHandler}. + * Method to swap the ItemStacks from the given source {@link IItemHandler} to the given target {@link IItemHandler}. * * @param sourceHandler The {@link IItemHandler} that works as Source. * @param sourceIndex The index of the slot that is being extracted from. - * @param count the quantity. + * @param count the quantity. * @param targetHandler The {@link IItemHandler} that works as Target. * @return True when the swap was successful, false when not. */ @@ -1609,7 +1509,7 @@ public static boolean transferXOfItemStackIntoNextFreeSlotInItemHandler( { ItemStack sourceStack = sourceHandler.extractItem(sourceIndex, count, true); - if(ItemStackUtils.isEmpty(sourceStack)) + if (ItemStackUtils.isEmpty(sourceStack)) { return true; } @@ -1646,8 +1546,7 @@ public static boolean transferXOfItemStackIntoNextFreeSlotInItemHandler( } /** - * Method to swap the ItemStacks from the given source {@link IItemHandler} - * to the given target {@link IItemHandler}. Trying to merge existing itemStacks if possible. + * Method to swap the ItemStacks from the given source {@link IItemHandler} to the given target {@link IItemHandler}. Trying to merge existing itemStacks if possible. * * @param sourceHandler The {@link IItemHandler} that works as Source. * @param sourceIndex The index of the slot that is being extracted from. @@ -1661,7 +1560,7 @@ public static boolean transferItemStackIntoNextBestSlotInItemHandler( { ItemStack sourceStack = sourceHandler.extractItem(sourceIndex, Integer.MAX_VALUE, true); - if(ItemStackUtils.isEmpty(sourceStack)) + if (ItemStackUtils.isEmpty(sourceStack)) { return true; } @@ -1677,7 +1576,7 @@ public static boolean transferItemStackIntoNextBestSlotInItemHandler( /** * Method to put a given Itemstack in a given target {@link IItemHandler}. Trying to merge existing itemStacks if possible. * - * @param stack the itemStack to transfer. + * @param stack the itemStack to transfer. * @param targetHandler The {@link IItemHandler} that works as Target. * @return True when the swap was successful, false when not. */ @@ -1689,7 +1588,7 @@ public static boolean transferItemStackIntoNextBestSlotInItemHandler(final ItemS /** * Method to put a given Itemstack in a given target {@link IItemHandler}. Trying to merge existing itemStacks if possible. * - * @param stack the itemStack to transfer. + * @param stack the itemStack to transfer. * @param targetHandler The {@link IItemHandler} that works as Target. * @return the rest of the stack. */ @@ -1697,14 +1596,14 @@ public static ItemStack transferItemStackIntoNextBestSlotInItemHandlerWithResult { ItemStack sourceStack = stack.copy(); - if(ItemStackUtils.isEmpty(sourceStack)) + if (ItemStackUtils.isEmpty(sourceStack)) { return sourceStack; } sourceStack = mergeItemStackIntoNextBestSlotInItemHandlers(sourceStack, targetHandler); - if(ItemStackUtils.isEmpty(sourceStack)) + if (ItemStackUtils.isEmpty(sourceStack)) { return sourceStack; } @@ -1722,8 +1621,8 @@ public static ItemStack transferItemStackIntoNextBestSlotInItemHandlerWithResult } /** - * Method to merge the ItemStacks from the given source {@link IItemHandler} - * to the given target {@link IItemHandler}. Trying to merge itemStacks or returning stack if not possible. + * Method to merge the ItemStacks from the given source {@link IItemHandler} to the given target {@link IItemHandler}. Trying to merge itemStacks or returning stack if not + * possible. * * @param sourceHandler The {@link IItemHandler} that works as Source. * @param sourceIndex The index of the slot that is being extracted from. @@ -1737,7 +1636,7 @@ public static void mergeItemStackIntoNextBestSlotInItemHandlers( ItemStack sourceStack = sourceHandler.extractItem(sourceIndex, Integer.MAX_VALUE, true); int amount = sourceStack.getCount(); - if(ItemStackUtils.isEmpty(sourceStack)) + if (ItemStackUtils.isEmpty(sourceStack)) { return; } @@ -1759,10 +1658,10 @@ public static void mergeItemStackIntoNextBestSlotInItemHandlers( } /** - * Method to merge the ItemStacks from the given source {@link IItemHandler} - * to the given target {@link IItemHandler}. Trying to merge itemStacks or returning stack if not possible. + * Method to merge the ItemStacks from the given source {@link IItemHandler} to the given target {@link IItemHandler}. Trying to merge itemStacks or returning stack if not + * possible. * - * @param stack the stack to add. + * @param stack the stack to add. * @param targetHandler The {@link IItemHandler} that works as Target. * @return True when the swap was successful, false when not. */ @@ -1772,7 +1671,7 @@ public static ItemStack mergeItemStackIntoNextBestSlotInItemHandlers( { ItemStack sourceStack = stack.copy(); - if(ItemStackUtils.isEmpty(sourceStack)) + if (ItemStackUtils.isEmpty(sourceStack)) { return sourceStack; } @@ -1806,7 +1705,7 @@ public static int transferXOfFirstSlotInProviderWithIntoNextFreeSlotInProviderWi { int currentAmount = amount; - for(final IItemHandler handler : getItemHandlersFromProvider(targetProvider)) + for (final IItemHandler handler : getItemHandlersFromProvider(targetProvider)) { currentAmount = transferXOfFirstSlotInProviderWithIntoNextFreeSlotInItemHandlerWithResult(sourceProvider, itemStackSelectionPredicate, amount, handler); @@ -1847,9 +1746,9 @@ public static int transferXOfFirstSlotInProviderWithIntoNextFreeSlotInItemHandle } public static boolean transferXOfFirstSlotInItemHandlerWithIntoNextFreeSlotInItemHandler( - @NotNull final IItemHandler sourceHandler, - @NotNull final Predicate itemStackSelectionPredicate, - @NotNull final int amount, @NotNull final IItemHandler targetHandler) + @NotNull final IItemHandler sourceHandler, + @NotNull final Predicate itemStackSelectionPredicate, + @NotNull final int amount, @NotNull final IItemHandler targetHandler) { return transferXOfFirstSlotInItemHandlerWithIntoNextFreeSlotInItemHandlerWithResult(sourceHandler, itemStackSelectionPredicate, amount, targetHandler) == 0; } @@ -1864,7 +1763,7 @@ public static int transferXOfFirstSlotInItemHandlerWithIntoNextFreeSlotInItemHan while (currentAmount > 0) { tries++; - if(tries > sourceHandler.getSlots()) + if (tries > sourceHandler.getSlots()) { break; } @@ -1900,17 +1799,18 @@ public static int transferXOfFirstSlotInItemHandlerWithIntoNextFreeSlotInItemHan /** * Takes an item matching a predicate and moves it form one handler to the other to a specific slot. - * @param sourceHandler the source handler. + * + * @param sourceHandler the source handler. * @param itemStackSelectionPredicate the predicate. - * @param amount the max amount to extract - * @param targetHandler the target. - * @param slot the slot to put it in. + * @param amount the max amount to extract + * @param targetHandler the target. + * @param slot the slot to put it in. */ public static void transferXOfFirstSlotInItemHandlerWithIntoInItemHandler( - final IItemHandler sourceHandler, - final Predicate itemStackSelectionPredicate, - final int amount, - final IItemHandler targetHandler, final int slot) + final IItemHandler sourceHandler, + final Predicate itemStackSelectionPredicate, + final int amount, + final IItemHandler targetHandler, final int slot) { final int desiredItemSlot = InventoryUtils.findFirstSlotInItemHandlerNotEmptyWith(sourceHandler, itemStackSelectionPredicate); @@ -1933,20 +1833,17 @@ public static void transferXOfFirstSlotInItemHandlerWithIntoInItemHandler( } /** - * Method to swap the ItemStacks from the given source {@link - * ICapabilityProvider} to the given target {@link IItemHandler}. + * Method to swap the ItemStacks from the given source {@link ICapabilityProvider} to the given target {@link IItemHandler}. * - * @param sourceProvider The {@link ICapabilityProvider} that works as - * Source. - * @param sourceIndex The index of the slot that is being extracted - * from. + * @param sourceProvider The {@link ICapabilityProvider} that works as Source. + * @param sourceIndex The index of the slot that is being extracted from. * @param targetHandler The {@link IItemHandler} that works as Target. * @return True when the swap was successful, false when not. */ public static boolean transferItemStackIntoNextFreeSlotFromProvider( - @NotNull final ICapabilityProvider sourceProvider, - @NotNull final int sourceIndex, - @NotNull final IItemHandler targetHandler) + @NotNull final ICapabilityProvider sourceProvider, + @NotNull final int sourceIndex, + @NotNull final IItemHandler targetHandler) { for (final IItemHandler handler : getItemHandlersFromProvider(sourceProvider)) { @@ -1960,21 +1857,18 @@ public static boolean transferItemStackIntoNextFreeSlotFromProvider( } /** - * Method to swap the ItemStacks from the given source {@link - * ICapabilityProvider} to the given target {@link IItemHandler}. + * Method to swap the ItemStacks from the given source {@link ICapabilityProvider} to the given target {@link IItemHandler}. * - * @param sourceProvider The {@link ICapabilityProvider} that works as - * Source. - * @param sourceIndex The index of the slot that is being extracted - * from. - * @param count the quantity. + * @param sourceProvider The {@link ICapabilityProvider} that works as Source. + * @param sourceIndex The index of the slot that is being extracted from. + * @param count the quantity. * @param targetHandler The {@link IItemHandler} that works as Target. * @return True when the swap was successful, false when not. */ public static boolean transferXOfItemStackIntoNextFreeSlotFromProvider( @NotNull final ICapabilityProvider sourceProvider, - final int sourceIndex, - final int count, + final int sourceIndex, + final int count, @NotNull final IItemHandler targetHandler) { for (final IItemHandler handler : getItemHandlersFromProvider(sourceProvider)) @@ -1989,13 +1883,10 @@ public static boolean transferXOfItemStackIntoNextFreeSlotFromProvider( } /** - * Method to swap the ItemStacks from the given source {@link - * ICapabilityProvider} to the given target {@link IItemHandler}. + * Method to swap the ItemStacks from the given source {@link ICapabilityProvider} to the given target {@link IItemHandler}. * - * @param sourceProvider The {@link ICapabilityProvider} that works as - * Source. - * @param sourceIndex The index of the slot that is being extracted - * from. + * @param sourceProvider The {@link ICapabilityProvider} that works as Source. + * @param sourceIndex The index of the slot that is being extracted from. * @param targetHandler The {@link IItemHandler} that works as Target. * @return True when the swap was successful, false when not. */ @@ -2006,7 +1897,7 @@ public static boolean transferItemStackIntoNextBestSlotFromProvider( { for (final IItemHandler handler : getItemHandlersFromProvider(sourceProvider)) { - if(transferItemStackIntoNextBestSlotInItemHandler(handler, sourceIndex, targetHandler)) + if (transferItemStackIntoNextBestSlotInItemHandler(handler, sourceIndex, targetHandler)) { return true; } @@ -2016,8 +1907,7 @@ public static boolean transferItemStackIntoNextBestSlotFromProvider( } /** - * Method to swap the ItemStacks from the given source {@link IItemHandler} - * to the given target {@link IItemHandler}. + * Method to swap the ItemStacks from the given source {@link IItemHandler} to the given target {@link IItemHandler}. * * @param sourceHandler The {@link IItemHandler} that works as Source. * @param sourceIndex The index of the slot that is being extracted from. @@ -2026,10 +1916,10 @@ public static boolean transferItemStackIntoNextBestSlotFromProvider( * @return True when the swap was successful, false when not. */ public static boolean swapItemStacksInItemHandlers( - @NotNull final IItemHandler sourceHandler, - @NotNull final int sourceIndex, - @NotNull final IItemHandler targetHandler, - @NotNull final int targetIndex) + @NotNull final IItemHandler sourceHandler, + @NotNull final int sourceIndex, + @NotNull final IItemHandler targetHandler, + @NotNull final int targetIndex) { final ItemStack targetStack = targetHandler.extractItem(targetIndex, Integer.MAX_VALUE, false); final ItemStack sourceStack = sourceHandler.extractItem(sourceIndex, Integer.MAX_VALUE, true); @@ -2120,8 +2010,7 @@ public static boolean removeStacksFromItemHandler(final IItemHandler handler, fi } /** - * Tries to remove a stack with its size from a given Itemhandler. - * Only removes sth if the whole size can be removed. + * Tries to remove a stack with its size from a given Itemhandler. Only removes sth if the whole size can be removed. * * @param handler the itemHandler. * @param input the stack to remove. @@ -2131,11 +2020,11 @@ public static boolean tryRemoveStackFromItemHandler(final IItemHandler handler, { int amount = input.getCount(); - for (int i = 0;i < handler.getSlots();i++) + for (int i = 0; i < handler.getSlots(); i++) { if (ItemStackUtils.compareItemStacksIgnoreStackSize(handler.getStackInSlot(i), input)) { - amount = amount - handler.extractItem(i,amount,false).getCount(); + amount = amount - handler.extractItem(i, amount, false).getCount(); if (amount == 0) { @@ -2146,7 +2035,7 @@ public static boolean tryRemoveStackFromItemHandler(final IItemHandler handler, final ItemStack revertStack = input.copy(); revertStack.setCount(input.getCount() - amount); - addItemStackToItemHandler(handler,revertStack); + addItemStackToItemHandler(handler, revertStack); return false; } @@ -2155,7 +2044,7 @@ public static boolean tryRemoveStackFromItemHandler(final IItemHandler handler, * * @param handler the itemHandler. * @param input the stack to remove. - * @param count the amount to remove. + * @param count the amount to remove. */ public static void removeStackFromItemHandler(final IItemHandler handler, final ItemStack input, final int count) { @@ -2187,9 +2076,9 @@ public static void removeStackFromItemHandler(final IItemHandler handler, final /** * Check if a certain item is in the provider but without the provider being full. * - * @param provider the provider to check. - * @param item the item. - * @param amount stack size to be considered. + * @param provider the provider to check. + * @param item the item. + * @param amount stack size to be considered. * @return the slot or -1. */ public static int findSlotInProviderNotFullWithItem(final ICapabilityProvider provider, final Item item, final int amount) @@ -2208,9 +2097,8 @@ public static int findSlotInProviderNotFullWithItem(final ICapabilityProvider pr } /** - * Check if a certain item is in the handler but without the provider being full. - * Return as soon as an empty slot and a matching slot has been found. - * Returns the last matching slot it found. + * Check if a certain item is in the handler but without the provider being full. Return as soon as an empty slot and a matching slot has been found. Returns the last matching + * slot it found. * * @param handler the handler to check. * @param itemStackSelectionPredicate the selection predicate.. @@ -2218,9 +2106,9 @@ public static int findSlotInProviderNotFullWithItem(final ICapabilityProvider pr * @return the slot or -1. */ public static int findSlotInItemHandlerNotFullWithItem( - final IItemHandler handler, - @NotNull final Predicate itemStackSelectionPredicate, - final int amount) + final IItemHandler handler, + @NotNull final Predicate itemStackSelectionPredicate, + final int amount) { boolean foundEmptySlot = false; boolean foundItem = false; @@ -2252,9 +2140,8 @@ else if (itemStackSelectionPredicate.test(stack)) } /** - * Check if a similar item is in the handler but without the provider being full. - * Return as soon as an empty slot and a matching slot has been found. - * Returns the last matching slot it found. + * Check if a similar item is in the handler but without the provider being full. Return as soon as an empty slot and a matching slot has been found. Returns the last matching + * slot it found. * * @param handler the handler to check. * @param inStack the ItemStack @@ -2268,7 +2155,7 @@ public static boolean findSlotInItemHandlerNotFullWithItem( { return false; } - + boolean foundEmptySlot = false; boolean foundItem = false; for (int slot = 0; slot < handler.getSlots(); slot++) @@ -2346,7 +2233,8 @@ public static void spawnItemStack(final World worldIn, final double x, final dou /** * Calculates howmany items match the given predicate that are in the list. - * @param stacks the stacks to count in. + * + * @param stacks the stacks to count in. * @param stackPredicate the condition to count for. * @return The sum of the itemstack sizes that match the predicate */ @@ -2356,36 +2244,36 @@ public static int getItemCountInStackLick(@NotNull final List stacks, } /** - * Checks if all stacks given in the list are in the itemhandler given - * - * @param stacks The stacks that should be in the itemhandler - * @param handler The itemhandler to check in - * @return True when all stacks are in the handler, false when not - */ + * Checks if all stacks given in the list are in the itemhandler given + * + * @param stacks The stacks that should be in the itemhandler + * @param handler The itemhandler to check in + * @return True when all stacks are in the handler, false when not + */ public static boolean areAllItemsInItemHandler(@NotNull final List stacks, @NotNull final IItemHandler handler) { return areAllItemsInItemHandlerList(stacks, ImmutableList.of(handler)); } - /** - * Checks if all stacks given in the list are in the capability provider given - * - * @param stacks The stacks that should be in the itemhandler - * @param provider The provider to check in - * @return True when all stacks are in the handler, false when not - */ + /** + * Checks if all stacks given in the list are in the capability provider given + * + * @param stacks The stacks that should be in the itemhandler + * @param provider The provider to check in + * @return True when all stacks are in the handler, false when not + */ public static boolean areAllItemsInProvider(@NotNull final List stacks, @NotNull final ICapabilityProvider provider) { return areAllItemsInItemHandlerList(stacks, getItemHandlersFromProvider(provider)); } /** - * Checks if all stacks given in the list are in at least one of the given the itemhandlers - * - * @param stacks The stacks that should be in the itemhandlers - * @param handlers The itemhandlers to check in - * @return True when all stacks are in at least one of the handlers, false when not - */ + * Checks if all stacks given in the list are in at least one of the given the itemhandlers + * + * @param stacks The stacks that should be in the itemhandlers + * @param handlers The itemhandlers to check in + * @return True when all stacks are in at least one of the handlers, false when not + */ public static boolean areAllItemsInItemHandlerList(@NotNull final List stacks, @NotNull final Collection handlers) { if (stacks.isEmpty()) @@ -2401,17 +2289,18 @@ public static boolean areAllItemsInItemHandlerList(@NotNull final List requiredCountForStacks = getMergedCountedStacksFromList(stacks); return requiredCountForStacks.keySet().stream().allMatch(itemStack -> { - final int countInHandlerList = handlers.stream().mapToInt(handler -> getItemCountInItemHandler(handler, itemStack1 -> ItemStackUtils.compareItemStacksIgnoreStackSize(itemStack, itemStack1))).sum(); + final int countInHandlerList = + handlers.stream().mapToInt(handler -> getItemCountInItemHandler(handler, itemStack1 -> ItemStackUtils.compareItemStacksIgnoreStackSize(itemStack, itemStack1))).sum(); return countInHandlerList >= requiredCountForStacks.get(itemStack); }); } - /** - * This method calculates the amount of items in itemstacks are contained within a list. - * - * @param stacks The stacks to count. - * @return A map with a entry for each unique unified itemstack and its count in the list. - */ + /** + * This method calculates the amount of items in itemstacks are contained within a list. + * + * @param stacks The stacks to count. + * @return A map with a entry for each unique unified itemstack and its count in the list. + */ public static Map getMergedCountedStacksFromList(@NotNull final List stacks) { final Map requiredCountForStacks = Maps.newHashMap(); @@ -2434,14 +2323,14 @@ public static Map getMergedCountedStacksFromList(@NotNull fi return requiredCountForStacks; } - - /** - * This method splits a map with an entry for each unique unified itemstack and its count - * into a list of itemstacks that represent the maps, taken the max stack size into account. - * - * @param mergedCountedStacks the map with the unique unified itemstacks and their counts. - * @return The list of itemstacks that represent the map, taken the max stack size into account. - */ + + /** + * This method splits a map with an entry for each unique unified itemstack and its count into a list of itemstacks that represent the maps, taken the max stack size into + * account. + * + * @param mergedCountedStacks the map with the unique unified itemstacks and their counts. + * @return The list of itemstacks that represent the map, taken the max stack size into account. + */ public static List splitMergedCountedStacksIntoMaxContentStacks(@NotNull final Map mergedCountedStacks) { final List list = Lists.newArrayList(); @@ -2469,13 +2358,14 @@ public static List splitMergedCountedStacksIntoMaxContentStacks(@NotN return list; } - /** - * Method searches a list of itemstacks given and an itemhandler to find the stacks that do not appear in the itemhandler. If multiple of the same itemstack appear their sum will be taken into account. - * - * @param stacks The stacks to check - * @param handler The handler to check in - * @return The list of missing stacks. Or an empty list if all stacks and at least their sizes are present. - */ + /** + * Method searches a list of itemstacks given and an itemhandler to find the stacks that do not appear in the itemhandler. If multiple of the same itemstack appear their sum + * will be taken into account. + * + * @param stacks The stacks to check + * @param handler The handler to check in + * @return The list of missing stacks. Or an empty list if all stacks and at least their sizes are present. + */ public static List getMissingFromItemHandler(@NotNull final List stacks, @NotNull final IItemHandler handler) { final List result = Lists.newArrayList(); @@ -2529,13 +2419,13 @@ public static List getMissingFromItemHandler(@NotNull final List getContainedFromItemHandler(@NotNull final List stacks, @NotNull final IItemHandler handler) { final List result = Lists.newArrayList(); @@ -2589,33 +2479,38 @@ public static List getContainedFromItemHandler(@NotNull final List processItemStackListAndMerge(@NotNull final List stacks) { return splitMergedCountedStacksIntoMaxContentStacks(getMergedCountedStacksFromList(stacks)); } - /** - * Attempts a swap with the given itemstacks, from the source to the target inventory. Itemstacks in the target that match the given toKeepInTarget predicate will not be swapped out, if swapping is needed - * - * @param targetInventory The target inventory. - * @param sourceInventories The source inventory. - * @param toSwap The list of stacks to swap. - * @param toKeepInTarget The predicate that determines what not to swap in the target. - * @return True when moving was successfull, false when not - */ - public static boolean moveItemStacksWithPossibleSwap(@NotNull final IItemHandler targetInventory, @NotNull final Collection sourceInventories, @NotNull final List toSwap, @NotNull final Predicate toKeepInTarget) + /** + * Attempts a swap with the given itemstacks, from the source to the target inventory. Itemstacks in the target that match the given toKeepInTarget predicate will not be + * swapped out, if swapping is needed + * + * @param targetInventory The target inventory. + * @param sourceInventories The source inventory. + * @param toSwap The list of stacks to swap. + * @param toKeepInTarget The predicate that determines what not to swap in the target. + * @return True when moving was successfull, false when not + */ + public static boolean moveItemStacksWithPossibleSwap( + @NotNull final IItemHandler targetInventory, + @NotNull final Collection sourceInventories, + @NotNull final List toSwap, + @NotNull final Predicate toKeepInTarget) { if (targetInventory.getSlots() < toSwap.size()) - { + { return false; - } - + } + final Predicate wantToKeep = toKeepInTarget.or(stack -> ItemStackUtils.compareItemStackListIgnoreStackSize(toSwap, stack)); for (final ItemStack itemStack : toSwap) @@ -2632,7 +2527,7 @@ public static boolean moveItemStacksWithPossibleSwap(@NotNull final IItemHandler } } } - return false; + return false; } return true; @@ -2640,8 +2535,9 @@ public static boolean moveItemStacksWithPossibleSwap(@NotNull final IItemHandler /** * Search for a certain itemStack in the inventory and decrease it by 1. + * * @param invWrapper the inventory item handler. - * @param itemStack the itemStack to decrease. + * @param itemStack the itemStack to decrease. */ public static void reduceStackInItemHandler(final IItemHandler invWrapper, final ItemStack itemStack) { @@ -2650,15 +2546,16 @@ public static void reduceStackInItemHandler(final IItemHandler invWrapper, final /** * Search for a certain itemStack in the inventory and decrease it by a certain quantity. + * * @param invWrapper the inventory item handler. - * @param itemStack the itemStack to decrease. - * @param quantity the quantity. + * @param itemStack the itemStack to decrease. + * @param quantity the quantity. */ public static void reduceStackInItemHandler(final IItemHandler invWrapper, final ItemStack itemStack, final int quantity) { for (int i = 0; i < invWrapper.getSlots(); i++) { - if(invWrapper.getStackInSlot(i).isItemEqual(itemStack)) + if (invWrapper.getStackInSlot(i).isItemEqual(itemStack)) { invWrapper.getStackInSlot(i).shrink(quantity); return; @@ -2668,9 +2565,10 @@ public static void reduceStackInItemHandler(final IItemHandler invWrapper, final /** * Search for a certain itemStack in the inventory and decrease it by a certain quantity. + * * @param invWrapper the inventory item handler. - * @param itemStack the itemStack to decrease. - * @param quantity the quantity. + * @param itemStack the itemStack to decrease. + * @param quantity the quantity. * @return true if successfully. */ public static boolean attemptReduceStackInItemHandler(final IItemHandler invWrapper, final ItemStack itemStack, final int quantity) @@ -2684,7 +2582,7 @@ public static boolean attemptReduceStackInItemHandler(final IItemHandler invWrap for (int i = 0; i < invWrapper.getSlots(); i++) { final ItemStack stack = invWrapper.getStackInSlot(i); - if(stack.isItemEqual(itemStack)) + if (stack.isItemEqual(itemStack)) { if (stack.getCount() >= qty) { diff --git a/src/api/java/com/minecolonies/api/util/ItemStackUtils.java b/src/api/java/com/minecolonies/api/util/ItemStackUtils.java old mode 100644 new mode 100755 index 60f33ce97f4..a370be5d020 --- a/src/api/java/com/minecolonies/api/util/ItemStackUtils.java +++ b/src/api/java/com/minecolonies/api/util/ItemStackUtils.java @@ -40,8 +40,7 @@ public final class ItemStackUtils { /** - * Variable representing the empty itemstack in 1.10. - * Used for easy updating to 1.11 + * Variable representing the empty itemstack in 1.10. Used for easy updating to 1.11 */ public static final ItemStack EMPTY = ItemStack.EMPTY; @@ -134,7 +133,6 @@ public static Entity getEntityFromEntityInfoOrNull(final CompoundNBT entityData, return entity; } } - } catch (final RuntimeException e) { @@ -229,8 +227,7 @@ else if (!(entity instanceof MobEntity)) } /** - * Verifies if there is one tool with an acceptable level - * in a worker's inventory. + * Verifies if there is one tool with an acceptable level in a worker's inventory. * * @param stack the stack to test. * @param toolType the type of tool needed @@ -250,8 +247,7 @@ public static boolean hasToolLevel(@Nullable final ItemStack stack, final IToolT } /** - * Wrapper method to check if a stack is empty. - * Used for easy updating to 1.11. + * Wrapper method to check if a stack is empty. Used for easy updating to 1.11. * * @param stack The stack to check. * @return True when the stack is empty, false when not. @@ -453,8 +449,7 @@ else if ("DIAMOND".equals(material)) */ /** - * This routine converts the material type of armor - * into a numerical value for the request system. + * This routine converts the material type of armor into a numerical value for the request system. * * @param material type of material of the armor * @return armor level @@ -659,8 +654,7 @@ public static Boolean compareItemStacksIgnoreStackSize(final ItemStack itemStack } /** - * get the size of the stack. - * This is for compatibility between 1.10 and 1.11 + * get the size of the stack. This is for compatibility between 1.10 and 1.11 * * @param stack to get the size from * @return the size of the stack @@ -679,14 +673,33 @@ public static int getSize(final ItemStack stack) /** * Method to compare to stacks, ignoring their stacksize. * - * @param itemStack1 The left stack to compare. - * @param itemStack2 The right stack to compare. - * @param matchMeta Set to true to match meta data. - * @param matchNBT Set to true to match nbt + * @param itemStack1 The left stack to compare. + * @param itemStack2 The right stack to compare. + * @param matchDamage Set to true to match damage data. + * @param matchNBT Set to true to match nbt * @return True when they are equal except the stacksize, false when not. */ - @NotNull - public static Boolean compareItemStacksIgnoreStackSize(final ItemStack itemStack1, final ItemStack itemStack2, final boolean matchMeta, final boolean matchNBT) + public static boolean compareItemStacksIgnoreStackSize(final ItemStack itemStack1, final ItemStack itemStack2, final boolean matchDamage, final boolean matchNBT) + { + return compareItemStacksIgnoreStackSize(itemStack1, itemStack2, matchDamage, matchNBT, false); + } + + /** + * Method to compare to stacks, ignoring their stacksize. + * + * @param itemStack1 The left stack to compare. + * @param itemStack2 The right stack to compare. + * @param matchDamage Set to true to match damage data. + * @param matchNBT Set to true to match nbt + * @param min if the count of stack2 has to be at least the same as stack1. + * @return True when they are equal except the stacksize, false when not. + */ + public static boolean compareItemStacksIgnoreStackSize( + final ItemStack itemStack1, + final ItemStack itemStack2, + final boolean matchDamage, + final boolean matchNBT, + final boolean min) { if (isEmpty(itemStack1) && isEmpty(itemStack2)) { @@ -696,7 +709,7 @@ public static Boolean compareItemStacksIgnoreStackSize(final ItemStack itemStack if (!isEmpty(itemStack1) && !isEmpty(itemStack2) && itemStack1.getItem() == itemStack2.getItem() && - (itemStack1.getDamage() == itemStack2.getDamage() || !matchMeta)) + (itemStack1.getDamage() == itemStack2.getDamage() || !matchDamage)) { if (!matchNBT) { @@ -704,6 +717,11 @@ public static Boolean compareItemStacksIgnoreStackSize(final ItemStack itemStack return true; } + if (min && itemStack1.getCount() > itemStack2.getCount()) + { + return false; + } + // Then sort on NBT if (itemStack1.hasTag() && itemStack2.hasTag()) { @@ -734,17 +752,17 @@ public static boolean compareItemStackListIgnoreStackSize(final List /** * Method to check if a stack is in a list of stacks. * - * @param stacks the list of stacks. - * @param stack the stack. - * @param matchMeta if meta has to match. - * @param matchNBT if nbt has to match. + * @param stacks the list of stacks. + * @param stack the stack. + * @param matchDamage if damage has to match. + * @param matchNBT if nbt has to match. * @return true if so. */ - public static boolean compareItemStackListIgnoreStackSize(final List stacks, final ItemStack stack, final boolean matchMeta, final boolean matchNBT) + public static boolean compareItemStackListIgnoreStackSize(final List stacks, final ItemStack stack, final boolean matchDamage, final boolean matchNBT) { for (final ItemStack tempStack : stacks) { - if (compareItemStacksIgnoreStackSize(tempStack, stack, matchMeta, matchNBT)) + if (compareItemStacksIgnoreStackSize(tempStack, stack, matchDamage, matchNBT)) { return true; } @@ -753,8 +771,7 @@ public static boolean compareItemStackListIgnoreStackSize(final List } /** - * set the size of the stack. - * This is for compatibility between 1.10 and 1.11 + * set the size of the stack. This is for compatibility between 1.10 and 1.11 * * @param stack to set the size to * @param size of the stack diff --git a/src/api/java/com/minecolonies/api/util/LoadOnlyStructureHandler.java b/src/api/java/com/minecolonies/api/util/LoadOnlyStructureHandler.java old mode 100644 new mode 100755 index a7128abd6f0..800783e5712 --- a/src/api/java/com/minecolonies/api/util/LoadOnlyStructureHandler.java +++ b/src/api/java/com/minecolonies/api/util/LoadOnlyStructureHandler.java @@ -22,10 +22,11 @@ public final class LoadOnlyStructureHandler extends CreativeStructureHandler { /** * The minecolonies specific creative structure placer. - * @param world the world. - * @param pos the pos it is placed at. - * @param structureName the name of the structure. - * @param settings the placement settings. + * + * @param world the world. + * @param pos the pos it is placed at. + * @param structureName the name of the structure. + * @param settings the placement settings. * @param fancyPlacement if fancy or complete. */ public LoadOnlyStructureHandler(final World world, final BlockPos pos, final String structureName, final PlacementSettings settings, final boolean fancyPlacement) @@ -35,10 +36,11 @@ public LoadOnlyStructureHandler(final World world, final BlockPos pos, final Str /** * The minecolonies specific creative structure placer. - * @param world the world. - * @param pos the pos it is placed at. - * @param blueprint the blueprint. - * @param settings the placement settings. + * + * @param world the world. + * @param pos the pos it is placed at. + * @param blueprint the blueprint. + * @param settings the placement settings. * @param fancyPlacement if fancy or complete. */ public LoadOnlyStructureHandler(final World world, final BlockPos pos, final Blueprint blueprint, final PlacementSettings settings, final boolean fancyPlacement) @@ -76,7 +78,7 @@ public boolean shouldBlocksBeConsideredEqual(final BlockState state1, final Bloc public boolean isStackFree(@Nullable final ItemStack itemStack) { return itemStack == null - ||itemStack.isEmpty() + || itemStack.isEmpty() || itemStack.getItem().isIn(ItemTags.LEAVES) || itemStack.getItem() == new ItemStack(ModBlocks.blockDecorationPlaceholder, 1).getItem(); } diff --git a/src/api/java/com/minecolonies/api/util/Log.java b/src/api/java/com/minecolonies/api/util/Log.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/util/MathUtils.java b/src/api/java/com/minecolonies/api/util/MathUtils.java old mode 100644 new mode 100755 index 9b1ea1a2dd2..a88aa48961a --- a/src/api/java/com/minecolonies/api/util/MathUtils.java +++ b/src/api/java/com/minecolonies/api/util/MathUtils.java @@ -40,8 +40,7 @@ public static long nanoSecondsToSeconds(final long nanoSeconds) } /** - * Calculates the distance between two points without considering the - * y-value. + * Calculates the distance between two points without considering the y-value. * * @param position the start position. * @param target the end position. diff --git a/src/api/java/com/minecolonies/api/util/NBTUtils.java b/src/api/java/com/minecolonies/api/util/NBTUtils.java old mode 100644 new mode 100755 index 4a853a80888..2dff2f1a25a --- a/src/api/java/com/minecolonies/api/util/NBTUtils.java +++ b/src/api/java/com/minecolonies/api/util/NBTUtils.java @@ -28,20 +28,21 @@ public static Stream streamBase(final ListNBT list) public static Collector toListNBT() { return Collectors.collectingAndThen( - Collectors.toList(), - list -> { - final ListNBT tagList = new ListNBT(); - list.forEach(tagList::add); + Collectors.toList(), + list -> { + final ListNBT tagList = new ListNBT(); + list.forEach(tagList::add); - return tagList; - }); + return tagList; + }); } private static class TagListIterator implements Iterator { private final ListNBT list; - private int currentIndex = 0; + private int currentIndex = 0; + private TagListIterator(final ListNBT list) {this.list = list;} @Override diff --git a/src/api/java/com/minecolonies/api/util/Pond.java b/src/api/java/com/minecolonies/api/util/Pond.java old mode 100644 new mode 100755 index c401972221a..c1ebcda3475 --- a/src/api/java/com/minecolonies/api/util/Pond.java +++ b/src/api/java/com/minecolonies/api/util/Pond.java @@ -20,8 +20,8 @@ public final class Pond /** * Checks if on position "water" really is water, if the water is connected to land and if the pond is big enough (bigger then 20). * - * @param world The world the player is in. - * @param water The coordinate to check. + * @param world The world the player is in. + * @param water The coordinate to check. * @param result the water path result. * @return true if water. */ @@ -63,8 +63,7 @@ public static boolean checkWater(@NotNull final IWorldReader world, @NotNull fin } /** - * Checks if all blocks in direction X are water and if yes from the middle to both sides in. - * direction Z all blocks are also water. + * Checks if all blocks in direction X are water and if yes from the middle to both sides in. direction Z all blocks are also water. * * @param world World. * @param x posX. @@ -98,8 +97,7 @@ private static boolean checkWaterPoolInDirectionXThenZ( } /** - * Checks if all blocks in direction Z are water and if yes from the middle to both sides in - * direction X all blocks are also water. + * Checks if all blocks in direction Z are water and if yes from the middle to both sides in direction X all blocks are also water. * * @param world World. * @param x posX. diff --git a/src/api/java/com/minecolonies/api/util/RSConstants.java b/src/api/java/com/minecolonies/api/util/RSConstants.java old mode 100644 new mode 100755 index 36d3d28ec72..1d654fdcb1c --- a/src/api/java/com/minecolonies/api/util/RSConstants.java +++ b/src/api/java/com/minecolonies/api/util/RSConstants.java @@ -8,13 +8,13 @@ public final class RSConstants /** * Priorities of the different resolvers. */ - public static final int CONST_DEFAULT_RESOLVER_PRIORITY = 100; - public static final int CONST_BUILDING_RESOLVER_PRIORITY = CONST_DEFAULT_RESOLVER_PRIORITY + 100; - public static final int CONST_WAREHOUSE_RESOLVER_PRIORITY = CONST_DEFAULT_RESOLVER_PRIORITY + 50; + public static final int CONST_DEFAULT_RESOLVER_PRIORITY = 100; + public static final int CONST_BUILDING_RESOLVER_PRIORITY = CONST_DEFAULT_RESOLVER_PRIORITY + 100; + public static final int CONST_WAREHOUSE_RESOLVER_PRIORITY = CONST_DEFAULT_RESOLVER_PRIORITY + 50; public static final int CONST_PUB_CRAFTING_RESOLVER_PRIORITY = CONST_DEFAULT_RESOLVER_PRIORITY + 40; - public static final int CONST_CRAFTING_RESOLVER_PRIORITY = CONST_DEFAULT_RESOLVER_PRIORITY + 25; - public static final int STANDARD_PLAYER_REQUEST_PRIORITY = 0; - public static final int CONST_RETRYING_RESOLVER_PRIORITY = CONST_DEFAULT_RESOLVER_PRIORITY - 50; + public static final int CONST_CRAFTING_RESOLVER_PRIORITY = CONST_DEFAULT_RESOLVER_PRIORITY + 25; + public static final int STANDARD_PLAYER_REQUEST_PRIORITY = 0; + public static final int CONST_RETRYING_RESOLVER_PRIORITY = CONST_DEFAULT_RESOLVER_PRIORITY - 50; /** * Private constructor to hide the public one. diff --git a/src/api/java/com/minecolonies/api/util/ReflectionUtils.java b/src/api/java/com/minecolonies/api/util/ReflectionUtils.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/util/SoundUtils.java b/src/api/java/com/minecolonies/api/util/SoundUtils.java old mode 100644 new mode 100755 index 15de5f53ca6..96f427e9d1b --- a/src/api/java/com/minecolonies/api/util/SoundUtils.java +++ b/src/api/java/com/minecolonies/api/util/SoundUtils.java @@ -68,8 +68,9 @@ private SoundUtils() /** * Play a random sound at the citizen. + * * @param worldIn the world to play it in. - * @param pos the pos to play it at. + * @param pos the pos to play it at. * @param citizen the citizen to play it for. */ public static void playRandomSound(@NotNull final World worldIn, @NotNull final BlockPos pos, @NotNull final ICitizenData citizen) @@ -139,12 +140,16 @@ public static void playSoundAtCitizen(@NotNull final World worldIn, @NotNull fin /** * Plays a sound with a certain chance at a certain position. * - * @param worldIn the world to play the sound in. - * @param position position to play the sound at. - * @param type sound to play. + * @param worldIn the world to play the sound in. + * @param position position to play the sound at. + * @param type sound to play. * @param citizenData the citizen. */ - public static void playSoundAtCitizenWith(@NotNull final World worldIn, @NotNull final BlockPos position, @Nullable final EventType type, @Nullable final ICitizenData citizenData) + public static void playSoundAtCitizenWith( + @NotNull final World worldIn, + @NotNull final BlockPos position, + @Nullable final EventType type, + @Nullable final ICitizenData citizenData) { if (citizenData == null) { @@ -181,6 +186,7 @@ public static void playSoundAtCitizenWith(@NotNull final World worldIn, @NotNull /** * Get a random pitch for a sound. + * * @param random the random method. * @return a random double for the pitch. */ diff --git a/src/api/java/com/minecolonies/api/util/Tuple.java b/src/api/java/com/minecolonies/api/util/Tuple.java old mode 100644 new mode 100755 index 0abddb078b3..a80a2d1845c --- a/src/api/java/com/minecolonies/api/util/Tuple.java +++ b/src/api/java/com/minecolonies/api/util/Tuple.java @@ -2,8 +2,11 @@ import org.jetbrains.annotations.Nullable; +import java.util.Objects; + /** * Our own tuple implementation with hashcode and equals. + * * @param The first obj. * @param The second obj. */ @@ -19,28 +22,36 @@ public Tuple(@Nullable final A aIn, @Nullable final B bIn) } @Nullable - public A getA() { + public A getA() + { return this.a; } @Nullable - public B getB() { + public B getB() + { return this.b; } @Override public int hashCode() { - return getA().hashCode() * 31 + getB().hashCode() * 31; + return Objects.hash(a, b); } @Override public boolean equals(final Object o) { - if (o instanceof Tuple) + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) { - return ((Tuple) o).getA().equals(this.getA()) && ((Tuple) o).getB().equals(this.getB()); + return false; } - return false; + final Tuple tuple = (Tuple) o; + return Objects.equals(a, tuple.a) && + Objects.equals(b, tuple.b); } } diff --git a/src/api/java/com/minecolonies/api/util/Utils.java b/src/api/java/com/minecolonies/api/util/Utils.java old mode 100644 new mode 100755 index 423975167a1..6d5c2ae2e17 --- a/src/api/java/com/minecolonies/api/util/Utils.java +++ b/src/api/java/com/minecolonies/api/util/Utils.java @@ -11,8 +11,7 @@ import java.util.Objects; /** - * General purpose utilities class. - * todo: split up into logically distinct parts + * General purpose utilities class. todo: split up into logically distinct parts */ public final class Utils { @@ -75,8 +74,7 @@ public static BlockPos scanForBlockNearPoint( } /** - * Checks if the blocks above that point are all of the spezified block - * types. + * Checks if the blocks above that point are all of the spezified block types. * * @param world the world we check on. * @param x the x coordinate. @@ -148,12 +146,7 @@ public static boolean isBlockInRange(@NotNull final World world, final Block blo } /** - * Checks if the flag is set in the data. - * E.G. - * - Flag: 000101. - * - Data: 100101. - * - All Flags are set in data, so returns true. - * Some more flags are set, but not take into account + * Checks if the flag is set in the data. E.G. - Flag: 000101. - Data: 100101. - All Flags are set in data, so returns true. Some more flags are set, but not take into account * * @param data Data to check flag in. * @param flag Flag to check whether it is set or not. @@ -165,11 +158,7 @@ public static boolean testFlag(final int data, final int flag) } /** - * Returns what flags are set, and given in mask. - * E.G. - * - Flag: 000101. - * - Mask: 100101. - * - The 4th and 6th bit are set, so only those will be returned. + * Returns what flags are set, and given in mask. E.G. - Flag: 000101. - Mask: 100101. - The 4th and 6th bit are set, so only those will be returned. * * @param data Data to check. * @param mask Mask to check. @@ -181,11 +170,7 @@ public static int mask(final int data, final int mask) } /** - * Sets a flag in in the data. - * E.G. - * - Flag: 000101 - * - Mask: 100001 - * - The 4th bit will now be set, both the 1st and 6th bit are maintained. + * Sets a flag in in the data. E.G. - Flag: 000101 - Mask: 100001 - The 4th bit will now be set, both the 1st and 6th bit are maintained. * * @param data Data to set flag in. * @param flag Flag to set. @@ -197,11 +182,7 @@ public static int setFlag(final int data, final int flag) } /** - * Unsets a flag. - * E.G. - * - Flag: 000101 - * - Mask: 100101 - * - The 4th and 6th bit will be unset, the 1st bit is maintained. + * Unsets a flag. E.G. - Flag: 000101 - Mask: 100101 - The 4th and 6th bit will be unset, the 1st bit is maintained. * * @param data Data to remove flag from. * @param flag Flag to remove. @@ -213,11 +194,7 @@ public static int unsetFlag(final int data, final int flag) } /** - * Toggles flags. - * E.G. - * - Flag: 000101 - * - Mask: 100101 - * - The 4th and 6th will be toggled, the 1st bit is maintained. + * Toggles flags. E.G. - Flag: 000101 - Mask: 100101 - The 4th and 6th will be toggled, the 1st bit is maintained. * * @param data Data to toggle flag in. * @param flag Flag to toggle. diff --git a/src/api/java/com/minecolonies/api/util/Vec2i.java b/src/api/java/com/minecolonies/api/util/Vec2i.java old mode 100644 new mode 100755 index 6a0020753f6..d3178c98525 --- a/src/api/java/com/minecolonies/api/util/Vec2i.java +++ b/src/api/java/com/minecolonies/api/util/Vec2i.java @@ -3,8 +3,7 @@ import org.jetbrains.annotations.NotNull; /** - * Data structure to hold a two dimensional point. Uses x and z, - * because y is typically the third dimension in minecraft. + * Data structure to hold a two dimensional point. Uses x and z, because y is typically the third dimension in minecraft. * * @author Colton */ diff --git a/src/api/java/com/minecolonies/api/util/constant/BuildingConstants.java b/src/api/java/com/minecolonies/api/util/constant/BuildingConstants.java old mode 100644 new mode 100755 index 5fb911d3b79..6f8710c9337 --- a/src/api/java/com/minecolonies/api/util/constant/BuildingConstants.java +++ b/src/api/java/com/minecolonies/api/util/constant/BuildingConstants.java @@ -23,7 +23,7 @@ public final class BuildingConstants /** * Min slots required to be recognized as storage. */ - public static final int MIN_SLOTS_FOR_RECOGNITION = 5; + public static final int MIN_SLOTS_FOR_RECOGNITION = 5; // --------------- Miner building constants ---------------// @@ -67,6 +67,11 @@ public final class BuildingConstants */ public static final String TAG_ACTIVE = "activeNodeNode"; + /** + * The NBT Tag to store the active node the miner is working on. + */ + public static final String TAG_ONGOING = "ongoingDeliveries"; + /** * The NBT Tag to store the active node the miner is working on. */ diff --git a/src/api/java/com/minecolonies/api/util/constant/CitizenConstants.java b/src/api/java/com/minecolonies/api/util/constant/CitizenConstants.java old mode 100644 new mode 100755 index 29bfa363808..5e2ec491d8c --- a/src/api/java/com/minecolonies/api/util/constant/CitizenConstants.java +++ b/src/api/java/com/minecolonies/api/util/constant/CitizenConstants.java @@ -48,7 +48,7 @@ public final class CitizenConstants /** * The range for the citizen to move away. */ - public static final int MOVE_AWAY_RANGE = 6; + public static final int MOVE_AWAY_RANGE = 6; /** * Number of ticks to heal the citizens. @@ -76,8 +76,7 @@ public final class CitizenConstants */ public static final double EXP_DIVIDER = 100.0; /** - * Chance the citizen will rant about bad weather. 20 ticks per 60 seconds = - * 5 minutes. + * Chance the citizen will rant about bad weather. 20 ticks per 60 seconds = 5 minutes. */ public static final int RANT_ABOUT_WEATHER_CHANCE = 20 * 60 * 5; /** @@ -119,51 +118,51 @@ public final class CitizenConstants /** * This times the citizen id is the personal offset of the citizen. */ - public static final int OFFSET_TICK_MULTIPLIER = 7; + public static final int OFFSET_TICK_MULTIPLIER = 7; /** * Range required for the citizen to be home. */ - public static final double RANGE_TO_BE_HOME = 16; + public static final double RANGE_TO_BE_HOME = 16; /** * If the entitiy is stuck for 2 minutes do something. */ - public static final int MAX_STUCK_TIME = 120; + public static final int MAX_STUCK_TIME = 120; /** * The max amount of lines the latest log allows. */ - public static final int MAX_LINES_OF_LATEST_LOG = 4; + public static final int MAX_LINES_OF_LATEST_LOG = 4; /** * Distance from mobs the entity should hold. */ - public static final double DISTANCE_OF_ENTITY_AVOID = 5.0D; + public static final double DISTANCE_OF_ENTITY_AVOID = 5.0D; /** * Initital speed while running away from entities. */ - public static final double INITIAL_RUN_SPEED_AVOID = 1.1D; + public static final double INITIAL_RUN_SPEED_AVOID = 1.1D; /** * Later run speed while running away from entities. */ - public static final double LATER_RUN_SPEED_AVOID = 0.8D; + public static final double LATER_RUN_SPEED_AVOID = 0.8D; /** * The max squaredistance a citizen can call a guard to help. */ - public static final int MAX_GUARD_CALL_RANGE = 10000; + public static final int MAX_GUARD_CALL_RANGE = 10000; /** * Happiness penalty for citizen death. */ - public static final double CITIZEN_DEATH_PENALTY = 0.2; + public static final double CITIZEN_DEATH_PENALTY = 0.2; /** * Happiness penalty for citizen kill. */ - public static final double CITIZEN_KILL_PENALTY = 9; + public static final double CITIZEN_KILL_PENALTY = 9; /** * Big multiplier in extreme saturation situations. */ - public static final double BIG_SATURATION_FACTOR = 0.05; + public static final double BIG_SATURATION_FACTOR = 0.05; /** * Small multiplier in average saturation situation.s */ - public static final double LOW_SATURATION_FACTOR = 0.01; + public static final double LOW_SATURATION_FACTOR = 0.01; /** * Decrease by this * buildingLevel each new night. */ @@ -274,8 +273,7 @@ public final class CitizenConstants public static final double XP_EACH_BUILDING = 10.0D; /** - * Increase this value to make the building speed slower. - * Used to balance worker level speed increase. + * Increase this value to make the building speed slower. Used to balance worker level speed increase. */ public static final int PROGRESS_MULTIPLIER = 10; diff --git a/src/api/java/com/minecolonies/api/util/constant/ColonyConstants.java b/src/api/java/com/minecolonies/api/util/constant/ColonyConstants.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/util/constant/ColonyManagerConstants.java b/src/api/java/com/minecolonies/api/util/constant/ColonyManagerConstants.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/util/constant/ColorConstants.java b/src/api/java/com/minecolonies/api/util/constant/ColorConstants.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/util/constant/CommandConstants.java b/src/api/java/com/minecolonies/api/util/constant/CommandConstants.java old mode 100644 new mode 100755 index 58bcdfb32af..50f331d53ae --- a/src/api/java/com/minecolonies/api/util/constant/CommandConstants.java +++ b/src/api/java/com/minecolonies/api/util/constant/CommandConstants.java @@ -29,35 +29,35 @@ public final class CommandConstants @NonNls public static final String COLONY_X_NULL = "Couldn't find colony %d."; @NonNls - public static final String NO_COLONY_OR_PLAYER = "Please define a colony or player"; + public static final String NO_COLONY_OR_PLAYER = "Please define a colony or player"; @NonNls - public static final String NO_PLAYER = "Can't find player to add"; + public static final String NO_PLAYER = "Can't find player to add"; @NonNls - public static final String HAS_A_COLONY = "Player %s has a colony already."; + public static final String HAS_A_COLONY = "Player %s has a colony already."; @NonNls - public static final String NO_COLONY_MESSAGE = "Invalid colony, aborting!"; + public static final String NO_COLONY_MESSAGE = "Invalid colony, aborting!"; @NonNls - public static final String SPECIAL_CHARACTERS_ADVICE = "Please stick to the default characters A-Z, a-z and, 0-9"; + public static final String SPECIAL_CHARACTERS_ADVICE = "Please stick to the default characters A-Z, a-z and, 0-9"; /** * Success messages: */ @NonNls - public static final String SUCCESS_MESSAGE_ADD_OFFICER = "Successfully added Player %s to colony %d"; + public static final String SUCCESS_MESSAGE_ADD_OFFICER = "Successfully added Player %s to colony %d"; @NonNls - public static final String SCAN_SUCCESS_MESSAGE = "Successfully scan structure!"; + public static final String SCAN_SUCCESS_MESSAGE = "Successfully scan structure!"; @NonNls - public static final String SUCCESS_MESSAGE_OWNERCHANGE = "Successfully switched Owner %s to colony %d"; + public static final String SUCCESS_MESSAGE_OWNERCHANGE = "Successfully switched Owner %s to colony %d"; @NonNls public static final String DELETE_COLONY_TASK_SCHEDULED = "Delete colony task scheduled."; @NonNls - public static final String SUCCESFULLY_CLAIMED_CHUNKS = "Succesfully claimed chunks in every direction"; + public static final String SUCCESFULLY_CLAIMED_CHUNKS = "Succesfully claimed chunks in every direction"; @NonNls - public static final String TOO_MANY_CHUNKS = "You are trying to claim an area bigger than twice the colony size! Aborting to avoid lags and crashes."; + public static final String TOO_MANY_CHUNKS = "You are trying to claim an area bigger than twice the colony size! Aborting to avoid lags and crashes."; @NonNls - public static final int CHUNKS_TO_CLAM_THRESHOLD = 5000; + public static final int CHUNKS_TO_CLAM_THRESHOLD = 5000; @NonNls - public static final String TOO_MANY_CHUNKS_CLAIMED = "You've reached the maximal claimable chunk count, aborting."; + public static final String TOO_MANY_CHUNKS_CLAIMED = "You've reached the maximal claimable chunk count, aborting."; /** * Private constructor to hide the implicit one. diff --git a/src/api/java/com/minecolonies/api/util/constant/Constants.java b/src/api/java/com/minecolonies/api/util/constant/Constants.java old mode 100644 new mode 100755 index c4a0bfa0f17..c16fa2fbd07 --- a/src/api/java/com/minecolonies/api/util/constant/Constants.java +++ b/src/api/java/com/minecolonies/api/util/constant/Constants.java @@ -81,15 +81,15 @@ public final class Constants /** * Advancement Criterion Names */ - public static final String CRITERION_SUPPLY_PLACED = "supply_placed"; - public static final String CRITERION_STRUCTURE_PLACED = "structure_placed"; - public static final String CRITERION_CREATE_BUILD_REQUEST = "create_build_request"; - public static final String CRITERION_OPEN_GUI_WINDOW = "open_gui_window"; - public static final String CRITERION_CLICK_GUI_BUTTON = "click_gui_button"; - public static final String CRITERION_CITIZEN_EAT_FOOD = "citizen_eat_food"; - public static final String CRITERION_BUILDING_ADD_RECIPE = "building_add_recipe"; + public static final String CRITERION_SUPPLY_PLACED = "supply_placed"; + public static final String CRITERION_STRUCTURE_PLACED = "structure_placed"; + public static final String CRITERION_CREATE_BUILD_REQUEST = "create_build_request"; + public static final String CRITERION_OPEN_GUI_WINDOW = "open_gui_window"; + public static final String CRITERION_CLICK_GUI_BUTTON = "click_gui_button"; + public static final String CRITERION_CITIZEN_EAT_FOOD = "citizen_eat_food"; + public static final String CRITERION_BUILDING_ADD_RECIPE = "building_add_recipe"; public static final String CRITERION_COMPLETE_BUILD_REQUEST = "complete_build_request"; - public static final String CRITERION_COLONY_POPULATION = "colony_population"; + public static final String CRITERION_COLONY_POPULATION = "colony_population"; /** * Placement key for item nbt diff --git a/src/api/java/com/minecolonies/api/util/constant/GuardConstants.java b/src/api/java/com/minecolonies/api/util/constant/GuardConstants.java old mode 100644 new mode 100755 index 18fd18354e7..d5bf1bf9e2f --- a/src/api/java/com/minecolonies/api/util/constant/GuardConstants.java +++ b/src/api/java/com/minecolonies/api/util/constant/GuardConstants.java @@ -151,18 +151,18 @@ public final class GuardConstants * Guard armor constants */ public static final Tuple LEATHER_LEVEL_RANGE = new Tuple<>(0, 99); - public static final Tuple GOLD_LEVEL_RANGE = new Tuple<>(0, 99); - public static final Tuple CHAIN_LEVEL_RANGE = new Tuple<>(0, 99); - public static final Tuple IRON_LEVEL_RANGE = new Tuple<>(5, 99); - public static final Tuple DIA_LEVEL_RANGE = new Tuple<>(15, 99); + public static final Tuple GOLD_LEVEL_RANGE = new Tuple<>(0, 99); + public static final Tuple CHAIN_LEVEL_RANGE = new Tuple<>(0, 99); + public static final Tuple IRON_LEVEL_RANGE = new Tuple<>(5, 99); + public static final Tuple DIA_LEVEL_RANGE = new Tuple<>(15, 99); public static final Tuple LEATHER_BUILDING_LEVEL_RANGE = new Tuple<>(1, 5); - public static final Tuple GOLD_BUILDING_LEVEL_RANGE = new Tuple<>(1, 5); - public static final Tuple CHAIN_BUILDING_LEVEL_RANGE = new Tuple<>(2, 5); - public static final Tuple IRON_BUILDING_LEVEL_RANGE = new Tuple<>(3, 5); - public static final Tuple DIA_BUILDING_LEVEL_RANGE = new Tuple<>(4, 5); + public static final Tuple GOLD_BUILDING_LEVEL_RANGE = new Tuple<>(1, 5); + public static final Tuple CHAIN_BUILDING_LEVEL_RANGE = new Tuple<>(2, 5); + public static final Tuple IRON_BUILDING_LEVEL_RANGE = new Tuple<>(3, 5); + public static final Tuple DIA_BUILDING_LEVEL_RANGE = new Tuple<>(4, 5); - public static final Tuple SHIELD_LEVEL_RANGE = new Tuple<>(2, 99); + public static final Tuple SHIELD_LEVEL_RANGE = new Tuple<>(2, 99); public static final Tuple SHIELD_BUILDING_LEVEL_RANGE = new Tuple<>(1, 5); /** @@ -174,5 +174,4 @@ private GuardConstants() * Intentionally left empty. */ } - } diff --git a/src/api/java/com/minecolonies/api/util/constant/HappinessConstants.java b/src/api/java/com/minecolonies/api/util/constant/HappinessConstants.java old mode 100644 new mode 100755 index 8c5f042225a..064f67942dd --- a/src/api/java/com/minecolonies/api/util/constant/HappinessConstants.java +++ b/src/api/java/com/minecolonies/api/util/constant/HappinessConstants.java @@ -9,16 +9,16 @@ public final class HappinessConstants * constants for house modifier. */ public static final int COMPLAIN_DAYS_WITHOUT_HOUSE = 7; - public static final int DEMANDS_DAYS_WITHOUT_HOUSE = 14; + public static final int DEMANDS_DAYS_WITHOUT_HOUSE = 14; public static final int COMPLAIN_DAYS_SICK = 7; - public static final int DEMANDS_CURE_SICK = 14; + public static final int DEMANDS_CURE_SICK = 14; /** * constants for job modifier. */ public static final int COMPLAIN_DAYS_WITHOUT_JOB = 7; - public static final int DEMANDS_DAYS_WITHOUT_JOB = 14; + public static final int DEMANDS_DAYS_WITHOUT_JOB = 14; /** * constants for happiness min/max and start happines values. @@ -40,18 +40,18 @@ public final class HappinessConstants /** * Happiness modifiers */ - public static final String HOMELESSNESS = "homelessness"; - public static final String UNEMPLOYMENT = "unemployment"; - public static final String HEALTH = "health"; - public static final String IDLEATJOB = "idleatjob"; - public static final String SCHOOL = "school"; - public static final String SECURITY = "security"; - public static final String SOCIAL = "social"; - public static final String SATURATION = "saturation"; - public static final String DAMAGE = "damage"; - public static final String DEATH = "death"; + public static final String HOMELESSNESS = "homelessness"; + public static final String UNEMPLOYMENT = "unemployment"; + public static final String HEALTH = "health"; + public static final String IDLEATJOB = "idleatjob"; + public static final String SCHOOL = "school"; + public static final String SECURITY = "security"; + public static final String SOCIAL = "social"; + public static final String SATURATION = "saturation"; + public static final String DAMAGE = "damage"; + public static final String DEATH = "death"; public static final String RAIDWITHOUTDEATH = "raidwithoutdeath"; - public static final String SLEPTTONIGHT = "slepttonight"; + public static final String SLEPTTONIGHT = "slepttonight"; /** * Private constructor to hide implicit public one. diff --git a/src/api/java/com/minecolonies/api/util/constant/IToolType.java b/src/api/java/com/minecolonies/api/util/constant/IToolType.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/util/constant/InventoryConstants.java b/src/api/java/com/minecolonies/api/util/constant/InventoryConstants.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/util/constant/Literals.java b/src/api/java/com/minecolonies/api/util/constant/Literals.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/util/constant/NameConstants.java b/src/api/java/com/minecolonies/api/util/constant/NameConstants.java old mode 100644 new mode 100755 diff --git a/src/api/java/com/minecolonies/api/util/constant/NbtTagConstants.java b/src/api/java/com/minecolonies/api/util/constant/NbtTagConstants.java old mode 100644 new mode 100755 index 501b0a0bf3c..139c28e9a06 --- a/src/api/java/com/minecolonies/api/util/constant/NbtTagConstants.java +++ b/src/api/java/com/minecolonies/api/util/constant/NbtTagConstants.java @@ -5,31 +5,31 @@ */ public final class NbtTagConstants { - public static final String TAG_ID = "id"; - public static final String TAG_NAME = "name"; - public static final String TAG_SUFFIX = "suffix"; - public static final String TAG_DIMENSION = "dimension"; - public static final String TAG_CENTER = "center"; - public static final String TAG_BUILDINGS = "buildings"; - public static final String TAG_BUILDING = "building"; - public static final String TAG_BUILDINGS_CLAIM = "buildingsClaim"; - public static final String TAG_BUILDINGS_UNCLAIM = "buildingUnclaim"; - public static final String TAG_CITIZENS = "citizens"; - public static final String TAG_VISITORS = "visitors"; - public static final String TAG_ACHIEVEMENT = "achievement"; - public static final String TAG_ACHIEVEMENT_LIST = "achievementlist"; - public static final String TAG_WORK = "work"; - public static final String TAG_MANUAL_HIRING = "manualHiring"; - public static final String TAG_MANUAL_HOUSING = "manualHousing"; - public static final String TAG_MOVE_IN = "moveIn"; - public static final String TAG_REQUESTMANAGER = "requestManager"; - public static final String TAG_WAYPOINT = "waypoints"; - public static final String TAG_FREE_BLOCKS = "freeBlocks"; - public static final String TAG_FREE_POSITIONS = "freePositions"; - public static final String TAG_HAPPINESS_MODIFIER = "happinessModifier"; - public static final String TAG_ABANDONED = "abandoned"; - public static final String TAG_BUILDING_PRIO = "buildingPrio"; - public static final String TAG_PRIO = "prio"; + public static final String TAG_ID = "id"; + public static final String TAG_NAME = "name"; + public static final String TAG_SUFFIX = "suffix"; + public static final String TAG_DIMENSION = "dimension"; + public static final String TAG_CENTER = "center"; + public static final String TAG_BUILDINGS = "buildings"; + public static final String TAG_BUILDING = "building"; + public static final String TAG_BUILDINGS_CLAIM = "buildingsClaim"; + public static final String TAG_BUILDINGS_UNCLAIM = "buildingUnclaim"; + public static final String TAG_CITIZENS = "citizens"; + public static final String TAG_VISITORS = "visitors"; + public static final String TAG_ACHIEVEMENT = "achievement"; + public static final String TAG_ACHIEVEMENT_LIST = "achievementlist"; + public static final String TAG_WORK = "work"; + public static final String TAG_MANUAL_HIRING = "manualHiring"; + public static final String TAG_MANUAL_HOUSING = "manualHousing"; + public static final String TAG_MOVE_IN = "moveIn"; + public static final String TAG_REQUESTMANAGER = "requestManager"; + public static final String TAG_WAYPOINT = "waypoints"; + public static final String TAG_FREE_BLOCKS = "freeBlocks"; + public static final String TAG_FREE_POSITIONS = "freePositions"; + public static final String TAG_HAPPINESS_MODIFIER = "happinessModifier"; + public static final String TAG_ABANDONED = "abandoned"; + public static final String TAG_BUILDING_PRIO = "buildingPrio"; + public static final String TAG_PRIO = "prio"; /** * @deprecated Superseeded by request-based pickup system. @@ -82,38 +82,38 @@ public final class NbtTagConstants public static final String TAG_BASE = "base"; public static final String TAG_FOOD = "foodModifier"; public static final String TAG_DAMAGE = "damageModifier"; - public static final String TAG_HOUSE = "houseModifier"; - public static final String TAG_NUMBER_OF_DAYS_HOUSE = "numberOfDaysWithoutHouse"; - public static final String TAG_JOB = "jobModifier"; - public static final String TAG_NUMBER_OF_DAYS_JOB = "numberOfDaysWithoutJob"; - public static final String TAG_HAS_NO_FIELDS = "hasNoFields"; - public static final String TAG_FIELD_DAYS_INACTIVE = "daysinactive"; - public static final String TAG_FIELD_CAN_FARM = "canfarm"; - public static final String TAG_NO_TOOLS = "noTools"; - public static final String TAG_NO_TOOLS_NUMBER_DAYS = "numberOfDaysNoTools"; - public static final String TAG_NO_TOOLS_TOOL_TYPE = "toolType"; - public static final String TAG_IS_BUILT = "isBuilt"; - public static final String TAG_CUSTOM_NAME = "customName"; - public static final String TAG_OTHER_LEVEL = "otherLevel"; - public static final String TAG_PASTEABLE = "isPasteable"; - public static final String TAG_STRING_NAME = "Name"; - public static final String TAG_DISPLAY = "display"; - public static final String TAG_NEED_TO_MOURN = "needToMourn"; - public static final String TAG_MOURNING = "mourning"; - public static final String TAG_PAUSED = "paused"; - public static final String TAG_CHILD = "child"; - public static final String TAG_CHILD_TIME = "childTime"; - public static final String TAG_BOUGHT_CITIZENS = "bought_citizen"; - public static final String TAG_JUST_ATE = "justAte"; - public static final String TAG_EXPLOSIONS = "Explosions"; - public static final String TAG_FIREWORKS = "Fireworks"; - public static final String TAG_COLORS = "Colors"; - public static final String TAG_FLICKER = "Flicker"; - public static final String TAG_TRAIL = "Trail"; - public static final String TAG_TYPE = "Type"; - public static final String TAG_MERCENARY_TIME = "mercenaryUseTime"; - public static final String TAG_IDLE = "idle"; - public static final String TAG_CITIZENDATA_TYPE = "citizenDataType"; + public static final String TAG_HOUSE = "houseModifier"; + public static final String TAG_NUMBER_OF_DAYS_HOUSE = "numberOfDaysWithoutHouse"; + public static final String TAG_JOB = "jobModifier"; + public static final String TAG_NUMBER_OF_DAYS_JOB = "numberOfDaysWithoutJob"; + public static final String TAG_HAS_NO_FIELDS = "hasNoFields"; + public static final String TAG_FIELD_DAYS_INACTIVE = "daysinactive"; + public static final String TAG_FIELD_CAN_FARM = "canfarm"; + public static final String TAG_NO_TOOLS = "noTools"; + public static final String TAG_NO_TOOLS_NUMBER_DAYS = "numberOfDaysNoTools"; + public static final String TAG_NO_TOOLS_TOOL_TYPE = "toolType"; + public static final String TAG_IS_BUILT = "isBuilt"; + public static final String TAG_CUSTOM_NAME = "customName"; + public static final String TAG_OTHER_LEVEL = "otherLevel"; + public static final String TAG_PASTEABLE = "isPasteable"; + public static final String TAG_STRING_NAME = "Name"; + public static final String TAG_DISPLAY = "display"; + public static final String TAG_NEED_TO_MOURN = "needToMourn"; + public static final String TAG_MOURNING = "mourning"; + public static final String TAG_PAUSED = "paused"; + public static final String TAG_CHILD = "child"; + public static final String TAG_CHILD_TIME = "childTime"; + public static final String TAG_BOUGHT_CITIZENS = "bought_citizen"; + public static final String TAG_JUST_ATE = "justAte"; + public static final String TAG_EXPLOSIONS = "Explosions"; + public static final String TAG_FIREWORKS = "Fireworks"; + public static final String TAG_COLORS = "Colors"; + public static final String TAG_FLICKER = "Flicker"; + public static final String TAG_TRAIL = "Trail"; + public static final String TAG_TYPE = "Type"; + public static final String TAG_MERCENARY_TIME = "mercenaryUseTime"; + public static final String TAG_IDLE = "idle"; + public static final String TAG_CITIZENDATA_TYPE = "citizenDataType"; /** * Tag used to store the containers to NBT. @@ -126,8 +126,7 @@ public final class NbtTagConstants public static final String TAG_BUILDING_TYPE = "type"; /** - * The tag to store the building location. - * Location is unique (within a Colony) and so can double as the Id. + * The tag to store the building location. Location is unique (within a Colony) and so can double as the Id. */ public static final String TAG_LOCATION = "location"; @@ -389,8 +388,6 @@ public final class NbtTagConstants public static final String TAG_CHAT_OPTION = "chatoption"; public static final String TAG_CHAT_OPTIONS = "chatoptions"; - - /** * Tag of the colony. */ @@ -471,18 +468,18 @@ public final class NbtTagConstants /** * Crafter job tags. */ - public static final String TAG_PROGRESS = "progress"; - public static final String TAG_MAX_COUNTER = "maxCounter"; - public static final String TAG_CRAFT_COUNTER = "craftCounter"; + public static final String TAG_PROGRESS = "progress"; + public static final String TAG_MAX_COUNTER = "maxCounter"; + public static final String TAG_CRAFT_COUNTER = "craftCounter"; /** * Enchanter tags */ - public static final String TAG_GATHER_LIST = "buildingstogather"; - public static final String TAG_QUANTITY = "quantity"; - public static final String TAG_GATHERED_ALREADY = "gatheredalready"; + public static final String TAG_GATHER_LIST = "buildingstogather"; + public static final String TAG_QUANTITY = "quantity"; + public static final String TAG_GATHERED_ALREADY = "gatheredalready"; public static final String TAG_BUILDING_TO_DRAIN = "buildingtodrain"; - public static final String TAG_WAITING_TICKS = "waitingticks"; + public static final String TAG_WAITING_TICKS = "waitingticks"; /** * Beekeeper tags @@ -570,10 +567,10 @@ public final class NbtTagConstants /** * Final strings to save and retrieve the current water location and pond list. */ - public static final String TAG_WATER = "Pond"; - public static final String TAG_PONDS = "newPonds"; - public static final String TAG_WATER_POND = "waterpond"; - public static final String TAG_PARENT_POND = "parentpond"; + public static final String TAG_WATER = "Pond"; + public static final String TAG_PONDS = "newPonds"; + public static final String TAG_WATER_POND = "waterpond"; + public static final String TAG_PARENT_POND = "parentpond"; public static final String TAG_DECONSTRUCTED = "deconstructed"; /** diff --git a/src/api/java/com/minecolonies/api/util/constant/PathingConstants.java b/src/api/java/com/minecolonies/api/util/constant/PathingConstants.java old mode 100644 new mode 100755 index b51740ce040..80d9302f65a --- a/src/api/java/com/minecolonies/api/util/constant/PathingConstants.java +++ b/src/api/java/com/minecolonies/api/util/constant/PathingConstants.java @@ -8,18 +8,18 @@ public final class PathingConstants { // Debug Output - public static final int DEBUG_VERBOSITY_NONE = 0; - public static final int DEBUG_VERBOSITY_FULL = 2; - public static final Object debugNodeMonitor = new Object(); - public static final BlockPos BLOCKPOS_IDENTITY = new BlockPos(0, 0, 0); - public static final BlockPos BLOCKPOS_UP = new BlockPos(0, 1, 0); - public static final BlockPos BLOCKPOS_DOWN = new BlockPos(0, -1, 0); - public static final BlockPos BLOCKPOS_NORTH = new BlockPos(0, 0, -1); - public static final BlockPos BLOCKPOS_SOUTH = new BlockPos(0, 0, 1); - public static final BlockPos BLOCKPOS_EAST = new BlockPos(1, 0, 0); - public static final BlockPos BLOCKPOS_WEST = new BlockPos(-1, 0, 0); - public static final int MAX_Y = 256; - public static final int MIN_Y = 0; + public static final int DEBUG_VERBOSITY_NONE = 0; + public static final int DEBUG_VERBOSITY_FULL = 2; + public static final Object debugNodeMonitor = new Object(); + public static final BlockPos BLOCKPOS_IDENTITY = new BlockPos(0, 0, 0); + public static final BlockPos BLOCKPOS_UP = new BlockPos(0, 1, 0); + public static final BlockPos BLOCKPOS_DOWN = new BlockPos(0, -1, 0); + public static final BlockPos BLOCKPOS_NORTH = new BlockPos(0, 0, -1); + public static final BlockPos BLOCKPOS_SOUTH = new BlockPos(0, 0, 1); + public static final BlockPos BLOCKPOS_EAST = new BlockPos(1, 0, 0); + public static final BlockPos BLOCKPOS_WEST = new BlockPos(-1, 0, 0); + public static final int MAX_Y = 256; + public static final int MIN_Y = 0; /** * Distance which is considered to be on one side of the fence/glasspane/wall etc. @@ -39,7 +39,7 @@ public final class PathingConstants /** * Shift the y value by this to calculate the node key.. */ - public static final int SHIFT_Y_BY = 12; + public static final int SHIFT_Y_BY = 12; /** * Max jump height. @@ -49,7 +49,7 @@ public final class PathingConstants /** * Half a block. */ - public static final double HALF_A_BLOCK = 0.5; + public static final double HALF_A_BLOCK = 0.5; /** * Private constructor to hide implicit one. diff --git a/src/api/java/com/minecolonies/api/util/constant/RaiderConstants.java b/src/api/java/com/minecolonies/api/util/constant/RaiderConstants.java old mode 100644 new mode 100755 index 512062b1a7a..7661de6b377 --- a/src/api/java/com/minecolonies/api/util/constant/RaiderConstants.java +++ b/src/api/java/com/minecolonies/api/util/constant/RaiderConstants.java @@ -16,7 +16,7 @@ public final class RaiderConstants /** * The range for the barb to move away. */ - public static final int MOVE_AWAY_RANGE = 4; + public static final int MOVE_AWAY_RANGE = 4; public static final int BARBARIAN_HORDE_DIFFICULTY_FIVE = 5; @@ -81,8 +81,8 @@ public final class RaiderConstants /** * Other various values used for AI Tasks. */ - public static final double AI_MOVE_SPEED = 2.0D; - public static final float MAX_WATCH_DISTANCE = 8.0F; + public static final double AI_MOVE_SPEED = 2.0D; + public static final float MAX_WATCH_DISTANCE = 8.0F; /** * Values used for mob attributes. @@ -95,7 +95,6 @@ public final class RaiderConstants public static final double BARBARIAN_HEALTH_MULTIPLIER = 0.1; public static final double ATTACK_SPEED_DIVIDER = 3; - /** * Private constructor to hide implicit one. */ diff --git a/src/api/java/com/minecolonies/api/util/constant/StructureTagConstants.java b/src/api/java/com/minecolonies/api/util/constant/StructureTagConstants.java old mode 100644 new mode 100755 index 995e042d1db..c0383bafcac --- a/src/api/java/com/minecolonies/api/util/constant/StructureTagConstants.java +++ b/src/api/java/com/minecolonies/api/util/constant/StructureTagConstants.java @@ -10,5 +10,5 @@ public class StructureTagConstants */ public static final String NORMAL_RAIDER = "normal"; public static final String ARCHER_RAIDER = "archer"; - public static final String BOSS_RAIDER = "boss"; + public static final String BOSS_RAIDER = "boss"; } diff --git a/src/api/java/com/minecolonies/api/util/constant/Suppression.java b/src/api/java/com/minecolonies/api/util/constant/Suppression.java old mode 100644 new mode 100755 index 0d08e065545..1c80e54cd39 --- a/src/api/java/com/minecolonies/api/util/constant/Suppression.java +++ b/src/api/java/com/minecolonies/api/util/constant/Suppression.java @@ -133,8 +133,7 @@ public final class Suppression public static final String GENERIC_WILDCARD = "squid:S1452"; /** - * Sometimes we don't need to override the equals of subclasses. - * (Building IDS are unique enough for equals for example). + * Sometimes we don't need to override the equals of subclasses. (Building IDS are unique enough for equals for example). */ @NonNls public static final String OVERRIDE_EQUALS = "squid:S2160"; diff --git a/src/api/java/com/minecolonies/api/util/constant/ToolLevelConstants.java b/src/api/java/com/minecolonies/api/util/constant/ToolLevelConstants.java old mode 100644 new mode 100755 index 7ffa69430c0..b58dfd7047d --- a/src/api/java/com/minecolonies/api/util/constant/ToolLevelConstants.java +++ b/src/api/java/com/minecolonies/api/util/constant/ToolLevelConstants.java @@ -78,7 +78,7 @@ public final class ToolLevelConstants * Tool level for maximum. */ @NonNls - public static final int TOOL_LEVEL_MAXIMUM = Integer.SIZE; + public static final int TOOL_LEVEL_MAXIMUM = Integer.SIZE; private ToolLevelConstants() { diff --git a/src/api/java/com/minecolonies/api/util/constant/ToolType.java b/src/api/java/com/minecolonies/api/util/constant/ToolType.java old mode 100644 new mode 100755 index 14032166cc6..3a150cfd4ec --- a/src/api/java/com/minecolonies/api/util/constant/ToolType.java +++ b/src/api/java/com/minecolonies/api/util/constant/ToolType.java @@ -11,11 +11,8 @@ public enum ToolType implements IToolType { /** - * Note to future coders: You must add these to both: - * com.minecolonies.api.colony.requestsystem.requestable.Tool.getToolClasses - * and, - * com.minecolonies.api.util.ItemStackUtils.isTool - * to be usable by the RS system + * Note to future coders: You must add these to both: com.minecolonies.api.colony.requestsystem.requestable.Tool.getToolClasses and, + * com.minecolonies.api.util.ItemStackUtils.isTool to be usable by the RS system */ NONE("", false, new TranslationTextComponent(COM_MINECOLONIES_TOOLTYPE_NONE)), PICKAXE("pickaxe", true, new TranslationTextComponent(COM_MINECOLONIES_TOOLTYPE_PICKAXE)), @@ -44,6 +41,7 @@ public enum ToolType implements IToolType private final String name; private final boolean variableMaterials; private final ITextComponent displayName; + private ToolType(final String name, final boolean variableMaterials, final ITextComponent displayName) { this.name = name; diff --git a/src/api/java/com/minecolonies/api/util/constant/TranslationConstants.java b/src/api/java/com/minecolonies/api/util/constant/TranslationConstants.java old mode 100644 new mode 100755 index 5517c161449..e4da941cb73 --- a/src/api/java/com/minecolonies/api/util/constant/TranslationConstants.java +++ b/src/api/java/com/minecolonies/api/util/constant/TranslationConstants.java @@ -430,7 +430,6 @@ public final class TranslationConstants @NonNls public static final String ALL_CITIZENS_ARE_SLEEPING = "com.minecolonies.coremod.entity.citizen.sleep"; - private TranslationConstants() { //empty default diff --git a/src/api/java/com/minecolonies/api/util/constant/TypeConstants.java b/src/api/java/com/minecolonies/api/util/constant/TypeConstants.java old mode 100644 new mode 100755 index 35690130dbd..3c28797b49f --- a/src/api/java/com/minecolonies/api/util/constant/TypeConstants.java +++ b/src/api/java/com/minecolonies/api/util/constant/TypeConstants.java @@ -26,7 +26,7 @@ public class TypeConstants /////Java types public static final TypeToken INTEGER = TypeToken.of(Integer.class); public static final TypeToken> TYPETOKEN = TypeToken.of((Class>) (Class) TypeToken.class); - public static final TypeToken> CLASS = TypeToken.of((Class>) (Class) Class.class); + public static final TypeToken> CLASS = TypeToken.of((Class>) (Class) Class.class); /////General purpose public static final TypeToken> ITOKEN = TypeToken.of((Class>) (Class) IToken.class); diff --git a/src/api/java/com/minecolonies/api/util/constant/WindowConstants.java b/src/api/java/com/minecolonies/api/util/constant/WindowConstants.java old mode 100644 new mode 100755 index 854cf93d0d9..958b9d09e61 --- a/src/api/java/com/minecolonies/api/util/constant/WindowConstants.java +++ b/src/api/java/com/minecolonies/api/util/constant/WindowConstants.java @@ -118,7 +118,7 @@ public final class WindowConstants /** * Id of the toggle print progress button in the GUI. */ - public static final String BUTTON_TOGGLE_PRINT_PROGRESS= "togglePrintProgress"; + public static final String BUTTON_TOGGLE_PRINT_PROGRESS = "togglePrintProgress"; /** * Id of the remove player button in the GUI.. @@ -517,10 +517,9 @@ public final class WindowConstants public static final String STOCK_REMOVE = "removeStock"; public static final String QUANTITY_LABEL = "resourceQty"; - public static final String GUIDE_RESOURCE_SUFFIX = ":gui/windowhutguide.xml"; - public static final String GUIDE_CONFIRM = "confirm"; - public static final String GUIDE_CLOSE = "close"; - + public static final String GUIDE_RESOURCE_SUFFIX = ":gui/windowhutguide.xml"; + public static final String GUIDE_CONFIRM = "confirm"; + public static final String GUIDE_CLOSE = "close"; /** * Window resource list gui file. @@ -528,37 +527,37 @@ public final class WindowConstants public static final String RESOURCE_SCROLL_RESOURCE_SUFFIX = ":gui/windowresourcescroll.xml"; /** - * Window all Items list gui file. + * Window all Items list gui file. */ public static final String HUT_ALL_INVENTORY_SUFFIX = ":gui/windowhutallinventory.xml"; /** * No Sorting stage. how it comes from Database so it gets feeded */ - public static final int NO_SORT = 0; + public static final int NO_SORT = 0; /** * Name Ascending */ - public static final int ASC_SORT = 1; + public static final int ASC_SORT = 1; /** * Name Descending */ - public static final int DESC_SORT = 2; + public static final int DESC_SORT = 2; /** * Itemcount Ascending */ - public static final int COUNT_ASC_SORT = 3; + public static final int COUNT_ASC_SORT = 3; /** * Itemcount Descending */ - public static final int COUNT_DESC_SORT = 4; + public static final int COUNT_DESC_SORT = 4; /** * The Stringdefine for the GUI page */ - public static final String LIST_ALLINVENTORY = "allinventorylist"; + public static final String LIST_ALLINVENTORY = "allinventorylist"; /** - * The Sort Button + * The Sort Button */ - public static final String BUTTON_SORT = "sortStorageFilter"; + public static final String BUTTON_SORT = "sortStorageFilter"; /** * Window resource list gui file. @@ -635,12 +634,12 @@ public final class WindowConstants public static final String RED_ICON = "minecolonies:textures/gui/red_icon.png"; public static final String YELLOW_ICON = "minecolonies:textures/gui/yellow_icon.png"; public static final String GREEN_ICON = "minecolonies:textures/gui/green_icon.png"; - public static final String BLUE_ICON = "minecolonies:textures/gui/blue_icon.png"; + public static final String BLUE_ICON = "minecolonies:textures/gui/blue_icon.png"; - public static final String LABEL_CONSTRUCTION_NAME = "constructionName"; - public static final String LABEL_CONSTRUCTION_POS = "constructionPos"; - public static final String LABEL_PROGRESS = "progress"; - public static final String LABEL_WORKERNAME = "workerName"; + public static final String LABEL_CONSTRUCTION_NAME = "constructionName"; + public static final String LABEL_CONSTRUCTION_POS = "constructionPos"; + public static final String LABEL_PROGRESS = "progress"; + public static final String LABEL_WORKERNAME = "workerName"; public static final String LABEL_PAGE_NUMBER = "pageNum"; @@ -1001,7 +1000,7 @@ public final class WindowConstants */ public static final String INPUT_NAME = "name"; public static final String WINDOW_POSTBOX = ":gui/windowpostbox.xml"; - public static final String INPUT_QTY = "qty"; + public static final String INPUT_QTY = "qty"; public static final String BUTTON_REQUEST = "request"; /** @@ -1097,7 +1096,7 @@ public final class WindowConstants /** * Id of the direct placement button. */ - public static final String BUTTON_DIRECT = "direct"; + public static final String BUTTON_DIRECT = "direct"; /** * String of the suggest building GUI. @@ -1127,21 +1126,21 @@ public final class WindowConstants /** * WindowInteraction constants. */ - public static final int SLIGHTLY_BLUE = 100; - public static final int BUTTON_HEIGHT = 17; - public static final int BUTTON_LENGTH = 129; - public static final int BUTTON_BUFFER = 3; - public static final String RESPONSE_BOX_ID = "responseOptions"; + public static final int SLIGHTLY_BLUE = 100; + public static final int BUTTON_HEIGHT = 17; + public static final int BUTTON_LENGTH = 129; + public static final int BUTTON_BUFFER = 3; + public static final String RESPONSE_BOX_ID = "responseOptions"; public static final String MEDIUM_SIZED_BUTTON_RES = "textures/gui/builderhut/builder_button_medium_large.png"; /** * The resource string. */ - public static final String RESOURCE_STRING = ":gui/windowhutuniversity.xml"; - public static final String BRANCH_VIEW_ID = "pageBranches"; - public static final int INITITAL_X_OFFSET = 30; - public static final int INITITAL_Y_OFFSET = 60; - public static final int BUTTON_PADDING = 10; + public static final String RESOURCE_STRING = ":gui/windowhutuniversity.xml"; + public static final String BRANCH_VIEW_ID = "pageBranches"; + public static final int INITITAL_X_OFFSET = 30; + public static final int INITITAL_Y_OFFSET = 60; + public static final int BUTTON_PADDING = 10; /** * The job modifier page. diff --git a/src/main/generated/resources/assets/minecolonies/sounds.json b/src/main/generated/resources/assets/minecolonies/sounds.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/barrel_block.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/barrel_block.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockbarrackstowersubstitution.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockbarrackstowersubstitution.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockconstructiontape.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockconstructiontape.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutarchery.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutarchery.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutbaker.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutbaker.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutbarracks.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutbarracks.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutbarrackstower.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutbarrackstower.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutblacksmith.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutblacksmith.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutbuilder.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutbuilder.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutchickenherder.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutchickenherder.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutcitizen.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutcitizen.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutcombatacademy.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutcombatacademy.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutcomposter.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutcomposter.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutcook.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutcook.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutcowboy.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutcowboy.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutcrusher.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutcrusher.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutdeliveryman.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutdeliveryman.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutdyer.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutdyer.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutenchanter.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutenchanter.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutfarmer.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutfarmer.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutfield.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutfield.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutfisherman.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutfisherman.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutfletcher.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutfletcher.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutflorist.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutflorist.json new file mode 100644 index 00000000000..07da78ad7e0 --- /dev/null +++ b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutflorist.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecolonies:blockhutflorist", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutglassblower.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutglassblower.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutguardtower.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutguardtower.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhuthospital.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhuthospital.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutlibrary.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutlibrary.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutlumberjack.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutlumberjack.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutmechanic.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutmechanic.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutminer.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutminer.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutplantation.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutplantation.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutsawmill.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutsawmill.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutschool.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutschool.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutshepherd.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutshepherd.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutsifter.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutsifter.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutsmeltery.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutsmeltery.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutstonemason.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutstonemason.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutstonesmeltery.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutstonesmeltery.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutswineherder.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutswineherder.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhuttavern.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhuttavern.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhuttownhall.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhuttownhall.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutuniversity.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutuniversity.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutwarehouse.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockhutwarehouse.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockminecoloniesrack.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockminecoloniesrack.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockpostbox.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockpostbox.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockstash.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockstash.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockwaypoint.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/blockwaypoint.json old mode 100644 new mode 100755 diff --git a/src/main/generated/resources/data/minecolonies/loot_tables/blocks/decorationcontroller.json b/src/main/generated/resources/data/minecolonies/loot_tables/blocks/decorationcontroller.json old mode 100644 new mode 100755 diff --git a/src/main/java/com/minecolonies/apiimp/ClientMinecoloniesAPIImpl.java b/src/main/java/com/minecolonies/apiimp/ClientMinecoloniesAPIImpl.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/minecolonies/apiimp/CommonMinecoloniesAPIImpl.java b/src/main/java/com/minecolonies/apiimp/CommonMinecoloniesAPIImpl.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/minecolonies/apiimp/initializer/EntityInitializer.java b/src/main/java/com/minecolonies/apiimp/initializer/EntityInitializer.java old mode 100644 new mode 100755 index e8b492cd890..903d0fed270 --- a/src/main/java/com/minecolonies/apiimp/initializer/EntityInitializer.java +++ b/src/main/java/com/minecolonies/apiimp/initializer/EntityInitializer.java @@ -29,6 +29,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.registries.ObjectHolder; + import static com.minecolonies.api.util.constant.CitizenConstants.CITIZEN_HEIGHT; import static com.minecolonies.api.util.constant.CitizenConstants.CITIZEN_WIDTH; import static com.minecolonies.api.util.constant.Constants.*; @@ -40,128 +41,128 @@ public class EntityInitializer public static void setupEntities() { ModEntities.CITIZEN = build("citizen", - EntityType.Builder.create(EntityCitizen::new, EntityClassification.CREATURE) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT) - .setShouldReceiveVelocityUpdates(true)); + EntityType.Builder.create(EntityCitizen::new, EntityClassification.CREATURE) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT) + .setShouldReceiveVelocityUpdates(true)); ModEntities.FISHHOOK = build("fishhook", - EntityType.Builder. create(NewBobberEntity::new, EntityClassification.MISC) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY_FISHHOOK) - .size(0.25F, 0.25F) - .setShouldReceiveVelocityUpdates(true) - .setCustomClientFactory(NewBobberEntity::new)); + EntityType.Builder.create(NewBobberEntity::new, EntityClassification.MISC) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY_FISHHOOK) + .size(0.25F, 0.25F) + .setShouldReceiveVelocityUpdates(true) + .setCustomClientFactory(NewBobberEntity::new)); ModEntities.MERCENARY = build("mercenary", - EntityType.Builder.create(EntityMercenary::new, EntityClassification.CREATURE) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityMercenary::new, EntityClassification.CREATURE) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); ModEntities.BARBARIAN = build("barbarian", - EntityType.Builder.create(EntityBarbarian::new, EntityClassification.MONSTER) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityBarbarian::new, EntityClassification.MONSTER) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); ModEntities.ARCHERBARBARIAN = build("archerbarbarian", - EntityType.Builder.create(EntityArcherBarbarian::new, EntityClassification.MONSTER) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityArcherBarbarian::new, EntityClassification.MONSTER) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); ModEntities.CHIEFBARBARIAN = build("chiefbarbarian", - EntityType.Builder.create(EntityChiefBarbarian::new, EntityClassification.MONSTER) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityChiefBarbarian::new, EntityClassification.MONSTER) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); ModEntities.PIRATE = build("pirate", - EntityType.Builder.create(EntityPirate::new, EntityClassification.MONSTER) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityPirate::new, EntityClassification.MONSTER) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); ModEntities.ARCHERPIRATE = build("archerpirate", - EntityType.Builder.create(EntityArcherPirate::new, EntityClassification.MONSTER) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityArcherPirate::new, EntityClassification.MONSTER) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); ModEntities.CHIEFPIRATE = build("chiefpirate", - EntityType.Builder.create(EntityCaptainPirate::new, EntityClassification.MONSTER) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityCaptainPirate::new, EntityClassification.MONSTER) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); ModEntities.SITTINGENTITY = build("sittingentity", - EntityType.Builder. create(SittingEntity::new, EntityClassification.AMBIENT) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size(0F, 0.5F)); + EntityType.Builder.create(SittingEntity::new, EntityClassification.AMBIENT) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size(0F, 0.5F)); ModEntities.MINECART = build("mcminecart", - EntityType.Builder.create(MinecoloniesMinecart::new, EntityClassification.MISC) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size(0.98F, 0.7F)); + EntityType.Builder.create(MinecoloniesMinecart::new, EntityClassification.MISC) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size(0.98F, 0.7F)); ModEntities.MUMMY = build("mummy", - EntityType.Builder.create(EntityMummy::new, EntityClassification.MONSTER) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityMummy::new, EntityClassification.MONSTER) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); ModEntities.ARCHERMUMMY = build("archermummy", - EntityType.Builder.create(EntityArcherMummy::new, EntityClassification.MONSTER) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityArcherMummy::new, EntityClassification.MONSTER) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); ModEntities.PHARAO = build("pharao", - EntityType.Builder.create(EntityPharao::new, EntityClassification.MONSTER) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityPharao::new, EntityClassification.MONSTER) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); ModEntities.AMAZON = build("amazon", - EntityType.Builder.create(EntityArcherAmazon::new, EntityClassification.MONSTER) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityArcherAmazon::new, EntityClassification.MONSTER) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); ModEntities.AMAZONCHIEF = build("amazonchief", - EntityType.Builder.create(EntityAmazonChief::new, EntityClassification.MONSTER) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityAmazonChief::new, EntityClassification.MONSTER) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); ModEntities.FIREARROW = build("firearrow", - EntityType.Builder.create(FireArrowEntity::new, EntityClassification.MISC) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY_FISHHOOK) - .size(0.5F, 0.5F) - .setShouldReceiveVelocityUpdates(true)); - + EntityType.Builder.create(FireArrowEntity::new, EntityClassification.MISC) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY_FISHHOOK) + .size(0.5F, 0.5F) + .setShouldReceiveVelocityUpdates(true)); + ModEntities.SHIELDMAIDEN = build("shieldmaiden", - EntityType.Builder.create(EntityShieldmaiden::new, EntityClassification.MONSTER) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityShieldmaiden::new, EntityClassification.MONSTER) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); ModEntities.NORSEMEN_ARCHER = build("norsemenarcher", - EntityType.Builder.create(EntityNorsemenArcher::new, EntityClassification.MONSTER) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityNorsemenArcher::new, EntityClassification.MONSTER) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); ModEntities.NORSEMEN_CHIEF = build("norsemenchief", - EntityType.Builder.create(EntityNorsemenChief::new, EntityClassification.MONSTER) - .setTrackingRange(ENTITY_TRACKING_RANGE) - .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) - .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); + EntityType.Builder.create(EntityNorsemenChief::new, EntityClassification.MONSTER) + .setTrackingRange(ENTITY_TRACKING_RANGE) + .setUpdateInterval(ENTITY_UPDATE_FREQUENCY) + .size((float) CITIZEN_WIDTH, (float) CITIZEN_HEIGHT)); } private static EntityType build(final String key, final EntityType.Builder builder) diff --git a/src/main/java/com/minecolonies/apiimp/initializer/InteractionValidatorInitializer.java b/src/main/java/com/minecolonies/apiimp/initializer/InteractionValidatorInitializer.java old mode 100644 new mode 100755 index 86253d9d252..66d29082211 --- a/src/main/java/com/minecolonies/apiimp/initializer/InteractionValidatorInitializer.java +++ b/src/main/java/com/minecolonies/apiimp/initializer/InteractionValidatorInitializer.java @@ -47,16 +47,21 @@ public class InteractionValidatorInitializer public static void init() { InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(FURNACE_USER_NO_FUEL), - citizen -> citizen.getWorkBuilding() instanceof AbstractBuildingSmelterCrafter && ((AbstractBuildingSmelterCrafter) citizen.getWorkBuilding()).getCopyOfAllowedItems().isEmpty()); + citizen -> citizen.getWorkBuilding() instanceof AbstractBuildingSmelterCrafter && ((AbstractBuildingSmelterCrafter) citizen.getWorkBuilding()).getCopyOfAllowedItems() + .isEmpty()); InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(BAKER_HAS_NO_FURNACES_MESSAGE), citizen -> citizen.getWorkBuilding() instanceof AbstractBuildingSmelterCrafter && ((AbstractBuildingSmelterCrafter) citizen.getWorkBuilding()).getFurnaces().isEmpty()); InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(RAW_FOOD), - citizen -> InventoryUtils.findFirstSlotInItemHandlerNotEmptyWith(citizen.getInventory(), ISCOOKABLE) > 0 && InventoryUtils.findFirstSlotInItemHandlerNotEmptyWith(citizen.getInventory(), ISFOOD) == 0); + citizen -> InventoryUtils.findFirstSlotInItemHandlerNotEmptyWith(citizen.getInventory(), ISCOOKABLE) > 0 + && InventoryUtils.findFirstSlotInItemHandlerNotEmptyWith(citizen.getInventory(), ISFOOD) == 0); InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(NO_RESTAURANT), - citizen -> citizen.getColony() != null && citizen.getSaturation() <= LOW_SATURATION && citizen.getCitizenEntity().isPresent() && citizen.getColony().getBuildingManager().getBestRestaurant(citizen.getCitizenEntity().get()) == null && InventoryUtils.findFirstSlotInItemHandlerNotEmptyWith(citizen.getInventory(), ISFOOD) == 0); + citizen -> citizen.getColony() != null && citizen.getSaturation() <= LOW_SATURATION && citizen.getCitizenEntity().isPresent() + && citizen.getColony().getBuildingManager().getBestRestaurant(citizen.getCitizenEntity().get()) == null + && InventoryUtils.findFirstSlotInItemHandlerNotEmptyWith(citizen.getInventory(), ISFOOD) == 0); InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(NO_HOSPITAL), - citizen -> citizen.getColony() != null && citizen.getCitizenEntity().isPresent() && citizen.getCitizenEntity().get().getCitizenDiseaseHandler().isSick() && citizen.getColony().getBuildingManager().getBestHospital(citizen.getCitizenEntity().get()) == null ); + citizen -> citizen.getColony() != null && citizen.getCitizenEntity().isPresent() && citizen.getCitizenEntity().get().getCitizenDiseaseHandler().isSick() + && citizen.getColony().getBuildingManager().getBestHospital(citizen.getCitizenEntity().get()) == null); InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(WAITING_FOR_CURE), citizen -> citizen.getColony() != null && citizen.getCitizenEntity().isPresent() && !citizen.getCitizenEntity().get().getCitizenDiseaseHandler().getDisease().isEmpty()); @@ -123,7 +128,8 @@ public static void init() InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(BAKER_HAS_NO_RECIPES), citizen -> citizen.getWorkBuilding() instanceof BuildingBaker && ((BuildingBaker) citizen.getWorkBuilding()).getCopyOfAllowedItems().isEmpty()); - InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(COM_MINECOLONIES_COREMOD_ENTITY_WORKER_INVENTORYFULLCHEST), citizen -> citizen.getWorkBuilding() != null && InventoryUtils.isProviderFull(citizen.getWorkBuilding())); + InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(COM_MINECOLONIES_COREMOD_ENTITY_WORKER_INVENTORYFULLCHEST), + citizen -> citizen.getWorkBuilding() != null && InventoryUtils.isProviderFull(citizen.getWorkBuilding())); InteractionValidatorRegistry.registerPosBasedPredicate( new TranslationTextComponent(BUILDING_LEVEL_TOO_LOW), (citizen, pos) -> { @@ -131,10 +137,10 @@ public static void init() if (workBuilding != null) { final IColony colony = citizen.getColony(); - if ( colony != null ) + if (colony != null) { final World world = colony.getWorld(); - if ( world != null ) + if (world != null) { return workBuilding.getMaxToolLevel() < WorkerUtil.getCorrectHavestLevelForBlock(world.getBlockState(pos).getBlock()); } @@ -148,7 +154,8 @@ public static void init() final IColony colony = citizen.getColony(); if (colony != null) { - final IRequestResolver resolver = citizen.getColony().getRequestManager().getRequestForToken(token) == null ? null : citizen.getColony().getRequestManager().getResolverForRequest(token); + final IRequestResolver resolver = + citizen.getColony().getRequestManager().getRequestForToken(token) == null ? null : citizen.getColony().getRequestManager().getResolverForRequest(token); return resolver instanceof IPlayerRequestResolver || resolver instanceof IRetryingRequestResolver; } return false; @@ -158,10 +165,13 @@ public static void init() citizen -> citizen.getWorkBuilding() instanceof BuildingSmeltery && IColonyManager.getInstance().getCompatibilityManager() .getSmeltableOres() .stream() - .anyMatch(storage -> !((BuildingSmeltery) citizen.getWorkBuilding()).getCopyOfAllowedItems().getOrDefault(ORE_LIST, new ArrayList<>()).contains(storage))); + .anyMatch(storage -> !((BuildingSmeltery) citizen.getWorkBuilding()).getCopyOfAllowedItems() + .getOrDefault(ORE_LIST, new ArrayList<>()) + .contains(storage))); InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(PATIENT_FULL_INVENTORY), - citizen -> citizen.getCitizenEntity().isPresent() && citizen.getCitizenEntity().get().getCitizenDiseaseHandler().isSick() && InventoryUtils.isItemHandlerFull(citizen.getCitizenEntity().get().getInventoryCitizen())); + citizen -> citizen.getCitizenEntity().isPresent() && citizen.getCitizenEntity().get().getCitizenDiseaseHandler().isSick() + && InventoryUtils.isItemHandlerFull(citizen.getCitizenEntity().get().getInventoryCitizen())); InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(PUPIL_NO_CARPET), citizen -> citizen.getCitizenEntity().isPresent() && citizen.isChild() && citizen.getWorkBuilding() instanceof BuildingSchool @@ -195,7 +205,8 @@ public static void init() final IBuildingWorker buildingFlorist = citizen.getWorkBuilding(); if (buildingFlorist instanceof BuildingFlorist && buildingFlorist.getColony().getWorld() != null) { - return InventoryUtils.getItemCountInItemHandler(citizen.getInventory(), IS_COMPOST) == 0 && !isThereCompostedLand((BuildingFlorist) buildingFlorist, buildingFlorist.getColony().getWorld()); + return InventoryUtils.getItemCountInItemHandler(citizen.getInventory(), IS_COMPOST) == 0 && !isThereCompostedLand((BuildingFlorist) buildingFlorist, + buildingFlorist.getColony().getWorld()); } return false; }); @@ -207,32 +218,34 @@ public static void init() final AbstractBuilding buildingMiner = (AbstractBuilding) citizen.getWorkBuilding(); if (buildingMiner instanceof BuildingMiner && citizen.getColony() != null && citizen.getColony().getWorld() != null) { - return getLastLadder(((BuildingMiner) buildingMiner).getLadderLocation(), citizen.getColony().getWorld()) < ((BuildingMiner) buildingMiner).getDepthLimit() && ((BuildingMiner) buildingMiner).getNumberOfLevels() == 0; + return getLastLadder(((BuildingMiner) buildingMiner).getLadderLocation(), citizen.getColony().getWorld()) < ((BuildingMiner) buildingMiner).getDepthLimit() + && ((BuildingMiner) buildingMiner).getNumberOfLevels() == 0; } return false; }); - InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(WORKER_AI_EXCEPTION), citizen -> citizen.getJob() != null && ((AbstractEntityAIBasic) citizen.getJob().getWorkerAI()).getExceptionTimer() > 1); + InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(WORKER_AI_EXCEPTION), + citizen -> citizen.getJob() != null && ((AbstractEntityAIBasic) citizen.getJob().getWorkerAI()).getExceptionTimer() > 1); InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(DEMANDS + HOMELESSNESS), - citizen -> ( citizen.getCitizenHappinessHandler()).getModifier(HOMELESSNESS).getDays() > DEMANDS_DAYS_WITHOUT_HOUSE && citizen.getHomeBuilding() == null); + citizen -> (citizen.getCitizenHappinessHandler()).getModifier(HOMELESSNESS).getDays() > DEMANDS_DAYS_WITHOUT_HOUSE && citizen.getHomeBuilding() == null); InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(NO + HOMELESSNESS), - citizen -> ( citizen.getCitizenHappinessHandler()).getModifier(HOMELESSNESS).getDays() > COMPLAIN_DAYS_WITHOUT_HOUSE - && ( citizen.getCitizenHappinessHandler()).getModifier(HOMELESSNESS).getDays() <= DEMANDS_DAYS_WITHOUT_HOUSE && citizen.getHomeBuilding() == null); + citizen -> (citizen.getCitizenHappinessHandler()).getModifier(HOMELESSNESS).getDays() > COMPLAIN_DAYS_WITHOUT_HOUSE + && (citizen.getCitizenHappinessHandler()).getModifier(HOMELESSNESS).getDays() <= DEMANDS_DAYS_WITHOUT_HOUSE && citizen.getHomeBuilding() == null); InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(DEMANDS + UNEMPLOYMENT), - citizen -> ( citizen.getCitizenHappinessHandler()).getModifier(UNEMPLOYMENT).getDays() > DEMANDS_DAYS_WITHOUT_JOB && citizen.getJob() == null); + citizen -> (citizen.getCitizenHappinessHandler()).getModifier(UNEMPLOYMENT).getDays() > DEMANDS_DAYS_WITHOUT_JOB && citizen.getJob() == null); InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(NO + UNEMPLOYMENT), - citizen -> ( citizen.getCitizenHappinessHandler()).getModifier(UNEMPLOYMENT).getDays() > COMPLAIN_DAYS_WITHOUT_JOB - && ( citizen.getCitizenHappinessHandler()).getModifier(UNEMPLOYMENT).getDays() <= DEMANDS_DAYS_WITHOUT_JOB && citizen.getJob() == null); + citizen -> (citizen.getCitizenHappinessHandler()).getModifier(UNEMPLOYMENT).getDays() > COMPLAIN_DAYS_WITHOUT_JOB + && (citizen.getCitizenHappinessHandler()).getModifier(UNEMPLOYMENT).getDays() <= DEMANDS_DAYS_WITHOUT_JOB && citizen.getJob() == null); InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(DEMANDS + IDLEATJOB), - citizen -> ( citizen.getCitizenHappinessHandler()).getModifier(IDLEATJOB).getDays() > IDLE_AT_JOB_DEMANDS_DAYS); + citizen -> (citizen.getCitizenHappinessHandler()).getModifier(IDLEATJOB).getDays() > IDLE_AT_JOB_DEMANDS_DAYS); InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(NO + IDLEATJOB), citizen -> citizen.getCitizenHappinessHandler().getModifier(IDLEATJOB).getDays() > IDLE_AT_JOB_COMPLAINS_DAYS && citizen.getCitizenHappinessHandler().getModifier(IDLEATJOB).getDays() <= IDLE_AT_JOB_DEMANDS_DAYS); InteractionValidatorRegistry.registerStandardPredicate(new TranslationTextComponent(NO + SLEPTTONIGHT), - citizen -> !(citizen.getJob() instanceof AbstractJobGuard) && citizen.getCitizenHappinessHandler().getModifier(SLEPTTONIGHT).getDays() <= 0); - } + citizen -> !(citizen.getJob() instanceof AbstractJobGuard) && citizen.getCitizenHappinessHandler().getModifier(SLEPTTONIGHT).getDays() <= 0); + } } diff --git a/src/main/java/com/minecolonies/apiimp/initializer/ModBlocksInitializer.java b/src/main/java/com/minecolonies/apiimp/initializer/ModBlocksInitializer.java old mode 100644 new mode 100755 index 0d43cf9189c..242a4b89f80 --- a/src/main/java/com/minecolonies/apiimp/initializer/ModBlocksInitializer.java +++ b/src/main/java/com/minecolonies/apiimp/initializer/ModBlocksInitializer.java @@ -110,7 +110,7 @@ public static void registerItems(RegistryEvent.Register event) public static void registerBlockItem(final IForgeRegistry registry) { final Item.Properties properties = new Item.Properties().group(ModCreativeTabs.MINECOLONIES); - + ModBlocks.blockHutBaker.registerBlockItem(registry, properties); ModBlocks.blockHutBlacksmith.registerBlockItem(registry, properties); ModBlocks.blockHutBuilder.registerBlockItem(registry, properties); diff --git a/src/main/java/com/minecolonies/apiimp/initializer/ModBuildingsInitializer.java b/src/main/java/com/minecolonies/apiimp/initializer/ModBuildingsInitializer.java old mode 100644 new mode 100755 index 7dc1c6282d0..29f30f68ed7 --- a/src/main/java/com/minecolonies/apiimp/initializer/ModBuildingsInitializer.java +++ b/src/main/java/com/minecolonies/apiimp/initializer/ModBuildingsInitializer.java @@ -290,11 +290,11 @@ public static void init(final RegistryEvent.Register event) .createBuildingEntry(); ModBuildings.fletcher = new BuildingEntry.Builder() - .setBuildingBlock(ModBlocks.blockHutFletcher) - .setBuildingProducer(BuildingFletcher::new) - .setBuildingViewProducer(() -> BuildingFletcher.View::new) - .setRegistryName(new ResourceLocation(Constants.MOD_ID, ModBuildings.FLETCHER_ID)) - .createBuildingEntry(); + .setBuildingBlock(ModBlocks.blockHutFletcher) + .setBuildingProducer(BuildingFletcher::new) + .setBuildingViewProducer(() -> BuildingFletcher.View::new) + .setRegistryName(new ResourceLocation(Constants.MOD_ID, ModBuildings.FLETCHER_ID)) + .createBuildingEntry(); ModBuildings.tavern = new BuildingEntry.Builder() .setBuildingBlock(ModBlocks.blockHutTavern) @@ -311,32 +311,32 @@ public static void init(final RegistryEvent.Register event) .createBuildingEntry(); ModBuildings.plantation = new BuildingEntry.Builder() - .setBuildingBlock(ModBlocks.blockHutPlantation) - .setBuildingProducer(BuildingPlantation::new) - .setBuildingViewProducer(() -> BuildingPlantation.View::new) - .setRegistryName(new ResourceLocation(Constants.MOD_ID, ModBuildings.PLANTATION_ID)) - .createBuildingEntry(); + .setBuildingBlock(ModBlocks.blockHutPlantation) + .setBuildingProducer(BuildingPlantation::new) + .setBuildingViewProducer(() -> BuildingPlantation.View::new) + .setRegistryName(new ResourceLocation(Constants.MOD_ID, ModBuildings.PLANTATION_ID)) + .createBuildingEntry(); ModBuildings.rabbitHutch = new BuildingEntry.Builder() - .setBuildingBlock(ModBlocks.blockHutRabbitHutch) - .setBuildingProducer(BuildingRabbitHutch::new) - .setBuildingViewProducer(() -> BuildingRabbitHutch.View::new) - .setRegistryName(new ResourceLocation(Constants.MOD_ID, ModBuildings.RABBIT_ID)) - .createBuildingEntry(); + .setBuildingBlock(ModBlocks.blockHutRabbitHutch) + .setBuildingProducer(BuildingRabbitHutch::new) + .setBuildingViewProducer(() -> BuildingRabbitHutch.View::new) + .setRegistryName(new ResourceLocation(Constants.MOD_ID, ModBuildings.RABBIT_ID)) + .createBuildingEntry(); ModBuildings.concreteMixer = new BuildingEntry.Builder() - .setBuildingBlock(ModBlocks.blockHutConcreteMixer) - .setBuildingProducer(BuildingConcreteMixer::new) - .setBuildingViewProducer(() -> BuildingConcreteMixer.View::new) - .setRegistryName(new ResourceLocation(Constants.MOD_ID, ModBuildings.CONCRETE_ID)) - .createBuildingEntry(); + .setBuildingBlock(ModBlocks.blockHutConcreteMixer) + .setBuildingProducer(BuildingConcreteMixer::new) + .setBuildingViewProducer(() -> BuildingConcreteMixer.View::new) + .setRegistryName(new ResourceLocation(Constants.MOD_ID, ModBuildings.CONCRETE_ID)) + .createBuildingEntry(); ModBuildings.beekeeper = new BuildingEntry.Builder() - .setBuildingBlock(ModBlocks.blockHutBeekeeper) - .setBuildingProducer(BuildingBeekeeper::new) - .setBuildingViewProducer(() -> BuildingBeekeeper.View::new) - .setRegistryName(new ResourceLocation(Constants.MOD_ID, ModBuildings.BEEKEEPER_ID)) - .createBuildingEntry(); + .setBuildingBlock(ModBlocks.blockHutBeekeeper) + .setBuildingProducer(BuildingBeekeeper::new) + .setBuildingViewProducer(() -> BuildingBeekeeper.View::new) + .setRegistryName(new ResourceLocation(Constants.MOD_ID, ModBuildings.BEEKEEPER_ID)) + .createBuildingEntry(); reg.register(ModBuildings.archery); reg.register(ModBuildings.bakery); diff --git a/src/main/java/com/minecolonies/apiimp/initializer/ModColonyEventTypeInitializer.java b/src/main/java/com/minecolonies/apiimp/initializer/ModColonyEventTypeInitializer.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/minecolonies/apiimp/initializer/ModContainerInitializers.java b/src/main/java/com/minecolonies/apiimp/initializer/ModContainerInitializers.java old mode 100644 new mode 100755 index 994c7b881cb..ce54eb51976 --- a/src/main/java/com/minecolonies/apiimp/initializer/ModContainerInitializers.java +++ b/src/main/java/com/minecolonies/apiimp/initializer/ModContainerInitializers.java @@ -20,12 +20,13 @@ public static void registerContainers(final RegistryEvent.Register) IForgeContainerType.create(ContainerCraftingFurnace::new).setRegistryName("crafting_furnace"); ModContainers.buildingInv = (ContainerType) IForgeContainerType.create(ContainerBuildingInventory::new).setRegistryName("bulding_inv"); - ModContainers.citizenInv = (ContainerType) IForgeContainerType.create(ContainerCitizenInventory::new).setRegistryName("citizen_inv"); + ModContainers.citizenInv = (ContainerType) IForgeContainerType.create(ContainerCitizenInventory::new).setRegistryName("citizen_inv"); ModContainers.rackInv = (ContainerType) IForgeContainerType.create(ContainerRack::new).setRegistryName("rack_inv"); ModContainers.craftingGrid = (ContainerType) IForgeContainerType.create(ContainerCrafting::new).setRegistryName("crafting_building"); ModContainers.field = (ContainerType) IForgeContainerType.create(ContainerField::new).setRegistryName("field"); - event.getRegistry().registerAll(ModContainers.craftingFurnace, ModContainers.buildingInv, ModContainers.citizenInv, ModContainers.rackInv, ModContainers.craftingGrid, ModContainers.field); + event.getRegistry() + .registerAll(ModContainers.craftingFurnace, ModContainers.buildingInv, ModContainers.citizenInv, ModContainers.rackInv, ModContainers.craftingGrid, ModContainers.field); } @SubscribeEvent diff --git a/src/main/java/com/minecolonies/apiimp/initializer/ModGuardTypesInitializer.java b/src/main/java/com/minecolonies/apiimp/initializer/ModGuardTypesInitializer.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/minecolonies/apiimp/initializer/ModInteractionsInitializer.java b/src/main/java/com/minecolonies/apiimp/initializer/ModInteractionsInitializer.java old mode 100644 new mode 100755 index eff333cf5c5..3ce2d6b433d --- a/src/main/java/com/minecolonies/apiimp/initializer/ModInteractionsInitializer.java +++ b/src/main/java/com/minecolonies/apiimp/initializer/ModInteractionsInitializer.java @@ -21,19 +21,19 @@ public static void init(final RegistryEvent.Register reg = event.getRegistry(); ModInteractionResponseHandlers.standard = new InteractionResponseHandlerEntry.Builder() - .setResponseHandlerProducer(StandardInteractionResponseHandler::new) - .setRegistryName(ModInteractionResponseHandlers.STANDARD) - .createEntry(); + .setResponseHandlerProducer(StandardInteractionResponseHandler::new) + .setRegistryName(ModInteractionResponseHandlers.STANDARD) + .createEntry(); ModInteractionResponseHandlers.pos = new InteractionResponseHandlerEntry.Builder() - .setResponseHandlerProducer(PosBasedInteractionResponseHandler::new) - .setRegistryName(ModInteractionResponseHandlers.POS) - .createEntry(); + .setResponseHandlerProducer(PosBasedInteractionResponseHandler::new) + .setRegistryName(ModInteractionResponseHandlers.POS) + .createEntry(); ModInteractionResponseHandlers.request = new InteractionResponseHandlerEntry.Builder() - .setResponseHandlerProducer(RequestBasedInteractionResponseHandler::new) - .setRegistryName(ModInteractionResponseHandlers.REQUEST) - .createEntry(); + .setResponseHandlerProducer(RequestBasedInteractionResponseHandler::new) + .setRegistryName(ModInteractionResponseHandlers.REQUEST) + .createEntry(); reg.register(ModInteractionResponseHandlers.standard); reg.register(ModInteractionResponseHandlers.pos); diff --git a/src/main/java/com/minecolonies/apiimp/initializer/ModItemsInitializer.java b/src/main/java/com/minecolonies/apiimp/initializer/ModItemsInitializer.java old mode 100644 new mode 100755 index 5a13976bb4b..1e27ee13252 --- a/src/main/java/com/minecolonies/apiimp/initializer/ModItemsInitializer.java +++ b/src/main/java/com/minecolonies/apiimp/initializer/ModItemsInitializer.java @@ -23,12 +23,12 @@ public final class ModItemsInitializer */ private static final int PRIMARY_COLOR_BARBARIAN = 5; private static final int SECONDARY_COLOR_BARBARIAN = 700; - private static final int PRIMARY_COLOR_PIRATE = 7; - private static final int SECONDARY_COLOR_PIRATE = 600; - private static final int PRIMARY_COLOR_MERC = 8; - private static final int SECONDARY_COLOR_MERC = 300; - private static final int PRIMARY_COLOR_EG = 10; - private static final int SECONDARY_COLOR_EG = 400; + private static final int PRIMARY_COLOR_PIRATE = 7; + private static final int SECONDARY_COLOR_PIRATE = 600; + private static final int PRIMARY_COLOR_MERC = 8; + private static final int SECONDARY_COLOR_MERC = 300; + private static final int PRIMARY_COLOR_EG = 10; + private static final int SECONDARY_COLOR_EG = 400; private ModItemsInitializer() { @@ -41,9 +41,9 @@ public static void registerItems(RegistryEvent.Register event) ModItemsInitializer.init(event.getRegistry()); } - /** * Initates all the blocks. At the correct time. + * * @param registry the registry. */ @SuppressWarnings("PMD.ExcessiveMethodLength") @@ -70,7 +70,7 @@ public static void init(final IForgeRegistry registry) ModItems.santaHat = new ItemSantaHead("santa_hat", ModCreativeTabs.MINECOLONIES, ItemSantaHead.SANTA_HAT, EquipmentSlotType.HEAD, new Item.Properties()); ModItems.pirateHelmet_1 = new ItemPirateGear("pirate_hat", ModCreativeTabs.MINECOLONIES, ItemPirateGear.PIRATE_ARMOR_1, EquipmentSlotType.HEAD, new Item.Properties()); - ModItems.pirateChest_1 = new ItemPirateGear("pirate_top", ModCreativeTabs.MINECOLONIES, ItemPirateGear.PIRATE_ARMOR_1, EquipmentSlotType.CHEST, new Item.Properties()); + ModItems.pirateChest_1 = new ItemPirateGear("pirate_top", ModCreativeTabs.MINECOLONIES, ItemPirateGear.PIRATE_ARMOR_1, EquipmentSlotType.CHEST, new Item.Properties()); ModItems.pirateLegs_1 = new ItemPirateGear("pirate_leggins", ModCreativeTabs.MINECOLONIES, ItemPirateGear.PIRATE_ARMOR_1, EquipmentSlotType.LEGS, new Item.Properties()); ModItems.pirateBoots_1 = new ItemPirateGear("pirate_boots", ModCreativeTabs.MINECOLONIES, ItemPirateGear.PIRATE_ARMOR_1, EquipmentSlotType.FEET, new Item.Properties()); @@ -107,25 +107,64 @@ public static void init(final IForgeRegistry registry) registry.register(ModItems.santaHat); - registry.register(new SpawnEggItem(ModEntities.BARBARIAN, PRIMARY_COLOR_BARBARIAN, SECONDARY_COLOR_BARBARIAN, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("barbarianegg")); - registry.register(new SpawnEggItem(ModEntities.ARCHERBARBARIAN, PRIMARY_COLOR_BARBARIAN, SECONDARY_COLOR_BARBARIAN, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("barbarcheregg")); - registry.register(new SpawnEggItem(ModEntities.CHIEFBARBARIAN, PRIMARY_COLOR_BARBARIAN, SECONDARY_COLOR_BARBARIAN, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("barbchiefegg")); - - registry.register(new SpawnEggItem(ModEntities.PIRATE, PRIMARY_COLOR_PIRATE, SECONDARY_COLOR_PIRATE, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("pirateegg")); - registry.register(new SpawnEggItem(ModEntities.ARCHERPIRATE, PRIMARY_COLOR_PIRATE, SECONDARY_COLOR_PIRATE, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("piratearcheregg")); - registry.register(new SpawnEggItem(ModEntities.CHIEFPIRATE, PRIMARY_COLOR_PIRATE, SECONDARY_COLOR_PIRATE, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("piratecaptainegg")); - - registry.register(new SpawnEggItem(ModEntities.MUMMY, PRIMARY_COLOR_EG, SECONDARY_COLOR_EG, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("mummyegg")); - registry.register(new SpawnEggItem(ModEntities.ARCHERMUMMY, PRIMARY_COLOR_EG, SECONDARY_COLOR_EG, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("mummyarcheregg")); - registry.register(new SpawnEggItem(ModEntities.PHARAO, PRIMARY_COLOR_EG, SECONDARY_COLOR_EG, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("pharaoegg")); - - registry.register(new SpawnEggItem(ModEntities.SHIELDMAIDEN, PRIMARY_COLOR_EG, SECONDARY_COLOR_EG, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("shieldmaidenegg")); - registry.register(new SpawnEggItem(ModEntities.NORSEMEN_ARCHER, PRIMARY_COLOR_EG, SECONDARY_COLOR_EG, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("norsemenarcheregg")); - registry.register(new SpawnEggItem(ModEntities.NORSEMEN_CHIEF, PRIMARY_COLOR_EG, SECONDARY_COLOR_EG, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("norsemenchiefegg")); - - registry.register(new SpawnEggItem(ModEntities.AMAZON, PRIMARY_COLOR_EG, SECONDARY_COLOR_EG, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("amazonegg")); - registry.register(new SpawnEggItem(ModEntities.AMAZONCHIEF, PRIMARY_COLOR_EG, SECONDARY_COLOR_EG, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("amazonchiefegg")); - - registry.register(new SpawnEggItem(ModEntities.MERCENARY, PRIMARY_COLOR_MERC, SECONDARY_COLOR_MERC, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("mercegg")); + registry.register(new SpawnEggItem(ModEntities.BARBARIAN, + PRIMARY_COLOR_BARBARIAN, + SECONDARY_COLOR_BARBARIAN, + (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("barbarianegg")); + registry.register(new SpawnEggItem(ModEntities.ARCHERBARBARIAN, + PRIMARY_COLOR_BARBARIAN, + SECONDARY_COLOR_BARBARIAN, + (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("barbarcheregg")); + registry.register(new SpawnEggItem(ModEntities.CHIEFBARBARIAN, + PRIMARY_COLOR_BARBARIAN, + SECONDARY_COLOR_BARBARIAN, + (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("barbchiefegg")); + + registry.register(new SpawnEggItem(ModEntities.PIRATE, + PRIMARY_COLOR_PIRATE, + SECONDARY_COLOR_PIRATE, + (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("pirateegg")); + registry.register(new SpawnEggItem(ModEntities.ARCHERPIRATE, + PRIMARY_COLOR_PIRATE, + SECONDARY_COLOR_PIRATE, + (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("piratearcheregg")); + registry.register(new SpawnEggItem(ModEntities.CHIEFPIRATE, + PRIMARY_COLOR_PIRATE, + SECONDARY_COLOR_PIRATE, + (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("piratecaptainegg")); + + registry.register(new SpawnEggItem(ModEntities.MUMMY, PRIMARY_COLOR_EG, SECONDARY_COLOR_EG, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName( + "mummyegg")); + registry.register(new SpawnEggItem(ModEntities.ARCHERMUMMY, + PRIMARY_COLOR_EG, + SECONDARY_COLOR_EG, + (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("mummyarcheregg")); + registry.register(new SpawnEggItem(ModEntities.PHARAO, PRIMARY_COLOR_EG, SECONDARY_COLOR_EG, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName( + "pharaoegg")); + + registry.register(new SpawnEggItem(ModEntities.SHIELDMAIDEN, + PRIMARY_COLOR_EG, + SECONDARY_COLOR_EG, + (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("shieldmaidenegg")); + registry.register(new SpawnEggItem(ModEntities.NORSEMEN_ARCHER, + PRIMARY_COLOR_EG, + SECONDARY_COLOR_EG, + (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("norsemenarcheregg")); + registry.register(new SpawnEggItem(ModEntities.NORSEMEN_CHIEF, + PRIMARY_COLOR_EG, + SECONDARY_COLOR_EG, + (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("norsemenchiefegg")); + + registry.register(new SpawnEggItem(ModEntities.AMAZON, PRIMARY_COLOR_EG, SECONDARY_COLOR_EG, (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName( + "amazonegg")); + registry.register(new SpawnEggItem(ModEntities.AMAZONCHIEF, + PRIMARY_COLOR_EG, + SECONDARY_COLOR_EG, + (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("amazonchiefegg")); + + registry.register(new SpawnEggItem(ModEntities.MERCENARY, + PRIMARY_COLOR_MERC, + SECONDARY_COLOR_MERC, + (new Item.Properties()).group(ModCreativeTabs.MINECOLONIES)).setRegistryName("mercegg")); } } diff --git a/src/main/java/com/minecolonies/apiimp/initializer/ModJobsInitializer.java b/src/main/java/com/minecolonies/apiimp/initializer/ModJobsInitializer.java old mode 100644 new mode 100755 index 069d8f440bd..c690933b33a --- a/src/main/java/com/minecolonies/apiimp/initializer/ModJobsInitializer.java +++ b/src/main/java/com/minecolonies/apiimp/initializer/ModJobsInitializer.java @@ -150,74 +150,74 @@ public static void init(final RegistryEvent.Register event) .createJobEntry(); ModJobs.florist = new JobEntry.Builder() - .setJobProducer(JobFlorist::new) - .setRegistryName(ModJobs.FLORIST_ID) - .createJobEntry(); - - ModJobs.enchanter = new JobEntry.Builder() - .setJobProducer(JobEnchanter::new) - .setRegistryName(ModJobs.ENCHANTER_ID) + .setJobProducer(JobFlorist::new) + .setRegistryName(ModJobs.FLORIST_ID) .createJobEntry(); - ModJobs.researcher = new JobEntry.Builder() - .setJobProducer(JobResearch::new) - .setRegistryName(ModJobs.RESEARCHER_ID) + ModJobs.enchanter = new JobEntry.Builder() + .setJobProducer(JobEnchanter::new) + .setRegistryName(ModJobs.ENCHANTER_ID) .createJobEntry(); - ModJobs.healer = new JobEntry.Builder() - .setJobProducer(JobHealer::new) - .setRegistryName(ModJobs.HEALER_ID) + ModJobs.researcher = new JobEntry.Builder() + .setJobProducer(JobResearch::new) + .setRegistryName(ModJobs.RESEARCHER_ID) .createJobEntry(); - ModJobs.pupil = new JobEntry.Builder() - .setJobProducer(JobPupil::new) - .setRegistryName(ModJobs.PUPIL_ID) - .createJobEntry(); + ModJobs.healer = new JobEntry.Builder() + .setJobProducer(JobHealer::new) + .setRegistryName(ModJobs.HEALER_ID) + .createJobEntry(); - ModJobs.teacher = new JobEntry.Builder() - .setJobProducer(JobTeacher::new) - .setRegistryName(ModJobs.TEACHER_ID) - .createJobEntry(); + ModJobs.pupil = new JobEntry.Builder() + .setJobProducer(JobPupil::new) + .setRegistryName(ModJobs.PUPIL_ID) + .createJobEntry(); + + ModJobs.teacher = new JobEntry.Builder() + .setJobProducer(JobTeacher::new) + .setRegistryName(ModJobs.TEACHER_ID) + .createJobEntry(); - ModJobs.glassblower = new JobEntry.Builder() + ModJobs.glassblower = new JobEntry.Builder() .setJobProducer(JobGlassblower::new) .setRegistryName(ModJobs.GLASSBLOWER_ID) .createJobEntry(); - ModJobs.dyer = new JobEntry.Builder() - .setJobProducer(JobDyer::new) - .setRegistryName(ModJobs.DYER_ID) - .createJobEntry(); + ModJobs.dyer = new JobEntry.Builder() + .setJobProducer(JobDyer::new) + .setRegistryName(ModJobs.DYER_ID) + .createJobEntry(); - ModJobs.fletcher = new JobEntry.Builder() - .setJobProducer(JobFletcher::new) - .setRegistryName(ModJobs.FLETCHER_ID) - .createJobEntry(); + ModJobs.fletcher = new JobEntry.Builder() + .setJobProducer(JobFletcher::new) + .setRegistryName(ModJobs.FLETCHER_ID) + .createJobEntry(); - ModJobs.mechanic = new JobEntry.Builder() - .setJobProducer(JobMechanic::new) - .setRegistryName(ModJobs.MECHANIC_ID) - .createJobEntry(); + ModJobs.mechanic = new JobEntry.Builder() + .setJobProducer(JobMechanic::new) + .setRegistryName(ModJobs.MECHANIC_ID) + .createJobEntry(); - ModJobs.planter = new JobEntry.Builder() - .setJobProducer(JobPlanter::new) - .setRegistryName(ModJobs.PLANTER_ID) - .createJobEntry(); + ModJobs.planter = new JobEntry.Builder() + .setJobProducer(JobPlanter::new) + .setRegistryName(ModJobs.PLANTER_ID) + .createJobEntry(); ModJobs.rabbitHerder = new JobEntry.Builder() - .setJobProducer(JobRabbitHerder::new) - .setRegistryName(ModJobs.RABBIT_ID) - .createJobEntry(); + .setJobProducer(JobRabbitHerder::new) + .setRegistryName(ModJobs.RABBIT_ID) + .createJobEntry(); ModJobs.concreteMixer = new JobEntry.Builder() - .setJobProducer(JobConcreteMixer::new) - .setRegistryName(ModJobs.CONCRETE_ID) - .createJobEntry(); + .setJobProducer(JobConcreteMixer::new) + .setRegistryName(ModJobs.CONCRETE_ID) + .createJobEntry(); - ModJobs.beekeeper = new JobEntry.Builder() - .setJobProducer(JobBeekeeper::new) - .setRegistryName(ModJobs.BEEKEEPER_ID) - .createJobEntry(); + ModJobs.beekeeper = new JobEntry.Builder() + .setJobProducer(JobBeekeeper::new) + .setRegistryName(ModJobs.BEEKEEPER_ID) + .createJobEntry(); reg.register(ModJobs.placeHolder); reg.register(ModJobs.builder); diff --git a/src/main/java/com/minecolonies/apiimp/initializer/ModParticleTypesInitializer.java b/src/main/java/com/minecolonies/apiimp/initializer/ModParticleTypesInitializer.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/minecolonies/apiimp/initializer/TileEntityInitializer.java b/src/main/java/com/minecolonies/apiimp/initializer/TileEntityInitializer.java old mode 100644 new mode 100755 index 436b98bda9a..7059d790d68 --- a/src/main/java/com/minecolonies/apiimp/initializer/TileEntityInitializer.java +++ b/src/main/java/com/minecolonies/apiimp/initializer/TileEntityInitializer.java @@ -27,8 +27,8 @@ public static void registerTileEntity(final RegistryEvent.Register RenderTypeLookup.setRenderLayer(hut, renderType -> renderType.equals(RenderType.getCutout()) || renderType.equals(RenderType.getSolid()))); + Arrays.stream(ModBlocks.getHuts()) + .forEach(hut -> RenderTypeLookup.setRenderLayer(hut, renderType -> renderType.equals(RenderType.getCutout()) || renderType.equals(RenderType.getSolid()))); RenderTypeLookup.setRenderLayer(ModBlocks.blockScarecrow, RenderType.getCutout()); RenderTypeLookup.setRenderLayer(ModBlocks.blockRack, RenderType.getCutout()); RenderTypeLookup.setRenderLayer(ModBlocks.blockDecorationPlaceholder, RenderType.getCutout()); diff --git a/src/main/java/com/minecolonies/coremod/Network.java b/src/main/java/com/minecolonies/coremod/Network.java old mode 100644 new mode 100755 index 969d9cfb7da..4fb8a383d55 --- a/src/main/java/com/minecolonies/coremod/Network.java +++ b/src/main/java/com/minecolonies/coremod/Network.java @@ -11,6 +11,7 @@ public class Network /** * Get the network handler. + * * @return the network handler. */ public static NetworkChannel getNetwork() diff --git a/src/main/java/com/minecolonies/coremod/blocks/BlockBarracksTowerSubstitution.java b/src/main/java/com/minecolonies/coremod/blocks/BlockBarracksTowerSubstitution.java old mode 100644 new mode 100755 index 3ed3e28c40b..39248d47513 --- a/src/main/java/com/minecolonies/coremod/blocks/BlockBarracksTowerSubstitution.java +++ b/src/main/java/com/minecolonies/coremod/blocks/BlockBarracksTowerSubstitution.java @@ -41,8 +41,7 @@ public class BlockBarracksTowerSubstitution extends AbstractBlockMinecolonies builder) { + protected void fillStateContainer(StateContainer.Builder builder) + { builder.add(FACING); } } diff --git a/src/main/java/com/minecolonies/coremod/blocks/BlockBarrel.java b/src/main/java/com/minecolonies/coremod/blocks/BlockBarrel.java old mode 100644 new mode 100755 index e3634e148fd..0fe993cfdbd --- a/src/main/java/com/minecolonies/coremod/blocks/BlockBarrel.java +++ b/src/main/java/com/minecolonies/coremod/blocks/BlockBarrel.java @@ -31,15 +31,15 @@ public class BlockBarrel extends AbstractBlockBarrel /** * The hardness this block has. */ - private static final float BLOCK_HARDNESS = 5F; + private static final float BLOCK_HARDNESS = 5F; /** * This blocks name. */ - private static final String BLOCK_NAME = "barrel_block"; + private static final String BLOCK_NAME = "barrel_block"; /** * The resistance this block has. */ - private static final float RESISTANCE = 1F; + private static final float RESISTANCE = 1F; public BlockBarrel() { @@ -49,7 +49,8 @@ public BlockBarrel() } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void fillStateContainer(StateContainer.Builder builder) + { builder.add(AbstractBlockBarrel.FACING, VARIANT); } @@ -90,7 +91,7 @@ public ActionResultType onBlockActivated( @Override public VoxelShape getShape(final BlockState state, final IBlockReader worldIn, final BlockPos pos, final ISelectionContext context) { - return VoxelShapes.create(0,0,0,1,1.5,1); + return VoxelShapes.create(0, 0, 0, 1, 1.5, 1); } /** @@ -125,7 +126,13 @@ public BlockState getStateForPlacement(final BlockItemUseContext context) } @Override - public BlockState updatePostPlacement(@NotNull final BlockState stateIn, final Direction facing, final BlockState state, final IWorld worldIn, final BlockPos currentPos, final BlockPos pos) + public BlockState updatePostPlacement( + @NotNull final BlockState stateIn, + final Direction facing, + final BlockState state, + final IWorld worldIn, + final BlockPos currentPos, + final BlockPos pos) { final TileEntity entity = worldIn.getTileEntity(pos); if (!(entity instanceof TileEntityBarrel)) diff --git a/src/main/java/com/minecolonies/coremod/blocks/BlockCompostedDirt.java b/src/main/java/com/minecolonies/coremod/blocks/BlockCompostedDirt.java old mode 100644 new mode 100755 index 8a4a4bcf378..bc911e981da --- a/src/main/java/com/minecolonies/coremod/blocks/BlockCompostedDirt.java +++ b/src/main/java/com/minecolonies/coremod/blocks/BlockCompostedDirt.java @@ -21,10 +21,10 @@ */ public class BlockCompostedDirt extends AbstractBlockMinecolonies { - private static final String BLOCK_NAME = "composted_dirt"; - private static final float BLOCK_HARDNESS = 5f; - private static final float RESISTANCE = 1f; - private final static VoxelShape SHAPE = VoxelShapes.create(0,0,0,1,1,1); + private static final String BLOCK_NAME = "composted_dirt"; + private static final float BLOCK_HARDNESS = 5f; + private static final float RESISTANCE = 1f; + private final static VoxelShape SHAPE = VoxelShapes.create(0, 0, 0, 1, 1, 1); /** * The constructor of the block. @@ -56,7 +56,12 @@ public VoxelShape getShape(final BlockState state, final IBlockReader worldIn, f } @Override - public boolean canSustainPlant(@NotNull final BlockState state, @NotNull final IBlockReader world, final BlockPos pos, @NotNull final Direction facing, final IPlantable plantable) + public boolean canSustainPlant( + @NotNull final BlockState state, + @NotNull final IBlockReader world, + final BlockPos pos, + @NotNull final Direction facing, + final IPlantable plantable) { return true; } diff --git a/src/main/java/com/minecolonies/coremod/blocks/BlockDecorationController.java b/src/main/java/com/minecolonies/coremod/blocks/BlockDecorationController.java old mode 100644 new mode 100755 index 678d201a0db..0b96ba8cf54 --- a/src/main/java/com/minecolonies/coremod/blocks/BlockDecorationController.java +++ b/src/main/java/com/minecolonies/coremod/blocks/BlockDecorationController.java @@ -60,7 +60,6 @@ public class BlockDecorationController extends AbstractBlockMinecoloniesHorizont /** * Constructor for the placerholder. - * */ public BlockDecorationController() { @@ -114,7 +113,8 @@ public boolean hasTileEntity(final BlockState state) } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void fillStateContainer(StateContainer.Builder builder) + { builder.add(HORIZONTAL_FACING, MIRROR); } diff --git a/src/main/java/com/minecolonies/coremod/blocks/BlockMinecoloniesRack.java b/src/main/java/com/minecolonies/coremod/blocks/BlockMinecoloniesRack.java old mode 100644 new mode 100755 index 00f7cbc53a9..e90b06de54a --- a/src/main/java/com/minecolonies/coremod/blocks/BlockMinecoloniesRack.java +++ b/src/main/java/com/minecolonies/coremod/blocks/BlockMinecoloniesRack.java @@ -72,7 +72,8 @@ public BlockMinecoloniesRack() } @Override - public boolean propagatesSkylightDown(final BlockState state, @NotNull final IBlockReader reader, @NotNull final BlockPos pos) { + public boolean propagatesSkylightDown(final BlockState state, @NotNull final IBlockReader reader, @NotNull final BlockPos pos) + { return true; } @@ -102,9 +103,10 @@ public BlockState getStateForPlacement(final BlockItemUseContext context) /** * Get the statement ready. - * @param state the state to place. + * + * @param state the state to place. * @param entity the tileEntity. - * @param pos the position. + * @param pos the position. * @return the next state. */ public static BlockState getPlacementState(final BlockState state, final TileEntity entity, final BlockPos pos) @@ -174,7 +176,13 @@ public BlockState mirror(@NotNull final BlockState state, final Mirror mirrorIn) } @Override - public BlockState updatePostPlacement(@NotNull final BlockState stateIn, final Direction facing, final BlockState state, final IWorld worldIn, final BlockPos currentPos, final BlockPos pos) + public BlockState updatePostPlacement( + @NotNull final BlockState stateIn, + final Direction facing, + final BlockState state, + final IWorld worldIn, + final BlockPos currentPos, + final BlockPos pos) { if (state.getBlock() instanceof BlockMinecoloniesRack || stateIn.getBlock() instanceof BlockMinecoloniesRack) { @@ -192,7 +200,6 @@ public BlockState updatePostPlacement(@NotNull final BlockState stateIn, final D return super.updatePostPlacement(stateIn, facing, state, worldIn, currentPos, pos); } - @Override public void spawnAdditionalDrops(final BlockState state, final World worldIn, final BlockPos pos, final ItemStack stack) { @@ -223,7 +230,9 @@ public ActionResultType onBlockActivated( final TileEntityRack rack = (TileEntityRack) tileEntity; if (!worldIn.isRemote) { - NetworkHooks.openGui((ServerPlayerEntity) player, rack, buf -> buf.writeBlockPos(rack.getPos()).writeBlockPos(rack.getOtherChest() == null ? BlockPos.ZERO : rack.getOtherChest().getPos())); + NetworkHooks.openGui((ServerPlayerEntity) player, + rack, + buf -> buf.writeBlockPos(rack.getPos()).writeBlockPos(rack.getOtherChest() == null ? BlockPos.ZERO : rack.getOtherChest().getPos())); } return ActionResultType.SUCCESS; } @@ -244,7 +253,8 @@ public void onBlockPlacedBy(final World worldIn, final BlockPos pos, final Block } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void fillStateContainer(StateContainer.Builder builder) + { builder.add(FACING, VARIANT); } @@ -270,16 +280,19 @@ public List getDrops(final BlockState state, final LootContext.Builde } @Override - public void onReplaced(BlockState state, @NotNull World worldIn, @NotNull BlockPos pos, BlockState newState, boolean isMoving) { - if (state.getBlock() != newState.getBlock()) { + public void onReplaced(BlockState state, @NotNull World worldIn, @NotNull BlockPos pos, BlockState newState, boolean isMoving) + { + if (state.getBlock() != newState.getBlock()) + { TileEntity tileEntity = worldIn.getTileEntity(pos); - if (tileEntity instanceof TileEntityRack) { + if (tileEntity instanceof TileEntityRack) + { TileEntityRack tileEntityRack = (TileEntityRack) tileEntity; InventoryUtils.dropItemHandler(tileEntityRack.getInventory(), - worldIn.getWorld(), - tileEntityRack.getPos().getX(), - tileEntityRack.getPos().getY(), - tileEntityRack.getPos().getZ()); + worldIn.getWorld(), + tileEntityRack.getPos().getX(), + tileEntityRack.getPos().getY(), + tileEntityRack.getPos().getZ()); worldIn.getWorld().updateComparatorOutputLevel(pos, this); } diff --git a/src/main/java/com/minecolonies/coremod/blocks/BlockScarecrow.java b/src/main/java/com/minecolonies/coremod/blocks/BlockScarecrow.java old mode 100644 new mode 100755 index c9542017186..3fca1c4cb9c --- a/src/main/java/com/minecolonies/coremod/blocks/BlockScarecrow.java +++ b/src/main/java/com/minecolonies/coremod/blocks/BlockScarecrow.java @@ -68,10 +68,10 @@ public VoxelShape getShape( // the user will think it is one big block return VoxelShapes.create( (float) START_COLLISION, - (float)(BOTTOM_COLLISION - (state.get(HALF) == DoubleBlockHalf.UPPER ? 1 : 0)), + (float) (BOTTOM_COLLISION - (state.get(HALF) == DoubleBlockHalf.UPPER ? 1 : 0)), (float) START_COLLISION, (float) END_COLLISION, - (float)(HEIGHT_COLLISION - (state.get(HALF) == DoubleBlockHalf.UPPER ? 1 : 0)), + (float) (HEIGHT_COLLISION - (state.get(HALF) == DoubleBlockHalf.UPPER ? 1 : 0)), (float) END_COLLISION ); } @@ -98,7 +98,7 @@ public ActionResultType onBlockActivated( // Get the entity of the bottom half DoubleBlockHalf half = state.get(HALF); final TileEntity entity = worldIn.getTileEntity( - half == DoubleBlockHalf.UPPER ? pos.down() : pos + half == DoubleBlockHalf.UPPER ? pos.down() : pos ); if (entity instanceof ScarecrowTileEntity) @@ -199,8 +199,9 @@ public void onBlockHarvested(final World worldIn, @NotNull final BlockPos pos, f /** * Notify the colony about the destruction of the field. + * * @param worldIn the world. - * @param pos the position. + * @param pos the position. */ private static void notifyColonyAboutDestruction(final IWorld worldIn, final BlockPos pos) { diff --git a/src/main/java/com/minecolonies/coremod/blocks/decorative/BlockConstructionTape.java b/src/main/java/com/minecolonies/coremod/blocks/decorative/BlockConstructionTape.java old mode 100644 new mode 100755 index 7a401861ad6..79850f6b6cc --- a/src/main/java/com/minecolonies/coremod/blocks/decorative/BlockConstructionTape.java +++ b/src/main/java/com/minecolonies/coremod/blocks/decorative/BlockConstructionTape.java @@ -1,19 +1,17 @@ package com.minecolonies.coremod.blocks.decorative; import com.minecolonies.api.blocks.decorative.AbstractBlockMinecoloniesConstructionTape; -import net.minecraft.block.*; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluids; import net.minecraft.item.BlockItemUseContext; -import net.minecraft.pathfinding.PathType; import net.minecraft.state.StateContainer; -import net.minecraft.tags.FluidTags; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.World; @@ -23,11 +21,11 @@ import java.util.ArrayList; import java.util.List; -import static net.minecraft.util.Direction.*; +import static net.minecraft.util.Direction.Axis; +import static net.minecraft.util.Direction.Plane; /** - * This block is used as a border to show the size of the building. - * It also shows that the building is in the progress of being built. + * This block is used as a border to show the size of the building. It also shows that the building is in the progress of being built. */ public class BlockConstructionTape extends AbstractBlockMinecoloniesConstructionTape { @@ -44,16 +42,16 @@ public BlockConstructionTape() super(Properties.create(Material.TALL_PLANTS).hardnessAndResistance(0.0f).doesNotBlockMovement().noDrops()); setRegistryName(BLOCK_NAME); - this.shapes = makeShapes(2,2,16,0,16); + this.shapes = makeShapes(2, 2, 16, 0, 16); this.setDefaultState(this.getDefaultState() - .with(NORTH, false) - .with(EAST, false) - .with(SOUTH, false) - .with(WEST, false) - .with(FACING, Direction.NORTH) - .with(WATERLOGGED, false) - .with(CORNER, false) + .with(NORTH, false) + .with(EAST, false) + .with(SOUTH, false) + .with(WEST, false) + .with(FACING, Direction.NORTH) + .with(WATERLOGGED, false) + .with(CORNER, false) ); } @@ -72,16 +70,22 @@ public BlockState getStateForPlacement(final BlockItemUseContext context) Direction[] faces = context.getNearestLookingDirections(); return BlockConstructionTape.getPlacementState( - super.getStateForPlacement(context), - context.getWorld(), - context.getPos(), - faces[0].getHorizontalIndex() >= 0 ? faces[0] : faces[1] + super.getStateForPlacement(context), + context.getWorld(), + context.getPos(), + faces[0].getHorizontalIndex() >= 0 ? faces[0] : faces[1] ); } @NotNull @Override - public BlockState updatePostPlacement(@NotNull final BlockState stateIn, final Direction dir, final BlockState state, final IWorld worldIn, @NotNull final BlockPos currentPos, final BlockPos pos) + public BlockState updatePostPlacement( + @NotNull final BlockState stateIn, + final Direction dir, + final BlockState state, + final IWorld worldIn, + @NotNull final BlockPos currentPos, + final BlockPos pos) { if (stateIn.get(WATERLOGGED)) { @@ -89,39 +93,44 @@ public BlockState updatePostPlacement(@NotNull final BlockState stateIn, final D } return BlockConstructionTape.getPlacementState( - super.updatePostPlacement(stateIn, dir, state, worldIn, currentPos, pos), worldIn, currentPos, stateIn.get(FACING) + super.updatePostPlacement(stateIn, dir, state, worldIn, currentPos, pos), worldIn, currentPos, stateIn.get(FACING) ); } /** * A static version of getStateForPlacement to allow helpers to interact with states + * * @param state the block state to configure * @param world the world - * @param pos the position of the new state - * @param face the default direction of the tape when there are no connections + * @param pos the position of the new state + * @param face the default direction of the tape when there are no connections * @return the configured state */ - public static BlockState getPlacementState (@Nullable BlockState state, IBlockReader world, BlockPos pos, Direction face) + public static BlockState getPlacementState(@Nullable BlockState state, IBlockReader world, BlockPos pos, Direction face) { Fluid fluid = world.getFluidState(pos).getFluid(); List connections = getConnections(world, pos, face, state.get(CORNER)); return state - .with(NORTH, connections.contains(Direction.NORTH)) - .with(EAST, connections.contains(Direction.EAST)) - .with(SOUTH, connections.contains(Direction.SOUTH)) - .with(WEST, connections.contains(Direction.WEST)) - .with(FACING, face) - .with(WATERLOGGED, fluid == Fluids.WATER); + .with(NORTH, connections.contains(Direction.NORTH)) + .with(EAST, connections.contains(Direction.EAST)) + .with(SOUTH, connections.contains(Direction.SOUTH)) + .with(WEST, connections.contains(Direction.WEST)) + .with(FACING, face) + .with(WATERLOGGED, fluid == Fluids.WATER); } - public static List getConnections (IBlockReader world, BlockPos pos, Direction face, boolean corner) + public static List getConnections(IBlockReader world, BlockPos pos, Direction face, boolean corner) { List connections = new ArrayList<>(); for (Direction direction : Plane.HORIZONTAL) + { if (canConnect(world, pos, direction)) + { connections.add(direction); + } + } // When the tape is isolated, set it to its default orientation // considering whether it is a corner @@ -148,33 +157,47 @@ else if (connections.size() == 3) Direction stem = Direction.NORTH; for (Direction direction : Plane.HORIZONTAL) + { if (!connections.contains(direction)) + { stem = direction.getOpposite(); + } + } // If the block in the direction of the stem also has three connections // with it's stem facing this block, remove this block's stem if (canRemoveTStem(world, pos, stem)) + { connections.remove(connections.indexOf(stem)); + } } return connections; } - protected static boolean canConnect (IBlockReader world, BlockPos pos, Direction face) + protected static boolean canConnect(IBlockReader world, BlockPos pos, Direction face) { BlockPos adjacent; switch (face) { default: - case NORTH: adjacent = pos.north(); break; - case EAST: adjacent = pos.east(); break; - case SOUTH: adjacent = pos.south(); break; - case WEST: adjacent = pos.west(); break; + case NORTH: + adjacent = pos.north(); + break; + case EAST: + adjacent = pos.east(); + break; + case SOUTH: + adjacent = pos.south(); + break; + case WEST: + adjacent = pos.west(); + break; } return world.getBlockState(adjacent).getBlock() instanceof BlockConstructionTape; } - protected static boolean canRemoveTStem (IBlockReader world, BlockPos pos, Direction face) + protected static boolean canRemoveTStem(IBlockReader world, BlockPos pos, Direction face) { BlockState neighbor = world.getBlockState(pos.offset(face)); switch (face) @@ -201,7 +224,7 @@ public boolean propagatesSkylightDown(final BlockState state, @NotNull final IBl public void onEndFalling(World worldIn, BlockPos pos, BlockState fallingState, BlockState hitState) { worldIn.setBlockState(pos, BlockConstructionTape.getPlacementState( - fallingState, worldIn, pos, fallingState.get(FACING) + fallingState, worldIn, pos, fallingState.get(FACING) )); updateNeighbors(fallingState, worldIn, pos, 3); diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutArchery.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutArchery.java old mode 100644 new mode 100755 index 180db21266d..14f674d5b44 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutArchery.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutArchery.java @@ -5,7 +5,6 @@ import com.minecolonies.api.colony.buildings.registry.BuildingEntry; import org.jetbrains.annotations.NotNull; - /** * Block of the Archers trainings camp. */ diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBaker.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBaker.java old mode 100644 new mode 100755 index ddaf3042e65..58ef42822d9 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBaker.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBaker.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the bakery. - * No different from {@link AbstractBlockHut} + * Hut for the bakery. No different from {@link AbstractBlockHut} */ public class BlockHutBaker extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBarracks.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBarracks.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBarracksTower.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBarracksTower.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBlacksmith.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBlacksmith.java old mode 100644 new mode 100755 index 366b06c2f5d..0e89f1be180 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBlacksmith.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBlacksmith.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the blacksmith. - * No different from {@link AbstractBlockHut} + * Hut for the blacksmith. No different from {@link AbstractBlockHut} */ public class BlockHutBlacksmith extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBuilder.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBuilder.java old mode 100644 new mode 100755 index 3772bd51914..2916ac581a4 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBuilder.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutBuilder.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the builder. - * No different from {@link AbstractBlockHut} + * Hut for the builder. No different from {@link AbstractBlockHut} */ public class BlockHutBuilder extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutChickenHerder.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutChickenHerder.java old mode 100644 new mode 100755 index 3513bb6247e..0aba20dfda2 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutChickenHerder.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutChickenHerder.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the shepherd. - * No different from {@link AbstractBlockHut} + * Hut for the shepherd. No different from {@link AbstractBlockHut} */ public class BlockHutChickenHerder extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCitizen.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCitizen.java old mode 100644 new mode 100755 index 14f1380118a..2eb9de7b393 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCitizen.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCitizen.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the citizen. - * No different from {@link AbstractBlockHut} + * Hut for the citizen. No different from {@link AbstractBlockHut} */ public class BlockHutCitizen extends AbstractBlockHut diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCombatAcademy.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCombatAcademy.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutComposter.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutComposter.java old mode 100644 new mode 100755 index a2a315a4583..cd6e2566c2d --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutComposter.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutComposter.java @@ -10,7 +10,7 @@ public class BlockHutComposter extends AbstractBlockHut @NotNull @Override - public String getName(){return "blockhutcomposter";} + public String getName() {return "blockhutcomposter";} @Override public BuildingEntry getBuildingEntry() diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutConcreteMixer.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutConcreteMixer.java index b538830807c..95973afaf4f 100644 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutConcreteMixer.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutConcreteMixer.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the concrete mason. - * No different from {@link AbstractBlockHut} + * Hut for the concrete mason. No different from {@link AbstractBlockHut} */ public class BlockHutConcreteMixer extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCook.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCook.java old mode 100644 new mode 100755 index e4d73f6ff84..e16f12a35fa --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCook.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCook.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the lumberjack. - * No different from {@link AbstractBlockHut} + * Hut for the lumberjack. No different from {@link AbstractBlockHut} */ public class BlockHutCook extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCowboy.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCowboy.java old mode 100644 new mode 100755 index 0af8fcc128a..324a84948d8 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCowboy.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCowboy.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the shepherd. - * No different from {@link AbstractBlockHut} + * Hut for the shepherd. No different from {@link AbstractBlockHut} */ public class BlockHutCowboy extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCrusher.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCrusher.java old mode 100644 new mode 100755 index 4d6b744102c..aef7f983654 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCrusher.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutCrusher.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the crusher. - * No different from {@link AbstractBlockHut} + * Hut for the crusher. No different from {@link AbstractBlockHut} */ public class BlockHutCrusher extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutDeliveryman.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutDeliveryman.java old mode 100644 new mode 100755 index ce3cfcd07ca..7f5abeb6a90 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutDeliveryman.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutDeliveryman.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the warehouse. - * No different from {@link AbstractBlockHut} + * Hut for the warehouse. No different from {@link AbstractBlockHut} */ public class BlockHutDeliveryman extends AbstractBlockHut diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutDyer.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutDyer.java old mode 100644 new mode 100755 index 6c191e7161c..70e260833ad --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutDyer.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutDyer.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the dyer. - * No different from {@link AbstractBlockHut} + * Hut for the dyer. No different from {@link AbstractBlockHut} */ public class BlockHutDyer extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutEnchanter.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutEnchanter.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutFarmer.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutFarmer.java old mode 100644 new mode 100755 index 862b7c76a2c..4137e380be0 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutFarmer.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutFarmer.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the Farmer. - * No different from {@link AbstractBlockHut} + * Hut for the Farmer. No different from {@link AbstractBlockHut} */ public class BlockHutFarmer extends AbstractBlockHut diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutFisherman.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutFisherman.java old mode 100644 new mode 100755 index 8d33a2e1bc4..e254fff0271 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutFisherman.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutFisherman.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the fisherman. - * No different from {@link AbstractBlockHut} + * Hut for the fisherman. No different from {@link AbstractBlockHut} */ public class BlockHutFisherman extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutFletcher.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutFletcher.java old mode 100644 new mode 100755 index dbde9f02b4e..6f3fd4140c8 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutFletcher.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutFletcher.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the fletcher. - * No different from {@link AbstractBlockHut} + * Hut for the fletcher. No different from {@link AbstractBlockHut} */ public class BlockHutFletcher extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutFlorist.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutFlorist.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutGlassblower.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutGlassblower.java old mode 100644 new mode 100755 index a43bf21b089..decad7772c0 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutGlassblower.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutGlassblower.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the glassblower. - * No different from {@link AbstractBlockHut} + * Hut for the glassblower. No different from {@link AbstractBlockHut} */ public class BlockHutGlassblower extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutGuardTower.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutGuardTower.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutHospital.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutHospital.java old mode 100644 new mode 100755 index d1c1465777b..7c609f4a7b0 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutHospital.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutHospital.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the hospital. - * No different from {@link AbstractBlockHut} + * Hut for the hospital. No different from {@link AbstractBlockHut} */ public class BlockHutHospital extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutLibrary.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutLibrary.java old mode 100644 new mode 100755 index 5f081196f80..ceefbc21e0b --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutLibrary.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutLibrary.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the library. - * No different from {@link AbstractBlockHut} + * Hut for the library. No different from {@link AbstractBlockHut} */ public class BlockHutLibrary extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutLumberjack.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutLumberjack.java old mode 100644 new mode 100755 index 114a884728f..d21a023f63b --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutLumberjack.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutLumberjack.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the lumberjack. - * No different from {@link AbstractBlockHut} + * Hut for the lumberjack. No different from {@link AbstractBlockHut} */ public class BlockHutLumberjack extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutMechanic.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutMechanic.java old mode 100644 new mode 100755 index 2d44aa2502a..267b1a7af9f --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutMechanic.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutMechanic.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the mechanic. - * No different from {@link AbstractBlockHut} + * Hut for the mechanic. No different from {@link AbstractBlockHut} */ public class BlockHutMechanic extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutMiner.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutMiner.java old mode 100644 new mode 100755 index c2802dbdd9c..4c355e06265 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutMiner.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutMiner.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the miner. - * No different from {@link AbstractBlockHut} + * Hut for the miner. No different from {@link AbstractBlockHut} */ public class BlockHutMiner extends AbstractBlockHut diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutPlantation.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutPlantation.java old mode 100644 new mode 100755 index d454848995b..fc4ba5b4023 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutPlantation.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutPlantation.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the plantation. - * No different from {@link AbstractBlockHut} + * Hut for the plantation. No different from {@link AbstractBlockHut} */ public class BlockHutPlantation extends AbstractBlockHut diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutRabbitHutch.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutRabbitHutch.java index e7e76be44d8..19996a14aaa 100644 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutRabbitHutch.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutRabbitHutch.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the rabbit hutch. - * No different from {@link AbstractBlockHut} + * Hut for the rabbit hutch. No different from {@link AbstractBlockHut} */ public class BlockHutRabbitHutch extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSawmill.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSawmill.java old mode 100644 new mode 100755 index e1d15e975b9..13d7511e275 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSawmill.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSawmill.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the sawmill. - * No different from {@link AbstractBlockHut} + * Hut for the sawmill. No different from {@link AbstractBlockHut} */ public class BlockHutSawmill extends AbstractBlockHut diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSchool.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSchool.java old mode 100644 new mode 100755 index 688fa5a611c..1c9d8cf7d23 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSchool.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSchool.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the school. - * No different from {@link AbstractBlockHut} + * Hut for the school. No different from {@link AbstractBlockHut} */ public class BlockHutSchool extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutShepherd.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutShepherd.java old mode 100644 new mode 100755 index 79fe0790e12..31bdfafd6d3 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutShepherd.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutShepherd.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the shepherd. - * No different from {@link AbstractBlockHut} + * Hut for the shepherd. No different from {@link AbstractBlockHut} */ public class BlockHutShepherd extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSifter.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSifter.java old mode 100644 new mode 100755 index 16e4ed3e810..5f300500e2d --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSifter.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSifter.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the sifter. - * No different from {@link AbstractBlockHut} + * Hut for the sifter. No different from {@link AbstractBlockHut} */ public class BlockHutSifter extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSmeltery.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSmeltery.java old mode 100644 new mode 100755 index b36e5aa5ea6..cc482864c3f --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSmeltery.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSmeltery.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the Smeltery. - * No different from {@link AbstractBlockHut} + * Hut for the Smeltery. No different from {@link AbstractBlockHut} */ public class BlockHutSmeltery extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutStoneSmeltery.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutStoneSmeltery.java old mode 100644 new mode 100755 index 055e4b0f299..18e39eb3b86 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutStoneSmeltery.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutStoneSmeltery.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the StoneSmeltery. - * No different from {@link AbstractBlockHut} + * Hut for the StoneSmeltery. No different from {@link AbstractBlockHut} */ public class BlockHutStoneSmeltery extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutStonemason.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutStonemason.java old mode 100644 new mode 100755 index d5434c93d59..6c66d26e22f --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutStonemason.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutStonemason.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the stone mason. - * No different from {@link AbstractBlockHut} + * Hut for the stone mason. No different from {@link AbstractBlockHut} */ public class BlockHutStonemason extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSwineHerder.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSwineHerder.java old mode 100644 new mode 100755 index f28f04e04b2..2efea40a27b --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSwineHerder.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutSwineHerder.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the shepherd. - * No different from {@link AbstractBlockHut} + * Hut for the shepherd. No different from {@link AbstractBlockHut} */ public class BlockHutSwineHerder extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutTavern.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutTavern.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutTownHall.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutTownHall.java old mode 100644 new mode 100755 index a93e4fa1246..fd1c5090b91 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutTownHall.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutTownHall.java @@ -21,8 +21,7 @@ import org.jetbrains.annotations.Nullable; /** - * Hut for the town hall. - * Sets the working range for the town hall in the constructor + * Hut for the town hall. Sets the working range for the town hall in the constructor */ public class BlockHutTownHall extends AbstractBlockHut { @@ -58,12 +57,12 @@ public BuildingEntry getBuildingEntry() /** * Choose a different gui when no colony view, for colony overview and creation/deletion * - * @param state the blockstate. + * @param state the blockstate. * @param worldIn the world. - * @param pos the position. - * @param player the player. - * @param hand the hand. - * @param ray the raytraceresult. + * @param pos the position. + * @param player the player. + * @param hand the hand. + * @param ray the raytraceresult. * @return the result type. */ @Override diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutUniversity.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutUniversity.java old mode 100644 new mode 100755 index a5e7f88c5fc..81bfaa3ba6f --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutUniversity.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutUniversity.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the university. - * No different from {@link AbstractBlockHut} + * Hut for the university. No different from {@link AbstractBlockHut} */ public class BlockHutUniversity extends AbstractBlockHut { diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutWareHouse.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutWareHouse.java old mode 100644 new mode 100755 index 004d8e946b8..8a6cca434f7 --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutWareHouse.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockHutWareHouse.java @@ -12,8 +12,7 @@ import org.jetbrains.annotations.Nullable; /** - * Hut for the warehouse. - * No different from {@link AbstractBlockHut} + * Hut for the warehouse. No different from {@link AbstractBlockHut} */ public class BlockHutWareHouse extends AbstractBlockHut @@ -36,7 +35,7 @@ public String getName() public TileEntity createTileEntity(final BlockState state, final IBlockReader world) { final TileEntityWareHouse building = (TileEntityWareHouse) MinecoloniesTileEntities.WAREHOUSE.create(); - building.registryName = this.getBuildingEntry().getRegistryName(); + building.registryName = this.getBuildingEntry().getRegistryName(); return building; } diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockPostBox.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockPostBox.java old mode 100644 new mode 100755 index f62e3f1564d..de08988af8a --- a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockPostBox.java +++ b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockPostBox.java @@ -13,15 +13,14 @@ import org.jetbrains.annotations.NotNull; /** - * Hut for the PostBox. - * No different from {@link AbstractBlockHut} + * Hut for the PostBox. No different from {@link AbstractBlockHut} */ public class BlockPostBox extends AbstractBlockHut implements IRSComponentBlock { private static final VoxelShape SHAPE_NORTH = Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 8.0D); - private static final VoxelShape SHAPE_EAST = Block.makeCuboidShape(8.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D); + private static final VoxelShape SHAPE_EAST = Block.makeCuboidShape(8.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D); private static final VoxelShape SHAPE_SOUTH = Block.makeCuboidShape(0.0D, 0.0D, 8.0D, 16.0D, 16.0D, 16.0D); - private static final VoxelShape SHAPE_WEST = Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 8.0D, 16.0D, 16.0D); + private static final VoxelShape SHAPE_WEST = Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 8.0D, 16.0D, 16.0D); @NotNull @Override diff --git a/src/main/java/com/minecolonies/coremod/blocks/huts/BlockStash.java b/src/main/java/com/minecolonies/coremod/blocks/huts/BlockStash.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/minecolonies/coremod/blocks/schematic/BlockWaypoint.java b/src/main/java/com/minecolonies/coremod/blocks/schematic/BlockWaypoint.java old mode 100644 new mode 100755 index 442633abb71..54ecb5f713c --- a/src/main/java/com/minecolonies/coremod/blocks/schematic/BlockWaypoint.java +++ b/src/main/java/com/minecolonies/coremod/blocks/schematic/BlockWaypoint.java @@ -4,9 +4,8 @@ import net.minecraft.block.material.Material; /** - * This block is used as a substitution block for the Builder. - * Every solid block can be substituted by this block in schematics. - * This helps make schematics independent from location and ground. + * This block is used as a substitution block for the Builder. Every solid block can be substituted by this block in schematics. This helps make schematics independent from + * location and ground. */ public class BlockWaypoint extends AbstractBlockMinecolonies { @@ -27,8 +26,7 @@ public class BlockWaypoint extends AbstractBlockMinecolonies private static final float RESISTANCE = 1F; /** - * Constructor for the Substitution block. - * sets the creative tab, as well as the resistance and the hardness. + * Constructor for the Substitution block. sets the creative tab, as well as the resistance and the hardness. */ public BlockWaypoint() { diff --git a/src/main/java/com/minecolonies/coremod/client/gui/AbstractHutFilterableLists.java b/src/main/java/com/minecolonies/coremod/client/gui/AbstractHutFilterableLists.java old mode 100644 new mode 100755 index 988bde9aea5..3840bdeff9a --- a/src/main/java/com/minecolonies/coremod/client/gui/AbstractHutFilterableLists.java +++ b/src/main/java/com/minecolonies/coremod/client/gui/AbstractHutFilterableLists.java @@ -35,8 +35,8 @@ public abstract class AbstractHutFilterableLists extends AbstractWindowWorkerBui /** * Constructor for the window of the the filterable lists. * - * @param building {@link AbstractFilterableListsView}. - * @param res the resource String. + * @param building {@link AbstractFilterableListsView}. + * @param res the resource String. * @param predicates the restriction. */ @SafeVarargs @@ -51,8 +51,9 @@ public AbstractHutFilterableLists(final AbstractFilterableListsView building, fi /** * The classic block list. + * * @param filterPredicate the predicate filter. - * @param id the id of the specific predicate. + * @param id the id of the specific predicate. * @return the list of itemStorages. */ public List getBlockList(final Predicate filterPredicate, final String id) @@ -61,7 +62,13 @@ public List getBlockList(final Predicate filte { return Collections.emptyList(); } - return ImmutableList.copyOf(IColonyManager.getInstance().getCompatibilityManager().getBlockList().stream().filter(filterPredicate.and(itemStackPredicate.get(id))).map(ItemStorage::new).collect(Collectors.toList())); + return ImmutableList.copyOf(IColonyManager.getInstance() + .getCompatibilityManager() + .getBlockList() + .stream() + .filter(filterPredicate.and(itemStackPredicate.get(id))) + .map(ItemStorage::new) + .collect(Collectors.toList())); } @Override diff --git a/src/main/java/com/minecolonies/coremod/client/gui/AbstractWindowBuilding.java b/src/main/java/com/minecolonies/coremod/client/gui/AbstractWindowBuilding.java old mode 100644 new mode 100755 index 5e34805e720..085d57396ad --- a/src/main/java/com/minecolonies/coremod/client/gui/AbstractWindowBuilding.java +++ b/src/main/java/com/minecolonies/coremod/client/gui/AbstractWindowBuilding.java @@ -154,7 +154,7 @@ public void onUpdate() /** * Update the state and label for the Build button. - * + * * @param buildingView the view to update from. */ private void updateButtonBuild(final IBuildingView buildingView) diff --git a/src/main/java/com/minecolonies/coremod/client/gui/AbstractWindowRequestTree.java b/src/main/java/com/minecolonies/coremod/client/gui/AbstractWindowRequestTree.java old mode 100644 new mode 100755 index e785c4d0e49..0220823bc4f --- a/src/main/java/com/minecolonies/coremod/client/gui/AbstractWindowRequestTree.java +++ b/src/main/java/com/minecolonies/coremod/client/gui/AbstractWindowRequestTree.java @@ -329,12 +329,12 @@ public void updateElement(final int index, final Pane rowPane) rowPane.findPaneOfTypeByID(REQUEST_SHORT_DETAIL, Label.class) .setLabelText(request.getShortDisplayString().getFormattedText().replace("§f", "")); - if(!cancellable(request)) + if (!cancellable(request)) { rowPane.findPaneOfTypeByID(REQUEST_CANCEL, ButtonImage.class).hide(); } - if(!fulfillable(request)) + if (!fulfillable(request)) { rowPane.findPaneOfTypeByID(REQUEST_FULLFIL, ButtonImage.class).hide(); } diff --git a/src/main/java/com/minecolonies/coremod/client/gui/AbstractWindowSkeleton.java b/src/main/java/com/minecolonies/coremod/client/gui/AbstractWindowSkeleton.java old mode 100644 new mode 100755 index 0f68a002c81..252da271ff9 --- a/src/main/java/com/minecolonies/coremod/client/gui/AbstractWindowSkeleton.java +++ b/src/main/java/com/minecolonies/coremod/client/gui/AbstractWindowSkeleton.java @@ -22,7 +22,7 @@ public abstract class AbstractWindowSkeleton extends Window implements ButtonHan { @NotNull private final HashMap> buttons; - + /** * Panes used by the generic page handler */ @@ -79,8 +79,7 @@ public final void registerButton(final String id, final Consumer