Changed formatting to have bracing on a new line

This commit is contained in:
WayofTime 2015-12-30 15:34:40 -05:00
parent e5eddd6c45
commit e48eedb874
189 changed files with 6092 additions and 4041 deletions

View file

@ -6,13 +6,16 @@ import java.util.List;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
public class AreaDescriptor {
public List<BlockPos> getContainedPositions() {
return new ArrayList();
}
public AxisAlignedBB getAABB() {
return null;
}
public class AreaDescriptor
{
public List<BlockPos> getContainedPositions()
{
return new ArrayList();
}
public AxisAlignedBB getAABB()
{
return null;
}
}

View file

@ -6,34 +6,33 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum EnumRuneType implements IStringSerializable {
public enum EnumRuneType implements IStringSerializable
{
BLANK,
WATER,
FIRE,
EARTH,
AIR,
DUSK,
DAWN;
BLANK, WATER, FIRE, EARTH, AIR, DUSK, DAWN;
public static EnumRuneType byMetadata(int meta) {
public static EnumRuneType byMetadata(int meta)
{
if (meta < 0 || meta >= values().length)
meta = 0;
return values()[meta];
}
public ItemStack getScribeStack() {
public ItemStack getScribeStack()
{
return new ItemStack(BloodMagicAPI.getItem(BloodMagicAPI.SCRIBE), 1, ordinal());
}
@Override
public String toString() {
public String toString()
{
return name().toLowerCase(Locale.ENGLISH);
}
@Override
public String getName() {
public String getName()
{
return this.toString();
}

View file

@ -8,10 +8,11 @@ import net.minecraft.world.World;
/**
* This interface is for internal implementation only.
*
*
* It is provided via the API for easy obtaining of basic data.
*/
public interface IMasterRitualStone {
public interface IMasterRitualStone
{
String getOwner();

View file

@ -5,14 +5,16 @@ import net.minecraft.world.World;
/**
* This interface is for internal implementation only.
*
*
* It is provided via the API for easy obtaining of basic data.
*/
public interface IRitualStone {
public interface IRitualStone
{
boolean isRuneType(World world, BlockPos pos, EnumRuneType runeType);
interface Tile {
interface Tile
{
boolean isRuneType(EnumRuneType runeType);
}
}

View file

@ -21,140 +21,152 @@ import net.minecraft.world.World;
@RequiredArgsConstructor
@EqualsAndHashCode(exclude = { "modableRangeMap" })
@ToString
public abstract class Ritual {
public abstract class Ritual
{
public final ArrayList<RitualComponent> ritualComponents = new ArrayList<RitualComponent>();
private final String name;
private final int crystalLevel;
private final int activationCost;
private final RitualRenderer renderer;
private final String unlocalizedName;
public final ArrayList<RitualComponent> ritualComponents = new ArrayList<RitualComponent>();
private final String name;
private final int crystalLevel;
private final int activationCost;
private final RitualRenderer renderer;
private final String unlocalizedName;
private final Map<String, BlockPos[]> modableRangeMap = new HashMap<String, BlockPos[]>();
private final Map<String, BlockPos[]> modableRangeMap = new HashMap<String, BlockPos[]>();
/**
* @param name
* - The name of the ritual
* @param crystalLevel
* - Required Activation Crystal tier
* @param activationCost
* - Base LP cost for activating the ritual
*/
public Ritual(String name, int crystalLevel, int activationCost, String unlocalizedName) {
this(name, crystalLevel, activationCost, null, unlocalizedName);
}
/**
* @param name
* - The name of the ritual
* @param crystalLevel
* - Required Activation Crystal tier
* @param activationCost
* - Base LP cost for activating the ritual
*/
public Ritual(String name, int crystalLevel, int activationCost, String unlocalizedName)
{
this(name, crystalLevel, activationCost, null, unlocalizedName);
}
/**
* Called when the player attempts to activate the ritual.
*
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#activateRitual(ItemStack, EntityPlayer, Ritual)}
*
* @param masterRitualStone
* - The {@link IMasterRitualStone} that the ritual is bound to
* @param player
* - The activating player
* @return - Whether activation was successful
*/
public boolean activateRitual(IMasterRitualStone masterRitualStone, EntityPlayer player) {
return true;
}
/**
* Called when the player attempts to activate the ritual.
*
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#activateRitual(ItemStack, EntityPlayer, Ritual)}
*
* @param masterRitualStone
* - The {@link IMasterRitualStone} that the ritual is bound to
* @param player
* - The activating player
* @return - Whether activation was successful
*/
public boolean activateRitual(IMasterRitualStone masterRitualStone, EntityPlayer player)
{
return true;
}
/**
* Called every {@link #getRefreshTime()} ticks while active.
*
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#performRitual(World, BlockPos)}
*
* @param masterRitualStone
* - The {@link IMasterRitualStone} that the ritual is bound to
*/
public abstract void performRitual(IMasterRitualStone masterRitualStone);
/**
* Called every {@link #getRefreshTime()} ticks while active.
*
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#performRitual(World, BlockPos)}
*
* @param masterRitualStone
* - The {@link IMasterRitualStone} that the ritual is bound to
*/
public abstract void performRitual(IMasterRitualStone masterRitualStone);
/**
* Called when the ritual is stopped for a given {@link BreakType}.
*
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#stopRitual(BreakType)}
*
* @param masterRitualStone
* - The {@link IMasterRitualStone} that the ritual is bound to
* @param breakType
* - The type of break that caused the stoppage.
*/
public void stopRitual(IMasterRitualStone masterRitualStone, BreakType breakType) {
/**
* Called when the ritual is stopped for a given {@link BreakType}.
*
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#stopRitual(BreakType)}
*
* @param masterRitualStone
* - The {@link IMasterRitualStone} that the ritual is bound to
* @param breakType
* - The type of break that caused the stoppage.
*/
public void stopRitual(IMasterRitualStone masterRitualStone, BreakType breakType)
{
}
}
/**
* Used to set the amount of LP drained every {@link #getRefreshTime()}
* ticks.
*
* @return - The amount of LP drained per refresh
*/
public abstract int getRefreshCost();
/**
* Used to set the amount of LP drained every {@link #getRefreshTime()}
* ticks.
*
* @return - The amount of LP drained per refresh
*/
public abstract int getRefreshCost();
/**
* Used to set the refresh rate of the ritual. (How often
* {@link #performRitual(IMasterRitualStone)} is called.
*
* @return - How often to perform the effect in ticks.
*/
public int getRefreshTime() {
return 20;
}
/**
* Used to set the refresh rate of the ritual. (How often
* {@link #performRitual(IMasterRitualStone)} is called.
*
* @return - How often to perform the effect in ticks.
*/
public int getRefreshTime()
{
return 20;
}
public void addBlockRange(String range, BlockPos[] defaultRange) {
modableRangeMap.put(range, defaultRange);
}
public void addBlockRange(String range, BlockPos[] defaultRange)
{
modableRangeMap.put(range, defaultRange);
}
/**
* Used to grab the range of a ritual for a given effect. The order of the
* blockPos array is: bottom corner, top corner.
*
* @param range
* - Range that needs to be pulled.
* @return - The range of the ritual effect. Array must be of size 2 and
* have non-null values, with the first BlockPos having the lower
* offset values and the second BlockPos having the higher offset
* values
*/
public BlockPos[] getBlockRange(String range) {
if (modableRangeMap.containsKey(range)) {
return modableRangeMap.get(range);
}
return new BlockPos[] { new BlockPos(0, 0, 0), new BlockPos(0, 0, 0) };
}
/**
* Used to grab the range of a ritual for a given effect. The order of the
* blockPos array is: bottom corner, top corner.
*
* @param range
* - Range that needs to be pulled.
* @return - The range of the ritual effect. Array must be of size 2 and
* have non-null values, with the first BlockPos having the lower
* offset values and the second BlockPos having the higher offset
* values
*/
public BlockPos[] getBlockRange(String range)
{
if (modableRangeMap.containsKey(range))
{
return modableRangeMap.get(range);
}
/**
* @return a list of {@link RitualComponent} for checking the ritual.
*/
public abstract ArrayList<RitualComponent> getComponents();
return new BlockPos[] { new BlockPos(0, 0, 0), new BlockPos(0, 0, 0) };
}
public void addOffsetRunes(ArrayList<RitualComponent> components, int offset1, int offset2, int y, EnumRuneType rune) {
components.add(new RitualComponent(new BlockPos(offset1, y, offset2), rune));
components.add(new RitualComponent(new BlockPos(offset2, y, offset1), rune));
components.add(new RitualComponent(new BlockPos(offset1, y, -offset2), rune));
components.add(new RitualComponent(new BlockPos(-offset2, y, offset1), rune));
components.add(new RitualComponent(new BlockPos(-offset1, y, offset2), rune));
components.add(new RitualComponent(new BlockPos(offset2, y, -offset1), rune));
components.add(new RitualComponent(new BlockPos(-offset1, y, -offset2), rune));
components.add(new RitualComponent(new BlockPos(-offset2, y, -offset1), rune));
}
/**
* @return a list of {@link RitualComponent} for checking the ritual.
*/
public abstract ArrayList<RitualComponent> getComponents();
public void addCornerRunes(ArrayList<RitualComponent> components, int offset, int y, EnumRuneType rune) {
components.add(new RitualComponent(new BlockPos(offset, y, offset), rune));
components.add(new RitualComponent(new BlockPos(offset, y, -offset), rune));
components.add(new RitualComponent(new BlockPos(-offset, y, -offset), rune));
components.add(new RitualComponent(new BlockPos(-offset, y, offset), rune));
}
public void addOffsetRunes(ArrayList<RitualComponent> components, int offset1, int offset2, int y, EnumRuneType rune)
{
components.add(new RitualComponent(new BlockPos(offset1, y, offset2), rune));
components.add(new RitualComponent(new BlockPos(offset2, y, offset1), rune));
components.add(new RitualComponent(new BlockPos(offset1, y, -offset2), rune));
components.add(new RitualComponent(new BlockPos(-offset2, y, offset1), rune));
components.add(new RitualComponent(new BlockPos(-offset1, y, offset2), rune));
components.add(new RitualComponent(new BlockPos(offset2, y, -offset1), rune));
components.add(new RitualComponent(new BlockPos(-offset1, y, -offset2), rune));
components.add(new RitualComponent(new BlockPos(-offset2, y, -offset1), rune));
}
public void addParallelRunes(ArrayList<RitualComponent> components, int offset, int y, EnumRuneType rune) {
components.add(new RitualComponent(new BlockPos(offset, y, 0), rune));
components.add(new RitualComponent(new BlockPos(-offset, y, 0), rune));
components.add(new RitualComponent(new BlockPos(0, y, -offset), rune));
components.add(new RitualComponent(new BlockPos(0, y, offset), rune));
}
public void addCornerRunes(ArrayList<RitualComponent> components, int offset, int y, EnumRuneType rune)
{
components.add(new RitualComponent(new BlockPos(offset, y, offset), rune));
components.add(new RitualComponent(new BlockPos(offset, y, -offset), rune));
components.add(new RitualComponent(new BlockPos(-offset, y, -offset), rune));
components.add(new RitualComponent(new BlockPos(-offset, y, offset), rune));
}
public enum BreakType {
REDSTONE, BREAK_MRS, BREAK_STONE, ACTIVATE, DEACTIVATE, EXPLOSION,
}
public void addParallelRunes(ArrayList<RitualComponent> components, int offset, int y, EnumRuneType rune)
{
components.add(new RitualComponent(new BlockPos(offset, y, 0), rune));
components.add(new RitualComponent(new BlockPos(-offset, y, 0), rune));
components.add(new RitualComponent(new BlockPos(0, y, -offset), rune));
components.add(new RitualComponent(new BlockPos(0, y, offset), rune));
}
public enum BreakType
{
REDSTONE, BREAK_MRS, BREAK_STONE, ACTIVATE, DEACTIVATE, EXPLOSION,
}
}

View file

@ -6,43 +6,49 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
/**
* Used to set a {@link EnumRuneType} type to a given {@link BlockPos}
* for usage in Ritual creation.
* Used to set a {@link EnumRuneType} type to a given {@link BlockPos} for usage
* in Ritual creation.
*/
@Getter
@RequiredArgsConstructor
public class RitualComponent {
public class RitualComponent
{
private final BlockPos offset;
private final EnumRuneType runeType;
public int getX(EnumFacing direction) {
switch (direction) {
case EAST:
return -this.getOffset().getZ();
case SOUTH:
return -this.getOffset().getX();
case WEST:
return this.getOffset().getZ();
default:
return this.getOffset().getX();
public int getX(EnumFacing direction)
{
switch (direction)
{
case EAST:
return -this.getOffset().getZ();
case SOUTH:
return -this.getOffset().getX();
case WEST:
return this.getOffset().getZ();
default:
return this.getOffset().getX();
}
}
public int getZ(EnumFacing direction) {
switch (direction) {
case EAST:
return this.getOffset().getX();
case SOUTH:
return -this.getOffset().getZ();
case WEST:
return -this.getOffset().getX();
default:
return this.getOffset().getZ();
public int getZ(EnumFacing direction)
{
switch (direction)
{
case EAST:
return this.getOffset().getX();
case SOUTH:
return -this.getOffset().getZ();
case WEST:
return -this.getOffset().getX();
default:
return this.getOffset().getZ();
}
}
public BlockPos getOffset(EnumFacing direction) {
return new BlockPos(getX(direction), offset.getY(), getZ(direction));
public BlockPos getOffset(EnumFacing direction)
{
return new BlockPos(getX(direction), offset.getY(), getZ(direction));
}
}

View file

@ -3,11 +3,13 @@ package WayofTime.bloodmagic.api.ritual;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public abstract class RitualRenderer {
public abstract class RitualRenderer
{
public abstract void renderAt(IMasterRitualStone masterRitualStone, double x, double y, double z);
protected void bindTexture(ResourceLocation resourceLocation) {
protected void bindTexture(ResourceLocation resourceLocation)
{
Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation);
}
}

View file

@ -6,10 +6,11 @@ import net.minecraft.world.World;
/**
* This interface is for internal implementation only.
*
*
* It is provided via the API for easy obtaining of basic data.
*/
public interface IImperfectRitualStone {
public interface IImperfectRitualStone
{
boolean performRitual(World world, BlockPos pos, ImperfectRitual imperfectRitual, EntityPlayer player);

View file

@ -9,13 +9,15 @@ import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
/**
* Abstract class for creating new imperfect rituals. ImperfectRituals need be registered with
* Abstract class for creating new imperfect rituals. ImperfectRituals need be
* registered with
* {@link WayofTime.bloodmagic.api.registry.ImperfectRitualRegistry#registerRitual(ImperfectRitual)}
*/
@RequiredArgsConstructor
@Getter
@EqualsAndHashCode
public abstract class ImperfectRitual {
public abstract class ImperfectRitual
{
private final String name;
private final BlockStack requiredBlock;
@ -23,26 +25,34 @@ public abstract class ImperfectRitual {
private final boolean lightshow;
/**
* @param name - The name of the ritual
* @param requiredBlock - The block required above the ImperfectRitualStone
* @param activationCost - Base LP cost for activating the ritual
* @param name
* - The name of the ritual
* @param requiredBlock
* - The block required above the ImperfectRitualStone
* @param activationCost
* - Base LP cost for activating the ritual
*/
public ImperfectRitual(String name, BlockStack requiredBlock, int activationCost) {
public ImperfectRitual(String name, BlockStack requiredBlock, int activationCost)
{
this(name, requiredBlock, activationCost, false);
}
/**
* Called when the player activates the ritual
* {@link WayofTime.bloodmagic.tile.TileImperfectRitualStone#performRitual(World, BlockPos, ImperfectRitual, EntityPlayer)}
*
* @param imperfectRitualStone - The {@link IImperfectRitualStone} that the ritual is bound to
* @param player - The player activating the ritual
*
* @param imperfectRitualStone
* - The {@link IImperfectRitualStone} that the ritual is bound
* to
* @param player
* - The player activating the ritual
* @return - Whether activation was successful
*/
public abstract boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player);
@Override
public String toString() {
public String toString()
{
return getName() + ":" + getRequiredBlock().toString() + "@" + getActivationCost();
}
}