Big code cleanup

This commit is contained in:
mezz committed 2016-05-01 15:34:11 -07:00
1 parent 1b58077904
commit a3363fb4bc
132 files changed
+1587 -1863

No files matched your search

@@ -101,39 +101,39 @@ public class PluginFarming extends BlankForestryPlugin {
public void preInit() {
MinecraftForge.EVENT_BUS.register(this);
Farmables.farmables.put("farmArboreal", new ArrayList<IFarmable>());
Farmables.farmables.put("farmArboreal", new ArrayList<>());
Farmables.farmables.get("farmArboreal").add(new FarmableVanillaSapling());
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE)) {
Farmables.farmables.get("farmArboreal").add(new FarmableGE());
}
Farmables.farmables.put("farmOrchard", new ArrayList<IFarmable>());
Farmables.farmables.put("farmOrchard", new ArrayList<>());
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.wheat, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.potatoes, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.carrots, 7));
Farmables.farmables.put("farmShroom", new ArrayList<IFarmable>());
Farmables.farmables.put("farmShroom", new ArrayList<>());
Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.brown_mushroom, 0));
Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.red_mushroom, 0));
Farmables.farmables.put("farmWheat", new ArrayList<IFarmable>());
Farmables.farmables.put("farmWheat", new ArrayList<>());
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(new ItemStack(Items.wheat_seeds), Blocks.wheat, 7));
Farmables.farmables.put("farmGourd", new ArrayList<IFarmable>());
Farmables.farmables.put("farmGourd", new ArrayList<>());
Farmables.farmables.get("farmGourd").add(
new FarmableGourd(new ItemStack(Items.pumpkin_seeds), new ItemStack(Blocks.pumpkin_stem), new ItemStack(Blocks.pumpkin)));
Farmables.farmables.get("farmGourd").add(new FarmableGourd(new ItemStack(Items.melon_seeds), new ItemStack(Blocks.melon_stem), new ItemStack(Blocks.melon_block)));
Farmables.farmables.put("farmInfernal", new ArrayList<IFarmable>());
Farmables.farmables.put("farmInfernal", new ArrayList<>());
Farmables.farmables.get("farmInfernal").add(new FarmableGenericCrop(new ItemStack(Items.nether_wart), Blocks.nether_wart, 3));
Farmables.farmables.put("farmPoales", new ArrayList<IFarmable>());
Farmables.farmables.put("farmPoales", new ArrayList<>());
Farmables.farmables.get("farmPoales").add(new FarmableStacked(Blocks.reeds, 3, 0));
Farmables.farmables.put("farmSucculentes", new ArrayList<IFarmable>());
Farmables.farmables.put("farmSucculentes", new ArrayList<>());
Farmables.farmables.get("farmSucculentes").add(new FarmableStacked(Blocks.cactus, 3, 0));
Farmables.farmables.put("farmVegetables", new ArrayList<IFarmable>());
Farmables.farmables.put("farmVegetables", new ArrayList<>());
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.potato), Blocks.potatoes, 7));
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.carrot), Blocks.carrots, 7));
@@ -1,10 +1,14 @@
package forestry.farming.models;
import javax.annotation.Nonnull;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.property.IExtendedBlockState;
import forestry.api.core.IModelBaker;
import forestry.core.models.ModelBlockOverlay;
import forestry.farming.blocks.BlockFarm;
@@ -18,7 +22,7 @@ public class ModelFarmBlock extends ModelBlockOverlay<BlockFarm> {
}
@Override
public void bakeInventoryBlock(BlockFarm blockFarm, ItemStack item, IModelBaker baker) {
public void bakeInventoryBlock(@Nonnull BlockFarm blockFarm, @Nonnull ItemStack item, @Nonnull IModelBaker baker) {
if (blockFarm == null) {
return;
}
@@ -32,7 +36,7 @@ public class ModelFarmBlock extends ModelBlockOverlay<BlockFarm> {
}
@Override
public void bakeWorldBlock(BlockFarm blockFarm, IBlockAccess world, BlockPos pos, IExtendedBlockState stateExtended, IModelBaker baker) {
public void bakeWorldBlock(@Nonnull BlockFarm blockFarm, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IExtendedBlockState stateExtended, @Nonnull IModelBaker baker) {
TileFarm farm = (TileFarm) world.getTileEntity(pos);
@@ -500,8 +500,8 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
if (stage == Stage.HARVEST) {
Collection<ICrop> harvested = harvestTargets(farmTargets, logic, farmListeners);
farmWorkStatus.didWork = harvested.size() > 0;
if (harvested.size() > 0) {
farmWorkStatus.didWork = !harvested.isEmpty();
if (!harvested.isEmpty()) {
pendingCrops.addAll(harvested);
harvestProvider = logic;
}
@@ -684,7 +684,7 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
if (farmTargets != null) {
for (FarmTarget target : farmTargets) {
Collection<ICrop> harvested = harvestTarget(target, logic, farmListeners);
if (harvested.size() > 0) {
if (!harvested.isEmpty()) {
return harvested;
}
}
@@ -696,7 +696,7 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
private static Collection<ICrop> harvestTarget(FarmTarget target, IFarmLogic logic, Iterable<IFarmListener> farmListeners) {
BlockPos pos = new BlockPos(target.getStart().getX(), target.getStart().getX() + target.getYOffset(), target.getStart().getZ());
Collection<ICrop> harvested = logic.harvest(pos, target.getDirection(), target.getExtent());
if (harvested == null || harvested.size() == 0) {
if (harvested == null || harvested.isEmpty()) {
return Collections.emptyList();
}
@@ -30,7 +30,7 @@ public class FarmingTriggers {
public static List<ITriggerExternal> allExternalTriggers;
public static void initialize() {
allExternalTriggers = Arrays.<ITriggerExternal>asList(
allExternalTriggers = Arrays.asList(
lowResourceLiquid50 = new TriggerLowLiquid("lowLiquid.50", 0.5f),
lowResourceLiquid25 = new TriggerLowLiquid("lowLiquid.25", 0.25f),
lowSoil128 = new TriggerLowSoil(128),
@@ -43,11 +43,6 @@ public class TriggerLowSoil extends Trigger {
return 1;
}
@Override
public int minParameters() {
return 0;
}
/**
* Return true if the tile given in parameter activates the trigger, given
* the parameters.