diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java b/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java index e6e41c4c..d39fc897 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java @@ -119,7 +119,7 @@ public class ItemRitualDiviner extends Item implements IVariantProvider { if (ritual != null) { EnumFacing direction = getDirection(stack); List components = Lists.newArrayList(); - ritual.gatherComponents(components); + ritual.gatherComponents(components::add); for (RitualComponent component : components) { if (!canPlaceRitualStone(component.getRuneType(), stack)) { return false; @@ -227,7 +227,7 @@ public class ItemRitualDiviner extends Item implements IVariantProvider { tooltip.add(TextHelper.localize(tooltipBase + "currentDirection", Utils.toFancyCasing(getDirection(stack).getName()))); tooltip.add(""); List components = Lists.newArrayList(); - ritual.gatherComponents(components); + ritual.gatherComponents(components::add); int blankRunes = 0; int airRunes = 0; @@ -491,7 +491,7 @@ public class ItemRitualDiviner extends Item implements IVariantProvider { } List components = Lists.newArrayList(); - ritual.gatherComponents(components); + ritual.gatherComponents(components::add); for (RitualComponent component : components) { if (!canPlaceRitualStone(component.getRuneType(), stack)) { return false; diff --git a/src/main/java/WayofTime/bloodmagic/ritual/Ritual.java b/src/main/java/WayofTime/bloodmagic/ritual/Ritual.java index 3ae656fa..472fa682 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/Ritual.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/Ritual.java @@ -15,6 +15,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import java.util.*; import java.util.Map.Entry; +import java.util.function.Consumer; /** * Abstract class for creating new rituals. Rituals need be registered with @@ -261,13 +262,13 @@ public abstract class Ritual { } } - public abstract void gatherComponents(List components); + public abstract void gatherComponents(Consumer components); - protected final void addRune(List components, int offset1, int y, int offset2, EnumRuneType rune) { - components.add(new RitualComponent(new BlockPos(offset1, y, offset2), rune)); + protected final void addRune(Consumer components, int offset1, int y, int offset2, EnumRuneType rune) { + components.accept(new RitualComponent(new BlockPos(offset1, y, offset2), rune)); } - protected final void addOffsetRunes(List components, int offset1, int offset2, int y, EnumRuneType rune) { + protected final void addOffsetRunes(Consumer components, int offset1, int offset2, int y, EnumRuneType rune) { addRune(components, offset1, y, offset2, rune); addRune(components, offset2, y, offset1, rune); addRune(components, offset1, y, -offset2, rune); @@ -278,14 +279,14 @@ public abstract class Ritual { addRune(components, -offset2, y, -offset1, rune); } - protected final void addCornerRunes(List components, int offset, int y, EnumRuneType rune) { + protected final void addCornerRunes(Consumer components, int offset, int y, EnumRuneType rune) { addRune(components, offset, y, offset, rune); addRune(components, offset, y, -offset, rune); addRune(components, -offset, y, -offset, rune); addRune(components, -offset, y, offset, rune); } - protected final void addParallelRunes(List components, int offset, int y, EnumRuneType rune) { + protected final void addParallelRunes(Consumer components, int offset, int y, EnumRuneType rune) { addRune(components, offset, y, 0, rune); addRune(components, -offset, y, 0, rune); addRune(components, 0, y, -offset, rune); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualRegistry.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualRegistry.java index af289560..66039e2b 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualRegistry.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualRegistry.java @@ -115,9 +115,9 @@ public class RitualRegistry { Ritual ritual1 = registry.get(o1); Ritual ritual2 = registry.get(o2); List first = Lists.newArrayList(); - ritual1.gatherComponents(first); + ritual1.gatherComponents(first::add); List second = Lists.newArrayList(); - ritual2.gatherComponents(second); + ritual2.gatherComponents(second::add); return first.size() > second.size() ? -1 : 0; // Put earlier if bigger }); } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAltarBuilder.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAltarBuilder.java index 145ac180..37125032 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAltarBuilder.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAltarBuilder.java @@ -27,7 +27,7 @@ import net.minecraftforge.items.IItemHandler; import java.util.ArrayList; import java.util.Iterator; -import java.util.List; +import java.util.function.Consumer; public class RitualAltarBuilder extends Ritual { private Iterator altarComponentsIterator = new ArrayList<>(EnumAltarTier.SIX.getAltarComponents()).iterator(); @@ -114,7 +114,7 @@ public class RitualAltarBuilder extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { for (int i = -12; i <= -8; i++) { addRune(components, i, -6, 13, EnumRuneType.AIR); addRune(components, i, -6, -13, EnumRuneType.FIRE); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAnimalGrowth.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAnimalGrowth.java index eb271087..f7724e6a 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAnimalGrowth.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAnimalGrowth.java @@ -19,6 +19,7 @@ import net.minecraft.world.World; import net.minecraftforge.items.IItemHandler; import java.util.List; +import java.util.function.Consumer; public class RitualAnimalGrowth extends Ritual { public static final double rawWillDrain = 0.05; @@ -168,18 +169,18 @@ public class RitualAnimalGrowth extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addParallelRunes(components, 2, 0, EnumRuneType.DUSK); addParallelRunes(components, 1, 0, EnumRuneType.WATER); - components.add(new RitualComponent(new BlockPos(1, 0, 2), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(1, 0, -2), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(-1, 0, 2), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(-1, 0, -2), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(2, 0, 1), EnumRuneType.AIR)); - components.add(new RitualComponent(new BlockPos(2, 0, -1), EnumRuneType.AIR)); - components.add(new RitualComponent(new BlockPos(-2, 0, 1), EnumRuneType.AIR)); - components.add(new RitualComponent(new BlockPos(-2, 0, -1), EnumRuneType.AIR)); + components.accept(new RitualComponent(new BlockPos(1, 0, 2), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(1, 0, -2), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(-1, 0, 2), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(-1, 0, -2), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(2, 0, 1), EnumRuneType.AIR)); + components.accept(new RitualComponent(new BlockPos(2, 0, -1), EnumRuneType.AIR)); + components.accept(new RitualComponent(new BlockPos(-2, 0, 1), EnumRuneType.AIR)); + components.accept(new RitualComponent(new BlockPos(-2, 0, -1), EnumRuneType.AIR)); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualArmourEvolve.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualArmourEvolve.java index 9c602679..90447806 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualArmourEvolve.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualArmourEvolve.java @@ -12,6 +12,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.List; +import java.util.function.Consumer; public class RitualArmourEvolve extends Ritual { public static final String CHECK_RANGE = "fillRange"; @@ -64,8 +65,7 @@ public class RitualArmourEvolve extends Ritual { } @Override - public void gatherComponents(List components) { - + public void gatherComponents(Consumer components) { addCornerRunes(components, 1, 0, EnumRuneType.DUSK); addCornerRunes(components, 2, 0, EnumRuneType.FIRE); addOffsetRunes(components, 1, 2, 0, EnumRuneType.FIRE); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCobblestone.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCobblestone.java index abae34aa..cf481fa9 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCobblestone.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCobblestone.java @@ -10,7 +10,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import java.util.List; +import java.util.function.Consumer; public class RitualCobblestone extends Ritual { @@ -83,8 +83,7 @@ public class RitualCobblestone extends Ritual { } @Override - public void gatherComponents(List components) { - + public void gatherComponents(Consumer components) { addCornerRunes(components, 1, 1, EnumRuneType.FIRE); addParallelRunes(components, 1, 0, EnumRuneType.WATER); } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualContainment.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualContainment.java index b7c58ff3..4ad43168 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualContainment.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualContainment.java @@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import java.util.List; +import java.util.function.Consumer; public class RitualContainment extends Ritual { public static final String CONTAINMENT_RANGE = "containmentRange"; @@ -56,7 +56,7 @@ public class RitualContainment extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addParallelRunes(components, 1, 0, EnumRuneType.EARTH); addCornerRunes(components, 2, 0, EnumRuneType.EARTH); addParallelRunes(components, 1, 5, EnumRuneType.EARTH); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrushing.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrushing.java index 06d3bc1b..caefd268 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrushing.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrushing.java @@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.function.Consumer; public class RitualCrushing extends Ritual { public static final String CRUSHING_RANGE = "crushingRange"; @@ -251,7 +252,7 @@ public class RitualCrushing extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addParallelRunes(components, 1, 0, EnumRuneType.EARTH); addParallelRunes(components, 2, 0, EnumRuneType.FIRE); addCornerRunes(components, 2, 0, EnumRuneType.DUSK); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrystalHarvest.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrystalHarvest.java index 8eb060a1..62d86acc 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrystalHarvest.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualCrystalHarvest.java @@ -8,7 +8,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import java.util.List; +import java.util.function.Consumer; public class RitualCrystalHarvest extends Ritual { public static final String CRYSTAL_RANGE = "crystal"; @@ -67,7 +67,7 @@ public class RitualCrystalHarvest extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addCornerRunes(components, 1, 0, EnumRuneType.AIR); addParallelRunes(components, 1, 1, EnumRuneType.DUSK); addParallelRunes(components, 1, -1, EnumRuneType.FIRE); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualEllipsoid.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualEllipsoid.java index 631b35b7..1def76f5 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualEllipsoid.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualEllipsoid.java @@ -1,6 +1,6 @@ package WayofTime.bloodmagic.ritual.types; -import java.util.List; +import java.util.function.Consumer; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; @@ -215,7 +215,7 @@ public class RitualEllipsoid extends Ritual // } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addCornerRunes(components, 1, 0, EnumRuneType.WATER); addCornerRunes(components, 1, 1, EnumRuneType.WATER); } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualExpulsion.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualExpulsion.java index 1be8f406..10209075 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualExpulsion.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualExpulsion.java @@ -23,6 +23,7 @@ import net.minecraftforge.items.IItemHandler; import java.util.List; import java.util.Random; import java.util.UUID; +import java.util.function.Consumer; public class RitualExpulsion extends Ritual { public static final String EXPULSION_RANGE = "expulsionRange"; @@ -189,7 +190,7 @@ public class RitualExpulsion extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addCornerRunes(components, 2, 0, EnumRuneType.EARTH); addRune(components, 2, 0, 1, EnumRuneType.EARTH); addRune(components, 1, 0, 2, EnumRuneType.EARTH); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFeatheredKnife.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFeatheredKnife.java index 476ab93c..dd347421 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFeatheredKnife.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFeatheredKnife.java @@ -24,6 +24,7 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import java.util.List; +import java.util.function.Consumer; public class RitualFeatheredKnife extends Ritual { public static final String ALTAR_RANGE = "altar"; @@ -184,7 +185,7 @@ public class RitualFeatheredKnife extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addParallelRunes(components, 1, 0, EnumRuneType.DUSK); addParallelRunes(components, 2, -1, EnumRuneType.WATER); addCornerRunes(components, 1, -1, EnumRuneType.AIR); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFelling.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFelling.java index 31813dea..c4b33b27 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFelling.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFelling.java @@ -16,7 +16,7 @@ import net.minecraftforge.items.ItemHandlerHelper; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Iterator; -import java.util.List; +import java.util.function.Consumer; public class RitualFelling extends Ritual { public static final String FELLING_RANGE = "fellingRange"; @@ -86,7 +86,7 @@ public class RitualFelling extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addCornerRunes(components, 1, 0, EnumRuneType.EARTH); addCornerRunes(components, 1, 1, EnumRuneType.EARTH); } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualForsakenSoul.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualForsakenSoul.java index 8767e150..ee49bbcd 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualForsakenSoul.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualForsakenSoul.java @@ -18,6 +18,7 @@ import net.minecraftforge.fml.common.registry.EntityRegistry; import java.util.ArrayList; import java.util.List; +import java.util.function.Consumer; public class RitualForsakenSoul extends Ritual { public static final String CRYSTAL_RANGE = "crystal"; @@ -178,7 +179,7 @@ public class RitualForsakenSoul extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addCornerRunes(components, 1, 0, EnumRuneType.AIR); addParallelRunes(components, 1, -1, EnumRuneType.DUSK); addParallelRunes(components, 1, 1, EnumRuneType.FIRE); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFullStomach.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFullStomach.java index 35fa103d..f0a739ea 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFullStomach.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFullStomach.java @@ -13,6 +13,7 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import java.util.List; +import java.util.function.Consumer; public class RitualFullStomach extends Ritual { public static final String FILL_RANGE = "fillRange"; @@ -92,7 +93,7 @@ public class RitualFullStomach extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addParallelRunes(components, 3, 0, EnumRuneType.FIRE); addCornerRunes(components, 1, 0, EnumRuneType.AIR); addOffsetRunes(components, 1, 2, 0, EnumRuneType.AIR); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualGreenGrove.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualGreenGrove.java index 79f3b0f2..f2aa95ad 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualGreenGrove.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualGreenGrove.java @@ -24,6 +24,7 @@ import net.minecraft.world.World; import java.util.List; import java.util.Random; +import java.util.function.Consumer; public class RitualGreenGrove extends Ritual { public static final String GROW_RANGE = "growing"; @@ -258,7 +259,7 @@ public class RitualGreenGrove extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addCornerRunes(components, 1, 0, EnumRuneType.EARTH); addParallelRunes(components, 1, 0, EnumRuneType.WATER); } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualHarvest.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualHarvest.java index c554cc83..faa582ad 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualHarvest.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualHarvest.java @@ -17,6 +17,7 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; import java.util.List; +import java.util.function.Consumer; /** * This ritual uses registered {@link IHarvestHandler}'s to harvest blocks. @@ -74,31 +75,31 @@ public class RitualHarvest extends Ritual { } @Override - public void gatherComponents(List components) { - components.add(new RitualComponent(new BlockPos(1, 0, 1), EnumRuneType.DUSK)); - components.add(new RitualComponent(new BlockPos(1, 0, -1), EnumRuneType.DUSK)); - components.add(new RitualComponent(new BlockPos(-1, 0, -1), EnumRuneType.DUSK)); - components.add(new RitualComponent(new BlockPos(-1, 0, 1), EnumRuneType.DUSK)); - components.add(new RitualComponent(new BlockPos(2, 0, 0), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(-2, 0, 0), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(0, 0, 2), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(0, 0, -2), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(3, 0, 1), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(3, 0, -1), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(-3, 0, 1), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(-3, 0, -1), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(1, 0, 3), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(-1, 0, 3), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(1, 0, -3), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(-1, 0, -3), EnumRuneType.EARTH)); - components.add(new RitualComponent(new BlockPos(2, 0, 3), EnumRuneType.WATER)); - components.add(new RitualComponent(new BlockPos(3, 0, 2), EnumRuneType.WATER)); - components.add(new RitualComponent(new BlockPos(2, 0, -3), EnumRuneType.WATER)); - components.add(new RitualComponent(new BlockPos(-3, 0, 2), EnumRuneType.WATER)); - components.add(new RitualComponent(new BlockPos(-2, 0, 3), EnumRuneType.WATER)); - components.add(new RitualComponent(new BlockPos(3, 0, -2), EnumRuneType.WATER)); - components.add(new RitualComponent(new BlockPos(-2, 0, -3), EnumRuneType.WATER)); - components.add(new RitualComponent(new BlockPos(-3, 0, -2), EnumRuneType.WATER)); + public void gatherComponents(Consumer components) { + components.accept(new RitualComponent(new BlockPos(1, 0, 1), EnumRuneType.DUSK)); + components.accept(new RitualComponent(new BlockPos(1, 0, -1), EnumRuneType.DUSK)); + components.accept(new RitualComponent(new BlockPos(-1, 0, -1), EnumRuneType.DUSK)); + components.accept(new RitualComponent(new BlockPos(-1, 0, 1), EnumRuneType.DUSK)); + components.accept(new RitualComponent(new BlockPos(2, 0, 0), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(-2, 0, 0), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(0, 0, 2), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(0, 0, -2), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(3, 0, 1), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(3, 0, -1), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(-3, 0, 1), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(-3, 0, -1), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(1, 0, 3), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(-1, 0, 3), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(1, 0, -3), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(-1, 0, -3), EnumRuneType.EARTH)); + components.accept(new RitualComponent(new BlockPos(2, 0, 3), EnumRuneType.WATER)); + components.accept(new RitualComponent(new BlockPos(3, 0, 2), EnumRuneType.WATER)); + components.accept(new RitualComponent(new BlockPos(2, 0, -3), EnumRuneType.WATER)); + components.accept(new RitualComponent(new BlockPos(-3, 0, 2), EnumRuneType.WATER)); + components.accept(new RitualComponent(new BlockPos(-2, 0, 3), EnumRuneType.WATER)); + components.accept(new RitualComponent(new BlockPos(3, 0, -2), EnumRuneType.WATER)); + components.accept(new RitualComponent(new BlockPos(-2, 0, -3), EnumRuneType.WATER)); + components.accept(new RitualComponent(new BlockPos(-3, 0, -2), EnumRuneType.WATER)); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualInterdiction.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualInterdiction.java index 44d48d1d..a9eb84b3 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualInterdiction.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualInterdiction.java @@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import java.util.List; +import java.util.function.Consumer; public class RitualInterdiction extends Ritual { public static final String INTERDICTION_RANGE = "interdictionRange"; @@ -60,7 +60,7 @@ public class RitualInterdiction extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addCornerRunes(components, 1, 0, EnumRuneType.AIR); addParallelRunes(components, 1, 0, EnumRuneType.AIR); } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualJumping.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualJumping.java index f594e44b..e34a008d 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualJumping.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualJumping.java @@ -9,6 +9,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.List; +import java.util.function.Consumer; public class RitualJumping extends Ritual { public static final String JUMP_RANGE = "jumpRange"; @@ -68,7 +69,7 @@ public class RitualJumping extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { for (int i = -1; i <= 1; i++) addCornerRunes(components, 1, i, EnumRuneType.AIR); } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualLava.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualLava.java index 89e9b8ec..56e32be6 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualLava.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualLava.java @@ -26,6 +26,7 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import java.util.List; +import java.util.function.Consumer; public class RitualLava extends Ritual { public static final String LAVA_RANGE = "lavaRange"; @@ -232,7 +233,7 @@ public class RitualLava extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addParallelRunes(components, 1, 0, EnumRuneType.FIRE); } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualLivingArmourDowngrade.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualLivingArmourDowngrade.java index c22915bc..d0f9e4b5 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualLivingArmourDowngrade.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualLivingArmourDowngrade.java @@ -25,6 +25,7 @@ import net.minecraftforge.items.IItemHandler; import java.util.ArrayList; import java.util.List; +import java.util.function.Consumer; public class RitualLivingArmourDowngrade extends Ritual { public static final String DOWNGRADE_RANGE = "containmentRange"; @@ -162,7 +163,7 @@ public class RitualLivingArmourDowngrade extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addRune(components, 0, 0, -1, EnumRuneType.AIR); addRune(components, 0, 0, -2, EnumRuneType.DUSK); addRune(components, 0, 1, -3, EnumRuneType.DUSK); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualMagnetic.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualMagnetic.java index 2950cc63..ba7fe38b 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualMagnetic.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualMagnetic.java @@ -11,7 +11,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; -import java.util.List; +import java.util.function.Consumer; public class RitualMagnetic extends Ritual { public static final String PLACEMENT_RANGE = "placementRange"; @@ -121,7 +121,7 @@ public class RitualMagnetic extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addCornerRunes(components, 1, 0, EnumRuneType.EARTH); addParallelRunes(components, 2, 1, EnumRuneType.EARTH); addCornerRunes(components, 2, 1, EnumRuneType.AIR); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualMeteor.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualMeteor.java index 95edf4ed..e8b9c652 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualMeteor.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualMeteor.java @@ -13,6 +13,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.List; +import java.util.function.Consumer; public class RitualMeteor extends Ritual { public static final String ITEM_RANGE = "itemRange"; @@ -94,7 +95,7 @@ public class RitualMeteor extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addParallelRunes(components, 2, 0, EnumRuneType.FIRE); addOffsetRunes(components, 3, 1, 0, EnumRuneType.AIR); addOffsetRunes(components, 4, 2, 0, EnumRuneType.AIR); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualPlacer.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualPlacer.java index be35f269..d18f1cb5 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualPlacer.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualPlacer.java @@ -13,7 +13,7 @@ import net.minecraft.world.World; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; -import java.util.List; +import java.util.function.Consumer; public class RitualPlacer extends Ritual { public static final String PLACER_RANGE = "placerRange"; @@ -80,7 +80,7 @@ public class RitualPlacer extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addRune(components, 3, 0, 3, EnumRuneType.EARTH); addRune(components, 3, 0, -3, EnumRuneType.EARTH); addRune(components, -3, 0, 3, EnumRuneType.EARTH); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualPortal.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualPortal.java index da2c5a7d..fd3b83f4 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualPortal.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualPortal.java @@ -17,8 +17,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.ForgeRegistries; -import java.util.List; import java.util.UUID; +import java.util.function.Consumer; public class RitualPortal extends Ritual { @@ -183,7 +183,7 @@ public class RitualPortal extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addRune(components, 1, 0, 0, EnumRuneType.AIR); addRune(components, 2, 0, 0, EnumRuneType.WATER); addRune(components, -1, 0, 0, EnumRuneType.FIRE); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualPump.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualPump.java index b61c1312..50667a6a 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualPump.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualPump.java @@ -20,6 +20,7 @@ import org.apache.commons.lang3.tuple.Pair; import java.util.Iterator; import java.util.List; +import java.util.function.Consumer; public class RitualPump extends Ritual { public static final String PUMP_RANGE = "pumpRange"; @@ -90,7 +91,7 @@ public class RitualPump extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addRune(components, 1, 0, 1, EnumRuneType.WATER); addRune(components, 1, 0, -1, EnumRuneType.EARTH); addRune(components, -1, 0, -1, EnumRuneType.AIR); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualRegeneration.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualRegeneration.java index c547d6b8..78e145ba 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualRegeneration.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualRegeneration.java @@ -16,6 +16,7 @@ import net.minecraft.world.World; import java.util.Collections; import java.util.List; +import java.util.function.Consumer; public class RitualRegeneration extends Ritual { public static final String HEAL_RANGE = "heal"; @@ -152,19 +153,19 @@ public class RitualRegeneration extends Ritual { } @Override - public void gatherComponents(List components) { - components.add(new RitualComponent(new BlockPos(4, 0, 0), EnumRuneType.AIR)); - components.add(new RitualComponent(new BlockPos(5, 0, -1), EnumRuneType.AIR)); - components.add(new RitualComponent(new BlockPos(5, 0, 1), EnumRuneType.AIR)); - components.add(new RitualComponent(new BlockPos(-4, 0, 0), EnumRuneType.AIR)); - components.add(new RitualComponent(new BlockPos(-5, 0, -1), EnumRuneType.AIR)); - components.add(new RitualComponent(new BlockPos(-5, 0, 1), EnumRuneType.AIR)); - components.add(new RitualComponent(new BlockPos(0, 0, 4), EnumRuneType.FIRE)); - components.add(new RitualComponent(new BlockPos(1, 0, 5), EnumRuneType.FIRE)); - components.add(new RitualComponent(new BlockPos(-1, 0, 5), EnumRuneType.FIRE)); - components.add(new RitualComponent(new BlockPos(0, 0, -4), EnumRuneType.FIRE)); - components.add(new RitualComponent(new BlockPos(1, 0, -5), EnumRuneType.FIRE)); - components.add(new RitualComponent(new BlockPos(-1, 0, -5), EnumRuneType.FIRE)); + public void gatherComponents(Consumer components) { + components.accept(new RitualComponent(new BlockPos(4, 0, 0), EnumRuneType.AIR)); + components.accept(new RitualComponent(new BlockPos(5, 0, -1), EnumRuneType.AIR)); + components.accept(new RitualComponent(new BlockPos(5, 0, 1), EnumRuneType.AIR)); + components.accept(new RitualComponent(new BlockPos(-4, 0, 0), EnumRuneType.AIR)); + components.accept(new RitualComponent(new BlockPos(-5, 0, -1), EnumRuneType.AIR)); + components.accept(new RitualComponent(new BlockPos(-5, 0, 1), EnumRuneType.AIR)); + components.accept(new RitualComponent(new BlockPos(0, 0, 4), EnumRuneType.FIRE)); + components.accept(new RitualComponent(new BlockPos(1, 0, 5), EnumRuneType.FIRE)); + components.accept(new RitualComponent(new BlockPos(-1, 0, 5), EnumRuneType.FIRE)); + components.accept(new RitualComponent(new BlockPos(0, 0, -4), EnumRuneType.FIRE)); + components.accept(new RitualComponent(new BlockPos(1, 0, -5), EnumRuneType.FIRE)); + components.accept(new RitualComponent(new BlockPos(-1, 0, -5), EnumRuneType.FIRE)); addOffsetRunes(components, 3, 5, 0, EnumRuneType.WATER); addCornerRunes(components, 3, 0, EnumRuneType.DUSK); addOffsetRunes(components, 4, 5, 0, EnumRuneType.EARTH); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualSpeed.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualSpeed.java index 3bf3ab59..cc9390f9 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualSpeed.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualSpeed.java @@ -14,6 +14,7 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import java.util.List; +import java.util.function.Consumer; public class RitualSpeed extends Ritual { public static final String SPEED_RANGE = "sanicRange"; @@ -152,7 +153,7 @@ public class RitualSpeed extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addRune(components, 0, 0, -2, EnumRuneType.DUSK); addRune(components, 1, 0, -1, EnumRuneType.AIR); addRune(components, -1, 0, -1, EnumRuneType.AIR); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualSuppression.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualSuppression.java index 964744e8..8866eee8 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualSuppression.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualSuppression.java @@ -9,7 +9,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import java.util.List; +import java.util.function.Consumer; public class RitualSuppression extends Ritual { public static final String SUPPRESSION_RANGE = "suppressionRange"; @@ -56,7 +56,7 @@ public class RitualSuppression extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addCornerRunes(components, 2, 0, EnumRuneType.WATER); addRune(components, -2, 0, -1, EnumRuneType.AIR); addRune(components, -1, 0, -2, EnumRuneType.AIR); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualUpgradeRemove.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualUpgradeRemove.java index c504e747..65120c45 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualUpgradeRemove.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualUpgradeRemove.java @@ -19,6 +19,7 @@ import net.minecraft.world.World; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; +import java.util.function.Consumer; public class RitualUpgradeRemove extends Ritual { public static final String CHECK_RANGE = "fillRange"; @@ -102,7 +103,7 @@ public class RitualUpgradeRemove extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addCornerRunes(components, 1, 0, EnumRuneType.DUSK); addCornerRunes(components, 2, 0, EnumRuneType.FIRE); addOffsetRunes(components, 1, 2, 0, EnumRuneType.FIRE); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualWater.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualWater.java index 74867148..569998a1 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualWater.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualWater.java @@ -6,7 +6,7 @@ import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import java.util.List; +import java.util.function.Consumer; public class RitualWater extends Ritual { public static final String WATER_RANGE = "waterRange"; @@ -57,7 +57,7 @@ public class RitualWater extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addCornerRunes(components, 1, 0, EnumRuneType.WATER); } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualWellOfSuffering.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualWellOfSuffering.java index 51cf4e4c..8d07813f 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualWellOfSuffering.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualWellOfSuffering.java @@ -15,6 +15,7 @@ import net.minecraftforge.fml.common.registry.EntityEntry; import net.minecraftforge.fml.common.registry.EntityRegistry; import java.util.List; +import java.util.function.Consumer; public class RitualWellOfSuffering extends Ritual { public static final String ALTAR_RANGE = "altar"; @@ -117,7 +118,7 @@ public class RitualWellOfSuffering extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addCornerRunes(components, 1, 0, EnumRuneType.FIRE); addCornerRunes(components, 2, -1, EnumRuneType.FIRE); addParallelRunes(components, 2, -1, EnumRuneType.EARTH); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualZephyr.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualZephyr.java index d4a15920..d21d4e8c 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualZephyr.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualZephyr.java @@ -11,6 +11,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.List; +import java.util.function.Consumer; public class RitualZephyr extends Ritual { public static final String ZEPHYR_RANGE = "zephyrRange"; @@ -80,7 +81,7 @@ public class RitualZephyr extends Ritual { } @Override - public void gatherComponents(List components) { + public void gatherComponents(Consumer components) { addParallelRunes(components, 2, 0, EnumRuneType.AIR); addCornerRunes(components, 1, 1, EnumRuneType.AIR); addParallelRunes(components, 1, -1, EnumRuneType.AIR); diff --git a/src/main/java/WayofTime/bloodmagic/util/handler/event/ClientHandler.java b/src/main/java/WayofTime/bloodmagic/util/handler/event/ClientHandler.java index a63f727e..472ed94f 100644 --- a/src/main/java/WayofTime/bloodmagic/util/handler/event/ClientHandler.java +++ b/src/main/java/WayofTime/bloodmagic/util/handler/event/ClientHandler.java @@ -271,7 +271,7 @@ public class ClientHandler { double posZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; List components = Lists.newArrayList(); - ritual.gatherComponents(components); + ritual.gatherComponents(components::add); for (RitualComponent ritualComponent : components) { vX = vec3.add(ritualComponent.getOffset(direction)); double minX = vX.getX() - posX; @@ -350,7 +350,7 @@ public class ClientHandler { double posZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; List components = Lists.newArrayList(); - ritual.gatherComponents(components); + ritual.gatherComponents(components::add); for (RitualComponent ritualComponent : components) { vX = vec3.add(ritualComponent.getOffset(direction)); double minX = vX.getX() - posX; diff --git a/src/main/java/WayofTime/bloodmagic/util/helper/RitualHelper.java b/src/main/java/WayofTime/bloodmagic/util/helper/RitualHelper.java index 5a73de68..fa6e3963 100644 --- a/src/main/java/WayofTime/bloodmagic/util/helper/RitualHelper.java +++ b/src/main/java/WayofTime/bloodmagic/util/helper/RitualHelper.java @@ -15,7 +15,6 @@ import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; -import java.util.ArrayList; import java.util.List; public class RitualHelper { @@ -79,7 +78,7 @@ public class RitualHelper { } List components = Lists.newArrayList(); - ritual.gatherComponents(components); + ritual.gatherComponents(components::add); for (RitualComponent component : components) { BlockPos newPos = pos.add(component.getOffset(direction));