Switch ritual component gathering to a Consumer rather than direct list access
This commit is contained in:
parent
3a83b4ca8a
commit
b011623333
|
@ -119,7 +119,7 @@ public class ItemRitualDiviner extends Item implements IVariantProvider {
|
|||
if (ritual != null) {
|
||||
EnumFacing direction = getDirection(stack);
|
||||
List<RitualComponent> 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<RitualComponent> 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<RitualComponent> components = Lists.newArrayList();
|
||||
ritual.gatherComponents(components);
|
||||
ritual.gatherComponents(components::add);
|
||||
for (RitualComponent component : components) {
|
||||
if (!canPlaceRitualStone(component.getRuneType(), stack)) {
|
||||
return false;
|
||||
|
|
|
@ -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<RitualComponent> components);
|
||||
public abstract void gatherComponents(Consumer<RitualComponent> components);
|
||||
|
||||
protected final void addRune(List<RitualComponent> components, int offset1, int y, int offset2, EnumRuneType rune) {
|
||||
components.add(new RitualComponent(new BlockPos(offset1, y, offset2), rune));
|
||||
protected final void addRune(Consumer<RitualComponent> components, int offset1, int y, int offset2, EnumRuneType rune) {
|
||||
components.accept(new RitualComponent(new BlockPos(offset1, y, offset2), rune));
|
||||
}
|
||||
|
||||
protected final void addOffsetRunes(List<RitualComponent> components, int offset1, int offset2, int y, EnumRuneType rune) {
|
||||
protected final void addOffsetRunes(Consumer<RitualComponent> 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<RitualComponent> components, int offset, int y, EnumRuneType rune) {
|
||||
protected final void addCornerRunes(Consumer<RitualComponent> 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<RitualComponent> components, int offset, int y, EnumRuneType rune) {
|
||||
protected final void addParallelRunes(Consumer<RitualComponent> 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);
|
||||
|
|
|
@ -115,9 +115,9 @@ public class RitualRegistry {
|
|||
Ritual ritual1 = registry.get(o1);
|
||||
Ritual ritual2 = registry.get(o2);
|
||||
List<RitualComponent> first = Lists.newArrayList();
|
||||
ritual1.gatherComponents(first);
|
||||
ritual1.gatherComponents(first::add);
|
||||
List<RitualComponent> second = Lists.newArrayList();
|
||||
ritual2.gatherComponents(second);
|
||||
ritual2.gatherComponents(second::add);
|
||||
return first.size() > second.size() ? -1 : 0; // Put earlier if bigger
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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<AltarComponent> altarComponentsIterator = new ArrayList<>(EnumAltarTier.SIX.getAltarComponents()).iterator();
|
||||
|
@ -114,7 +114,7 @@ public class RitualAltarBuilder extends Ritual {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void gatherComponents(List<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
for (int i = -12; i <= -8; i++) {
|
||||
addRune(components, i, -6, 13, EnumRuneType.AIR);
|
||||
addRune(components, i, -6, -13, EnumRuneType.FIRE);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> 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
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.DUSK);
|
||||
addCornerRunes(components, 2, 0, EnumRuneType.FIRE);
|
||||
addOffsetRunes(components, 1, 2, 0, EnumRuneType.FIRE);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addCornerRunes(components, 1, 1, EnumRuneType.FIRE);
|
||||
addParallelRunes(components, 1, 0, EnumRuneType.WATER);
|
||||
}
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addParallelRunes(components, 1, 0, EnumRuneType.EARTH);
|
||||
addCornerRunes(components, 2, 0, EnumRuneType.EARTH);
|
||||
addParallelRunes(components, 1, 5, EnumRuneType.EARTH);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addParallelRunes(components, 1, 0, EnumRuneType.EARTH);
|
||||
addParallelRunes(components, 2, 0, EnumRuneType.FIRE);
|
||||
addCornerRunes(components, 2, 0, EnumRuneType.DUSK);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.AIR);
|
||||
addParallelRunes(components, 1, 1, EnumRuneType.DUSK);
|
||||
addParallelRunes(components, 1, -1, EnumRuneType.FIRE);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.WATER);
|
||||
addCornerRunes(components, 1, 1, EnumRuneType.WATER);
|
||||
}
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addCornerRunes(components, 2, 0, EnumRuneType.EARTH);
|
||||
addRune(components, 2, 0, 1, EnumRuneType.EARTH);
|
||||
addRune(components, 1, 0, 2, EnumRuneType.EARTH);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addParallelRunes(components, 1, 0, EnumRuneType.DUSK);
|
||||
addParallelRunes(components, 2, -1, EnumRuneType.WATER);
|
||||
addCornerRunes(components, 1, -1, EnumRuneType.AIR);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.EARTH);
|
||||
addCornerRunes(components, 1, 1, EnumRuneType.EARTH);
|
||||
}
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.AIR);
|
||||
addParallelRunes(components, 1, -1, EnumRuneType.DUSK);
|
||||
addParallelRunes(components, 1, 1, EnumRuneType.FIRE);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addParallelRunes(components, 3, 0, EnumRuneType.FIRE);
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.AIR);
|
||||
addOffsetRunes(components, 1, 2, 0, EnumRuneType.AIR);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.EARTH);
|
||||
addParallelRunes(components, 1, 0, EnumRuneType.WATER);
|
||||
}
|
||||
|
|
|
@ -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<RitualComponent> 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<RitualComponent> 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
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.AIR);
|
||||
addParallelRunes(components, 1, 0, EnumRuneType.AIR);
|
||||
}
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
for (int i = -1; i <= 1; i++)
|
||||
addCornerRunes(components, 1, i, EnumRuneType.AIR);
|
||||
}
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addParallelRunes(components, 1, 0, EnumRuneType.FIRE);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addRune(components, 0, 0, -1, EnumRuneType.AIR);
|
||||
addRune(components, 0, 0, -2, EnumRuneType.DUSK);
|
||||
addRune(components, 0, 1, -3, EnumRuneType.DUSK);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.EARTH);
|
||||
addParallelRunes(components, 2, 1, EnumRuneType.EARTH);
|
||||
addCornerRunes(components, 2, 1, EnumRuneType.AIR);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addParallelRunes(components, 2, 0, EnumRuneType.FIRE);
|
||||
addOffsetRunes(components, 3, 1, 0, EnumRuneType.AIR);
|
||||
addOffsetRunes(components, 4, 2, 0, EnumRuneType.AIR);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addRune(components, 3, 0, 3, EnumRuneType.EARTH);
|
||||
addRune(components, 3, 0, -3, EnumRuneType.EARTH);
|
||||
addRune(components, -3, 0, 3, EnumRuneType.EARTH);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addRune(components, 1, 0, 0, EnumRuneType.AIR);
|
||||
addRune(components, 2, 0, 0, EnumRuneType.WATER);
|
||||
addRune(components, -1, 0, 0, EnumRuneType.FIRE);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addRune(components, 1, 0, 1, EnumRuneType.WATER);
|
||||
addRune(components, 1, 0, -1, EnumRuneType.EARTH);
|
||||
addRune(components, -1, 0, -1, EnumRuneType.AIR);
|
||||
|
|
|
@ -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<RitualComponent> 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<RitualComponent> 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);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addRune(components, 0, 0, -2, EnumRuneType.DUSK);
|
||||
addRune(components, 1, 0, -1, EnumRuneType.AIR);
|
||||
addRune(components, -1, 0, -1, EnumRuneType.AIR);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addCornerRunes(components, 2, 0, EnumRuneType.WATER);
|
||||
addRune(components, -2, 0, -1, EnumRuneType.AIR);
|
||||
addRune(components, -1, 0, -2, EnumRuneType.AIR);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.DUSK);
|
||||
addCornerRunes(components, 2, 0, EnumRuneType.FIRE);
|
||||
addOffsetRunes(components, 1, 2, 0, EnumRuneType.FIRE);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.WATER);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addCornerRunes(components, 1, 0, EnumRuneType.FIRE);
|
||||
addCornerRunes(components, 2, -1, EnumRuneType.FIRE);
|
||||
addParallelRunes(components, 2, -1, EnumRuneType.EARTH);
|
||||
|
|
|
@ -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<RitualComponent> components) {
|
||||
public void gatherComponents(Consumer<RitualComponent> components) {
|
||||
addParallelRunes(components, 2, 0, EnumRuneType.AIR);
|
||||
addCornerRunes(components, 1, 1, EnumRuneType.AIR);
|
||||
addParallelRunes(components, 1, -1, EnumRuneType.AIR);
|
||||
|
|
|
@ -271,7 +271,7 @@ public class ClientHandler {
|
|||
double posZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;
|
||||
|
||||
List<RitualComponent> 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<RitualComponent> 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;
|
||||
|
|
|
@ -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<RitualComponent> components = Lists.newArrayList();
|
||||
ritual.gatherComponents(components);
|
||||
ritual.gatherComponents(components::add);
|
||||
|
||||
for (RitualComponent component : components) {
|
||||
BlockPos newPos = pos.add(component.getOffset(direction));
|
||||
|
|
Loading…
Reference in a new issue