Refactor everything to WayofTime.bloodmagic.*
This commit is contained in:
parent
46742a73d1
commit
096ba02450
771 changed files with 566 additions and 573 deletions
|
@ -0,0 +1,33 @@
|
|||
package WayofTime.bloodmagic.api.ritual;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumRuneType implements IStringSerializable {
|
||||
|
||||
BLANK,
|
||||
WATER,
|
||||
FIRE,
|
||||
EARTH,
|
||||
AIR,
|
||||
DUSK,
|
||||
DAWN;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.toString();
|
||||
}
|
||||
|
||||
public static EnumRuneType byMetadata(int meta) {
|
||||
if (meta < 0 || meta >= values().length)
|
||||
meta = 0;
|
||||
|
||||
return values()[meta];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package WayofTime.bloodmagic.api.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.ritual.imperfect.IImperfectRitualStone;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IMasterRitualStone extends IImperfectRitualStone {
|
||||
|
||||
void performRitual(World world, BlockPos pos, Ritual ritual);
|
||||
|
||||
void setCooldown(int cooldown);
|
||||
|
||||
int getCooldown();
|
||||
|
||||
void setActive(boolean active);
|
||||
|
||||
EnumFacing getDirection();
|
||||
|
||||
NBTTagCompound getCustomRitualTag();
|
||||
|
||||
void setCustomRitualTag(NBTTagCompound tag);
|
||||
|
||||
boolean areTanksEmpty();
|
||||
|
||||
int getRunningTime();
|
||||
|
||||
LocalRitualStorage getLocalStorage();
|
||||
|
||||
void setLocalStorage(LocalRitualStorage storage);
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package WayofTime.bloodmagic.api.ritual;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IRitualStone {
|
||||
|
||||
boolean isRuneType(World world, BlockPos pos, int meta, EnumRuneType runeType);
|
||||
|
||||
interface Tile {
|
||||
boolean isRuneType(EnumRuneType runeType);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package WayofTime.bloodmagic.api.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.NBTHolder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
/**
|
||||
* This class is used to pass ritual-specific data into the RitualEffect from the containing Master Ritual Stone. This is basically used as auxiliary storage,
|
||||
* for when simply storing to NBT becomes... difficult.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class LocalRitualStorage {
|
||||
|
||||
private BlockPos pos;
|
||||
|
||||
public void writeToNBT(NBTTagCompound tagCompound) {
|
||||
tagCompound.setInteger(NBTHolder.NBT_COORDX, pos.getX());
|
||||
tagCompound.setInteger(NBTHolder.NBT_COORDY, pos.getY());
|
||||
tagCompound.setInteger(NBTHolder.NBT_COORDZ, pos.getZ());
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
this.pos = new BlockPos(tagCompound.getInteger(NBTHolder.NBT_COORDX), tagCompound.getInteger(NBTHolder.NBT_COORDY), tagCompound.getInteger(NBTHolder.NBT_COORDZ));
|
||||
}
|
||||
}
|
72
src/main/java/WayofTime/bloodmagic/api/ritual/Ritual.java
Normal file
72
src/main/java/WayofTime/bloodmagic/api/ritual/Ritual.java
Normal file
|
@ -0,0 +1,72 @@
|
|||
package WayofTime.bloodmagic.api.ritual;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public abstract class Ritual {
|
||||
|
||||
private final String name;
|
||||
private final int crystalLevel;
|
||||
private final int activationCost;
|
||||
private final RitualRenderer renderer;
|
||||
|
||||
public final ArrayList<RitualComponent> ritualComponents = new ArrayList<RitualComponent>();
|
||||
|
||||
public Ritual(String name, int crystalLevel, int activationCost) {
|
||||
this(name, crystalLevel, activationCost, null);
|
||||
}
|
||||
|
||||
public abstract boolean startRitual(IMasterRitualStone masterRitualStone, EntityPlayer player);
|
||||
|
||||
public abstract void performEffect(IMasterRitualStone masterRitualStone);
|
||||
|
||||
public abstract void onRitualBroken(IMasterRitualStone masterRitualStone, Ritual.BreakType breakType);
|
||||
|
||||
public abstract int getRefreshCost();
|
||||
|
||||
public abstract ArrayList<RitualComponent> getComponents();
|
||||
|
||||
public LocalRitualStorage getNewLocalStorage() {
|
||||
return new LocalRitualStorage();
|
||||
}
|
||||
|
||||
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 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 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,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package WayofTime.bloodmagic.api.ritual;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
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 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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package WayofTime.bloodmagic.api.ritual;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public abstract class RitualRenderer {
|
||||
|
||||
public abstract void renderAt(IMasterRitualStone masterRitualStone, double x, double y, double z);
|
||||
|
||||
protected void bindTexture(ResourceLocation resourceLocation) {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package WayofTime.bloodmagic.api.ritual.imperfect;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IImperfectRitualStone {
|
||||
|
||||
String getOwner();
|
||||
|
||||
World getWorld();
|
||||
|
||||
BlockPos getPos();
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package WayofTime.bloodmagic.api.ritual.imperfect;
|
||||
|
||||
import WayofTime.bloodmagic.api.BlockStack;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public abstract class ImperfectRitual {
|
||||
|
||||
private final BlockStack requiredBlock;
|
||||
private final int activationCost;
|
||||
private final boolean lightshow;
|
||||
|
||||
public ImperfectRitual(BlockStack requiredBlock, int activationCost) {
|
||||
this(requiredBlock, activationCost, false);
|
||||
}
|
||||
|
||||
public abstract boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue