Changed formatting to have bracing on a new line
This commit is contained in:
parent
e5eddd6c45
commit
e48eedb874
|
@ -30,7 +30,8 @@ import WayofTime.bloodmagic.util.handler.EventHandler;
|
||||||
|
|
||||||
@Mod(modid = Constants.Mod.MODID, name = Constants.Mod.NAME, version = Constants.Mod.VERSION, dependencies = Constants.Mod.DEPEND, acceptedMinecraftVersions = "[1.8.8,1.8.9]", guiFactory = "WayofTime.bloodmagic.client.gui.ConfigGuiFactory")
|
@Mod(modid = Constants.Mod.MODID, name = Constants.Mod.NAME, version = Constants.Mod.VERSION, dependencies = Constants.Mod.DEPEND, acceptedMinecraftVersions = "[1.8.8,1.8.9]", guiFactory = "WayofTime.bloodmagic.client.gui.ConfigGuiFactory")
|
||||||
@Getter
|
@Getter
|
||||||
public class BloodMagic {
|
public class BloodMagic
|
||||||
|
{
|
||||||
|
|
||||||
@SidedProxy(serverSide = "WayofTime.bloodmagic.proxy.CommonProxy", clientSide = "WayofTime.bloodmagic.proxy.ClientProxy")
|
@SidedProxy(serverSide = "WayofTime.bloodmagic.proxy.CommonProxy", clientSide = "WayofTime.bloodmagic.proxy.ClientProxy")
|
||||||
public static CommonProxy proxy;
|
public static CommonProxy proxy;
|
||||||
|
@ -38,9 +39,11 @@ public class BloodMagic {
|
||||||
@Mod.Instance(Constants.Mod.MODID)
|
@Mod.Instance(Constants.Mod.MODID)
|
||||||
public static BloodMagic instance;
|
public static BloodMagic instance;
|
||||||
|
|
||||||
public static CreativeTabs tabBloodMagic = new CreativeTabs(Constants.Mod.MODID + ".creativeTab") {
|
public static CreativeTabs tabBloodMagic = new CreativeTabs(Constants.Mod.MODID + ".creativeTab")
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public Item getTabIconItem() {
|
public Item getTabIconItem()
|
||||||
|
{
|
||||||
return ModItems.bloodOrb;
|
return ModItems.bloodOrb;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -49,12 +52,13 @@ public class BloodMagic {
|
||||||
private File configDir;
|
private File configDir;
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event)
|
||||||
|
{
|
||||||
configDir = new File(event.getModConfigurationDirectory(), "BloodMagic");
|
configDir = new File(event.getModConfigurationDirectory(), "BloodMagic");
|
||||||
ConfigHandler.init(new File(getConfigDir(), "BloodMagic.cfg"));
|
ConfigHandler.init(new File(getConfigDir(), "BloodMagic.cfg"));
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||||
|
|
||||||
ModBlocks.init();
|
ModBlocks.init();
|
||||||
ModItems.init();
|
ModItems.init();
|
||||||
ModPotions.init();
|
ModPotions.init();
|
||||||
|
@ -64,7 +68,8 @@ public class BloodMagic {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void init(FMLInitializationEvent event) {
|
public void init(FMLInitializationEvent event)
|
||||||
|
{
|
||||||
BloodMagicPacketHandler.init();
|
BloodMagicPacketHandler.init();
|
||||||
|
|
||||||
ModRecipes.init();
|
ModRecipes.init();
|
||||||
|
@ -77,7 +82,8 @@ public class BloodMagic {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void postInit(FMLPostInitializationEvent event) {
|
public void postInit(FMLPostInitializationEvent event)
|
||||||
|
{
|
||||||
ModRecipes.addCompressionHandlers();
|
ModRecipes.addCompressionHandlers();
|
||||||
|
|
||||||
proxy.postInit();
|
proxy.postInit();
|
||||||
|
|
|
@ -18,9 +18,11 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ConfigHandler {
|
public class ConfigHandler
|
||||||
|
{
|
||||||
|
|
||||||
@Getter @Setter
|
@Getter
|
||||||
|
@Setter
|
||||||
private static Configuration config;
|
private static Configuration config;
|
||||||
|
|
||||||
// Teleposer
|
// Teleposer
|
||||||
|
@ -89,23 +91,25 @@ public class ConfigHandler {
|
||||||
|
|
||||||
// Compat
|
// Compat
|
||||||
|
|
||||||
public static void init(File file) {
|
public static void init(File file)
|
||||||
|
{
|
||||||
config = new Configuration(file);
|
config = new Configuration(file);
|
||||||
syncConfig();
|
syncConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void syncConfig() {
|
public static void syncConfig()
|
||||||
|
{
|
||||||
String category;
|
String category;
|
||||||
|
|
||||||
category = "Item/Block Blacklisting";
|
category = "Item/Block Blacklisting";
|
||||||
config.addCustomCategoryComment(category, "Allows disabling of specific Blocks/Items.\nNote that using this may result in crashes. Use is not supported.");
|
config.addCustomCategoryComment(category, "Allows disabling of specific Blocks/Items.\nNote that using this may result in crashes. Use is not supported.");
|
||||||
config.setCategoryRequiresMcRestart(category, true);
|
config.setCategoryRequiresMcRestart(category, true);
|
||||||
itemBlacklist = Arrays.asList(config.getStringList("itemBlacklist", category, new String[]{}, "Items to not be registered. This requires their mapping name. Usually the same as the class name. Can be found in F3+H mode."));
|
itemBlacklist = Arrays.asList(config.getStringList("itemBlacklist", category, new String[] {}, "Items to not be registered. This requires their mapping name. Usually the same as the class name. Can be found in F3+H mode."));
|
||||||
blockBlacklist = Arrays.asList(config.getStringList("blockBlacklist", category, new String[]{}, "Blocks to not be registered. This requires their mapping name. Usually the same as the class name. Can be found in F3+H mode."));
|
blockBlacklist = Arrays.asList(config.getStringList("blockBlacklist", category, new String[] {}, "Blocks to not be registered. This requires their mapping name. Usually the same as the class name. Can be found in F3+H mode."));
|
||||||
|
|
||||||
category = "Teleposer Blacklist";
|
category = "Teleposer Blacklist";
|
||||||
config.addCustomCategoryComment(category, "Block blacklisting");
|
config.addCustomCategoryComment(category, "Block blacklisting");
|
||||||
teleposerBlacklisting = config.getStringList("teleposerBlacklist", category, new String[]{"minecraft:bedrock"}, "Stops specified blocks from being teleposed. Put entries on new lines. Valid syntax is:\nmodid:blockname:meta");
|
teleposerBlacklisting = config.getStringList("teleposerBlacklist", category, new String[] { "minecraft:bedrock" }, "Stops specified blocks from being teleposed. Put entries on new lines. Valid syntax is:\nmodid:blockname:meta");
|
||||||
buildTeleposerBlacklist();
|
buildTeleposerBlacklist();
|
||||||
|
|
||||||
category = "Potions";
|
category = "Potions";
|
||||||
|
@ -179,21 +183,26 @@ public class ConfigHandler {
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void buildTeleposerBlacklist() {
|
private static void buildTeleposerBlacklist()
|
||||||
|
{
|
||||||
|
|
||||||
// Make sure it's empty before setting the blacklist.
|
// Make sure it's empty before setting the blacklist.
|
||||||
// Otherwise, reloading the config while in-game will duplicate the list.
|
// Otherwise, reloading the config while in-game will duplicate the
|
||||||
|
// list.
|
||||||
teleposerBlacklist.clear();
|
teleposerBlacklist.clear();
|
||||||
|
|
||||||
for (String blockSet : teleposerBlacklisting) {
|
for (String blockSet : teleposerBlacklisting)
|
||||||
|
{
|
||||||
String[] blockData = blockSet.split(":");
|
String[] blockData = blockSet.split(":");
|
||||||
|
|
||||||
Block block = GameRegistry.findBlock(blockData[0], blockData[1]);
|
Block block = GameRegistry.findBlock(blockData[0], blockData[1]);
|
||||||
int meta = 0;
|
int meta = 0;
|
||||||
|
|
||||||
// If the block follows full syntax: modid:blockname:meta
|
// If the block follows full syntax: modid:blockname:meta
|
||||||
if (blockData.length == 3) {
|
if (blockData.length == 3)
|
||||||
// Check if it's an int, if so, parse it. If not, set meta to 0 to avoid crashing.
|
{
|
||||||
|
// Check if it's an int, if so, parse it. If not, set meta to 0
|
||||||
|
// to avoid crashing.
|
||||||
if (Utils.isInteger(blockData[2]))
|
if (Utils.isInteger(blockData[2]))
|
||||||
meta = Integer.parseInt(blockData[2]);
|
meta = Integer.parseInt(blockData[2]);
|
||||||
else if (blockData[2].equals("*"))
|
else if (blockData[2].equals("*"))
|
||||||
|
@ -206,7 +215,8 @@ public class ConfigHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkRituals() {
|
public static void checkRituals()
|
||||||
|
{
|
||||||
RitualHelper.checkRituals(config, "WayofTime.bloodmagic.ritual", "Rituals");
|
RitualHelper.checkRituals(config, "WayofTime.bloodmagic.ritual", "Rituals");
|
||||||
RitualHelper.checkImperfectRituals(config, "WayofTime.bloodmagic.ritual.imperfect", "Rituals.imperfect");
|
RitualHelper.checkImperfectRituals(config, "WayofTime.bloodmagic.ritual.imperfect", "Rituals.imperfect");
|
||||||
config.save();
|
config.save();
|
||||||
|
|
|
@ -11,51 +11,60 @@ import net.minecraft.world.World;
|
||||||
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyArrayEffectCrafting;
|
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyArrayEffectCrafting;
|
||||||
import WayofTime.bloodmagic.client.render.alchemyArray.BindingAlchemyCircleRenderer;
|
import WayofTime.bloodmagic.client.render.alchemyArray.BindingAlchemyCircleRenderer;
|
||||||
|
|
||||||
public class AlchemyArrayEffectBinding extends AlchemyArrayEffect {
|
public class AlchemyArrayEffectBinding extends AlchemyArrayEffect
|
||||||
|
{
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public final ItemStack outputStack;
|
public final ItemStack outputStack;
|
||||||
|
|
||||||
public AlchemyArrayEffectBinding(ItemStack outputStack) {
|
public AlchemyArrayEffectBinding(ItemStack outputStack)
|
||||||
this.outputStack = outputStack;
|
{
|
||||||
}
|
this.outputStack = outputStack;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public boolean update(TileEntity tile, int ticksActive) {
|
|
||||||
if(ticksActive >= 50 && ticksActive <= 250) {
|
|
||||||
//TODO: Find a way to spawn lightning from only the server side - does not render when just spawned on server, not client.
|
|
||||||
this.spawnLightningOnCircle(tile.getWorld(), tile.getPos(), ticksActive);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(tile.getWorld().isRemote) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ticksActive >= 300){
|
|
||||||
BlockPos pos = tile.getPos();
|
|
||||||
|
|
||||||
ItemStack output = outputStack.copy();
|
@Override
|
||||||
EntityItem outputEntity = new EntityItem(tile.getWorld(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output);
|
public boolean update(TileEntity tile, int ticksActive)
|
||||||
|
{
|
||||||
|
if (ticksActive >= 50 && ticksActive <= 250)
|
||||||
|
{
|
||||||
|
// TODO: Find a way to spawn lightning from only the server side -
|
||||||
|
// does not render when just spawned on server, not client.
|
||||||
|
this.spawnLightningOnCircle(tile.getWorld(), tile.getPos(), ticksActive);
|
||||||
|
}
|
||||||
|
|
||||||
tile.getWorld().spawnEntityInWorld(outputEntity);
|
if (tile.getWorld().isRemote)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
if (ticksActive >= 300)
|
||||||
}
|
{
|
||||||
|
BlockPos pos = tile.getPos();
|
||||||
return false;
|
|
||||||
}
|
ItemStack output = outputStack.copy();
|
||||||
|
EntityItem outputEntity = new EntityItem(tile.getWorld(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output);
|
||||||
public void spawnLightningOnCircle(World world, BlockPos pos, int ticksActive) {
|
|
||||||
if(ticksActive % 50 == 0) {
|
tile.getWorld().spawnEntityInWorld(outputEntity);
|
||||||
int circle = ticksActive / 50 - 1;
|
|
||||||
float distance = BindingAlchemyCircleRenderer.getDistanceOfCircle(circle, ticksActive);
|
return true;
|
||||||
float angle = BindingAlchemyCircleRenderer.getAngleOfCircle(circle, ticksActive);
|
}
|
||||||
|
|
||||||
double dispX = distance * Math.sin(angle);
|
return false;
|
||||||
double dispZ = -distance * Math.cos(angle);
|
}
|
||||||
|
|
||||||
EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX() + dispX, pos.getY(), pos.getZ() + dispZ);
|
public void spawnLightningOnCircle(World world, BlockPos pos, int ticksActive)
|
||||||
world.spawnEntityInWorld(lightning);
|
{
|
||||||
}
|
if (ticksActive % 50 == 0)
|
||||||
}
|
{
|
||||||
|
int circle = ticksActive / 50 - 1;
|
||||||
|
float distance = BindingAlchemyCircleRenderer.getDistanceOfCircle(circle, ticksActive);
|
||||||
|
float angle = BindingAlchemyCircleRenderer.getAngleOfCircle(circle, ticksActive);
|
||||||
|
|
||||||
|
double dispX = distance * Math.sin(angle);
|
||||||
|
double dispZ = -distance * Math.cos(angle);
|
||||||
|
|
||||||
|
EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX() + dispX, pos.getY(), pos.getZ() + dispZ);
|
||||||
|
world.spawnEntityInWorld(lightning);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,19 +31,20 @@ import WayofTime.bloodmagic.util.Utils;
|
||||||
import com.google.common.base.Enums;
|
import com.google.common.base.Enums;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
public class BloodAltar {
|
public class BloodAltar
|
||||||
|
{
|
||||||
|
|
||||||
private TileAltar tileAltar;
|
private TileAltar tileAltar;
|
||||||
private int internalCounter = 0;
|
private int internalCounter = 0;
|
||||||
|
|
||||||
public boolean isActive;
|
public boolean isActive;
|
||||||
protected FluidStack fluidOutput = new FluidStack(BlockLifeEssence.getLifeEssence(), 0);
|
protected FluidStack fluidOutput = new FluidStack(BlockLifeEssence.getLifeEssence(), 0);
|
||||||
protected FluidStack fluidInput = new FluidStack(BlockLifeEssence.getLifeEssence(), 0);
|
protected FluidStack fluidInput = new FluidStack(BlockLifeEssence.getLifeEssence(), 0);
|
||||||
private EnumAltarTier altarTier = EnumAltarTier.ONE;
|
private EnumAltarTier altarTier = EnumAltarTier.ONE;
|
||||||
private AltarUpgrade upgrade;
|
private AltarUpgrade upgrade;
|
||||||
private int capacity = FluidContainerRegistry.BUCKET_VOLUME * 10;
|
private int capacity = FluidContainerRegistry.BUCKET_VOLUME * 10;
|
||||||
private FluidStack fluid = new FluidStack(BloodMagicAPI.getLifeEssence(), 0);
|
private FluidStack fluid = new FluidStack(BloodMagicAPI.getLifeEssence(), 0);
|
||||||
private int liquidRequired; //mB
|
private int liquidRequired; // mB
|
||||||
private boolean canBeFilled;
|
private boolean canBeFilled;
|
||||||
private int consumptionRate;
|
private int consumptionRate;
|
||||||
private int drainRate;
|
private int drainRate;
|
||||||
|
@ -65,13 +66,14 @@ public class BloodAltar {
|
||||||
private int cooldownAfterCrafting = 500;
|
private int cooldownAfterCrafting = 500;
|
||||||
|
|
||||||
private ItemStack result;
|
private ItemStack result;
|
||||||
|
|
||||||
public BloodAltar(TileAltar tileAltar)
|
public BloodAltar(TileAltar tileAltar)
|
||||||
{
|
{
|
||||||
this.tileAltar = tileAltar;
|
this.tileAltar = tileAltar;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static
|
||||||
|
{
|
||||||
EnumAltarTier.ONE.buildComponents();
|
EnumAltarTier.ONE.buildComponents();
|
||||||
EnumAltarTier.TWO.buildComponents();
|
EnumAltarTier.TWO.buildComponents();
|
||||||
EnumAltarTier.THREE.buildComponents();
|
EnumAltarTier.THREE.buildComponents();
|
||||||
|
@ -80,9 +82,12 @@ public class BloodAltar {
|
||||||
EnumAltarTier.SIX.buildComponents();
|
EnumAltarTier.SIX.buildComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumAltarTier getAltarTier(World world, BlockPos pos) {
|
public static EnumAltarTier getAltarTier(World world, BlockPos pos)
|
||||||
for (int i = EnumAltarTier.MAXTIERS - 1; i >= 1; i--) {
|
{
|
||||||
if (checkAltarIsValid(world, pos, i)) {
|
for (int i = EnumAltarTier.MAXTIERS - 1; i >= 1; i--)
|
||||||
|
{
|
||||||
|
if (checkAltarIsValid(world, pos, i))
|
||||||
|
{
|
||||||
return EnumAltarTier.values()[i];
|
return EnumAltarTier.values()[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,22 +95,28 @@ public class BloodAltar {
|
||||||
return EnumAltarTier.ONE;
|
return EnumAltarTier.ONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkAltarIsValid(World world, BlockPos worldPos, int altarTier) {
|
public static boolean checkAltarIsValid(World world, BlockPos worldPos, int altarTier)
|
||||||
|
{
|
||||||
|
|
||||||
for (AltarComponent altarComponent : EnumAltarTier.values()[altarTier].getAltarComponents()) {
|
for (AltarComponent altarComponent : EnumAltarTier.values()[altarTier].getAltarComponents())
|
||||||
|
{
|
||||||
|
|
||||||
BlockPos componentPos = worldPos.add(altarComponent.getOffset());
|
BlockPos componentPos = worldPos.add(altarComponent.getOffset());
|
||||||
BlockStack worldBlock = new BlockStack(world.getBlockState(componentPos).getBlock(), world.getBlockState(componentPos).getBlock().getMetaFromState(world.getBlockState(componentPos)));
|
BlockStack worldBlock = new BlockStack(world.getBlockState(componentPos).getBlock(), world.getBlockState(componentPos).getBlock().getMetaFromState(world.getBlockState(componentPos)));
|
||||||
|
|
||||||
if (altarComponent.getComponent() != EnumAltarComponent.NOTAIR) {
|
if (altarComponent.getComponent() != EnumAltarComponent.NOTAIR)
|
||||||
if (worldBlock.getBlock() instanceof IAltarComponent) {
|
{
|
||||||
|
if (worldBlock.getBlock() instanceof IAltarComponent)
|
||||||
|
{
|
||||||
EnumAltarComponent component = ((IAltarComponent) worldBlock.getBlock()).getType(worldBlock.getMeta());
|
EnumAltarComponent component = ((IAltarComponent) worldBlock.getBlock()).getType(worldBlock.getMeta());
|
||||||
if (component != altarComponent.getComponent())
|
if (component != altarComponent.getComponent())
|
||||||
return false;
|
return false;
|
||||||
} else if (worldBlock.getBlock() != Utils.getBlockForComponent(altarComponent.getComponent())) {
|
} else if (worldBlock.getBlock() != Utils.getBlockForComponent(altarComponent.getComponent()))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
if (world.isAirBlock(componentPos))
|
if (world.isAirBlock(componentPos))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -114,57 +125,63 @@ public class BloodAltar {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AltarUpgrade getUpgrades(World world, BlockPos pos, EnumAltarTier altarTier) {
|
public static AltarUpgrade getUpgrades(World world, BlockPos pos, EnumAltarTier altarTier)
|
||||||
if (world.isRemote) {
|
{
|
||||||
|
if (world.isRemote)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
AltarUpgrade upgrades = new AltarUpgrade();
|
AltarUpgrade upgrades = new AltarUpgrade();
|
||||||
List<AltarComponent> list = altarTier.getAltarComponents();
|
List<AltarComponent> list = altarTier.getAltarComponents();
|
||||||
|
|
||||||
for (AltarComponent altarComponent : list) {
|
for (AltarComponent altarComponent : list)
|
||||||
|
{
|
||||||
BlockPos componentPos = pos.add(altarComponent.getOffset());
|
BlockPos componentPos = pos.add(altarComponent.getOffset());
|
||||||
|
|
||||||
if (altarComponent.isUpgradeSlot()) {
|
if (altarComponent.isUpgradeSlot())
|
||||||
|
{
|
||||||
BlockStack worldBlock = new BlockStack(world.getBlockState(componentPos).getBlock(), world.getBlockState(componentPos).getBlock().getMetaFromState(world.getBlockState(componentPos)));
|
BlockStack worldBlock = new BlockStack(world.getBlockState(componentPos).getBlock(), world.getBlockState(componentPos).getBlock().getMetaFromState(world.getBlockState(componentPos)));
|
||||||
|
|
||||||
if (worldBlock.getBlock() instanceof BlockBloodRune) {
|
if (worldBlock.getBlock() instanceof BlockBloodRune)
|
||||||
switch (((BlockBloodRune) worldBlock.getBlock()).getRuneEffect(worldBlock.getMeta())) {
|
{
|
||||||
case 1:
|
switch (((BlockBloodRune) worldBlock.getBlock()).getRuneEffect(worldBlock.getMeta()))
|
||||||
upgrades.addSpeed();
|
{
|
||||||
break;
|
case 1:
|
||||||
|
upgrades.addSpeed();
|
||||||
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
upgrades.addEfficiency();
|
upgrades.addEfficiency();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
upgrades.addSacrifice();
|
upgrades.addSacrifice();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
upgrades.addSelfSacrifice();
|
upgrades.addSelfSacrifice();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
upgrades.addDisplacement();
|
upgrades.addDisplacement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
upgrades.addCapacity();
|
upgrades.addCapacity();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
upgrades.addBetterCapacity();
|
upgrades.addBetterCapacity();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
upgrades.addOrbCapacity();
|
upgrades.addOrbCapacity();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9:
|
case 9:
|
||||||
upgrades.addAcceleration();
|
upgrades.addAcceleration();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,9 +189,11 @@ public class BloodAltar {
|
||||||
|
|
||||||
return upgrades;
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
public void readFromNBT(NBTTagCompound tagCompound)
|
||||||
if (!tagCompound.hasKey(Constants.NBT.EMPTY)) {
|
{
|
||||||
|
if (!tagCompound.hasKey(Constants.NBT.EMPTY))
|
||||||
|
{
|
||||||
FluidStack fluid = FluidStack.loadFluidStackFromNBT(tagCompound);
|
FluidStack fluid = FluidStack.loadFluidStackFromNBT(tagCompound);
|
||||||
|
|
||||||
if (fluid != null)
|
if (fluid != null)
|
||||||
|
@ -212,7 +231,8 @@ public class BloodAltar {
|
||||||
cooldownAfterCrafting = tagCompound.getInteger(Constants.NBT.ALTAR_COOLDOWN_AFTER_CRAFTING);
|
cooldownAfterCrafting = tagCompound.getInteger(Constants.NBT.ALTAR_COOLDOWN_AFTER_CRAFTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound tagCompound) {
|
public void writeToNBT(NBTTagCompound tagCompound)
|
||||||
|
{
|
||||||
|
|
||||||
if (fluid != null)
|
if (fluid != null)
|
||||||
fluid.writeToNBT(tagCompound);
|
fluid.writeToNBT(tagCompound);
|
||||||
|
@ -249,10 +269,11 @@ public class BloodAltar {
|
||||||
tagCompound.setInteger(Constants.NBT.ALTAR_DEMON_BLOOD_DURATION, demonBloodDuration);
|
tagCompound.setInteger(Constants.NBT.ALTAR_DEMON_BLOOD_DURATION, demonBloodDuration);
|
||||||
tagCompound.setInteger(Constants.NBT.ALTAR_COOLDOWN_AFTER_CRAFTING, cooldownAfterCrafting);
|
tagCompound.setInteger(Constants.NBT.ALTAR_COOLDOWN_AFTER_CRAFTING, cooldownAfterCrafting);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startCycle() {
|
public void startCycle()
|
||||||
|
{
|
||||||
if (tileAltar.getWorld() != null)
|
if (tileAltar.getWorld() != null)
|
||||||
tileAltar.getWorld().markBlockForUpdate(tileAltar.getPos());
|
tileAltar.getWorld().markBlockForUpdate(tileAltar.getPos());
|
||||||
|
|
||||||
checkTier();
|
checkTier();
|
||||||
|
|
||||||
|
@ -262,10 +283,13 @@ public class BloodAltar {
|
||||||
if (!isActive)
|
if (!isActive)
|
||||||
progress = 0;
|
progress = 0;
|
||||||
|
|
||||||
if (tileAltar.getStackInSlot(0) != null) {
|
if (tileAltar.getStackInSlot(0) != null)
|
||||||
|
{
|
||||||
// Do recipes
|
// Do recipes
|
||||||
for (AltarRecipe recipe : AltarRecipeRegistry.getRecipes().values()) {
|
for (AltarRecipe recipe : AltarRecipeRegistry.getRecipes().values())
|
||||||
if (recipe.doesRequiredItemMatch(tileAltar.getStackInSlot(0), altarTier)) {
|
{
|
||||||
|
if (recipe.doesRequiredItemMatch(tileAltar.getStackInSlot(0), altarTier))
|
||||||
|
{
|
||||||
this.isActive = true;
|
this.isActive = true;
|
||||||
this.result = new ItemStack(recipe.getOutput().getItem(), 1, recipe.getOutput().getMetadata());
|
this.result = new ItemStack(recipe.getOutput().getItem(), 1, recipe.getOutput().getMetadata());
|
||||||
this.liquidRequired = recipe.getSyphon();
|
this.liquidRequired = recipe.getSyphon();
|
||||||
|
@ -279,27 +303,32 @@ public class BloodAltar {
|
||||||
|
|
||||||
isActive = false;
|
isActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update()
|
||||||
World world = tileAltar.getWorld();
|
{
|
||||||
|
World world = tileAltar.getWorld();
|
||||||
BlockPos pos = tileAltar.getPos();
|
BlockPos pos = tileAltar.getPos();
|
||||||
|
|
||||||
if (world.isRemote)
|
if (world.isRemote)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
internalCounter++; //Used instead of the world time for checks that do not happen every tick
|
internalCounter++; // Used instead of the world time for checks that do
|
||||||
|
// not happen every tick
|
||||||
|
|
||||||
if (lockdownDuration > 0)
|
if (lockdownDuration > 0)
|
||||||
lockdownDuration--;
|
lockdownDuration--;
|
||||||
|
|
||||||
if (internalCounter % 20 == 0) {
|
if (internalCounter % 20 == 0)
|
||||||
for(EnumFacing facing : EnumFacing.VALUES){
|
{
|
||||||
BlockPos newPos = pos.offset(facing);
|
for (EnumFacing facing : EnumFacing.VALUES)
|
||||||
IBlockState block = world.getBlockState(newPos);
|
{
|
||||||
block.getBlock().onNeighborBlockChange(world, newPos, block, block.getBlock());
|
BlockPos newPos = pos.offset(facing);
|
||||||
}
|
IBlockState block = world.getBlockState(newPos);
|
||||||
|
block.getBlock().onNeighborBlockChange(world, newPos, block, block.getBlock());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (internalCounter % (Math.max(20 - this.accelerationUpgrades, 1)) == 0) {
|
if (internalCounter % (Math.max(20 - this.accelerationUpgrades, 1)) == 0)
|
||||||
|
{
|
||||||
int syphonMax = (int) (20 * this.dislocationMultiplier);
|
int syphonMax = (int) (20 * this.dislocationMultiplier);
|
||||||
int fluidInputted;
|
int fluidInputted;
|
||||||
int fluidOutputted;
|
int fluidOutputted;
|
||||||
|
@ -312,15 +341,17 @@ public class BloodAltar {
|
||||||
this.fluidOutput.amount += fluidOutputted;
|
this.fluidOutput.amount += fluidOutputted;
|
||||||
this.fluid.amount -= fluidOutputted;
|
this.fluid.amount -= fluidOutputted;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (internalCounter % 100 == 0 && (this.isActive || this.cooldownAfterCrafting <= 0))
|
if (internalCounter % 100 == 0 && (this.isActive || this.cooldownAfterCrafting <= 0))
|
||||||
startCycle();
|
startCycle();
|
||||||
|
|
||||||
updateAltar();
|
updateAltar();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAltar() {
|
private void updateAltar()
|
||||||
if (!isActive) {
|
{
|
||||||
|
if (!isActive)
|
||||||
|
{
|
||||||
if (cooldownAfterCrafting > 0)
|
if (cooldownAfterCrafting > 0)
|
||||||
cooldownAfterCrafting--;
|
cooldownAfterCrafting--;
|
||||||
return;
|
return;
|
||||||
|
@ -331,7 +362,7 @@ public class BloodAltar {
|
||||||
|
|
||||||
World world = tileAltar.getWorld();
|
World world = tileAltar.getWorld();
|
||||||
BlockPos pos = tileAltar.getPos();
|
BlockPos pos = tileAltar.getPos();
|
||||||
|
|
||||||
if (world.isRemote)
|
if (world.isRemote)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -339,9 +370,11 @@ public class BloodAltar {
|
||||||
float f1 = f * 0.6F + 0.4F;
|
float f1 = f * 0.6F + 0.4F;
|
||||||
float f2 = f * f * 0.7F - 0.5F;
|
float f2 = f * f * 0.7F - 0.5F;
|
||||||
float f3 = f * f * 0.6F - 0.7F;
|
float f3 = f * f * 0.6F - 0.7F;
|
||||||
|
|
||||||
if (!canBeFilled) {
|
if (!canBeFilled)
|
||||||
if (fluid != null && fluid.amount >= 1) {
|
{
|
||||||
|
if (fluid != null && fluid.amount >= 1)
|
||||||
|
{
|
||||||
int stackSize = tileAltar.getStackInSlot(0).stackSize;
|
int stackSize = tileAltar.getStackInSlot(0).stackSize;
|
||||||
int liquidDrained = Math.min((int) (altarTier.ordinal() >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount);
|
int liquidDrained = Math.min((int) (altarTier.ordinal() >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount);
|
||||||
|
|
||||||
|
@ -354,7 +387,8 @@ public class BloodAltar {
|
||||||
if (internalCounter % 4 == 0)
|
if (internalCounter % 4 == 0)
|
||||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + Math.random() - Math.random(), pos.getY() + Math.random() - Math.random(), pos.getZ() + Math.random() - Math.random(), f1, f2, f3);
|
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + Math.random() - Math.random(), pos.getY() + Math.random() - Math.random(), pos.getZ() + Math.random() - Math.random(), f1, f2, f3);
|
||||||
|
|
||||||
if (progress >= liquidRequired * stackSize) {
|
if (progress >= liquidRequired * stackSize)
|
||||||
|
{
|
||||||
ItemStack result = this.result;
|
ItemStack result = this.result;
|
||||||
|
|
||||||
if (result != null)
|
if (result != null)
|
||||||
|
@ -368,13 +402,15 @@ public class BloodAltar {
|
||||||
|
|
||||||
this.isActive = false;
|
this.isActive = false;
|
||||||
}
|
}
|
||||||
} else if (progress > 0) {
|
} else if (progress > 0)
|
||||||
|
{
|
||||||
progress -= (int) (efficiencyMultiplier * drainRate);
|
progress -= (int) (efficiencyMultiplier * drainRate);
|
||||||
|
|
||||||
if (internalCounter % 2 == 0)
|
if (internalCounter % 2 == 0)
|
||||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + Math.random() - Math.random(), pos.getY() + Math.random() - Math.random(), pos.getZ() + Math.random() - Math.random(), f1, f2, f3);
|
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + Math.random() - Math.random(), pos.getY() + Math.random() - Math.random(), pos.getZ() + Math.random() - Math.random(), f1, f2, f3);
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
ItemStack returnedItem = tileAltar.getStackInSlot(0);
|
ItemStack returnedItem = tileAltar.getStackInSlot(0);
|
||||||
|
|
||||||
if (!(returnedItem.getItem() instanceof IBloodOrb))
|
if (!(returnedItem.getItem() instanceof IBloodOrb))
|
||||||
|
@ -391,7 +427,8 @@ public class BloodAltar {
|
||||||
if (Strings.isNullOrEmpty(ownerUUID))
|
if (Strings.isNullOrEmpty(ownerUUID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fluid != null && fluid.amount >= 1) {
|
if (fluid != null && fluid.amount >= 1)
|
||||||
|
{
|
||||||
int liquidDrained = Math.min((int) (altarTier.ordinal() >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount);
|
int liquidDrained = Math.min((int) (altarTier.ordinal() >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount);
|
||||||
|
|
||||||
int drain = NetworkHelper.getSoulNetwork(ownerUUID, world).addLifeEssence(liquidDrained, (int) (item.getMaxEssence(returnedItem.getMetadata()) * this.orbCapacityMultiplier));
|
int drain = NetworkHelper.getSoulNetwork(ownerUUID, world).addLifeEssence(liquidDrained, (int) (item.getMaxEssence(returnedItem.getMetadata()) * this.orbCapacityMultiplier));
|
||||||
|
@ -405,14 +442,16 @@ public class BloodAltar {
|
||||||
|
|
||||||
world.markBlockForUpdate(pos);
|
world.markBlockForUpdate(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkTier() {
|
public void checkTier()
|
||||||
|
{
|
||||||
EnumAltarTier tier = BloodAltar.getAltarTier(tileAltar.getWorld(), tileAltar.getPos());
|
EnumAltarTier tier = BloodAltar.getAltarTier(tileAltar.getWorld(), tileAltar.getPos());
|
||||||
this.altarTier = tier;
|
this.altarTier = tier;
|
||||||
|
|
||||||
upgrade = BloodAltar.getUpgrades(tileAltar.getWorld(), tileAltar.getPos(), tier);
|
upgrade = BloodAltar.getUpgrades(tileAltar.getWorld(), tileAltar.getPos(), tier);
|
||||||
|
|
||||||
if (tier.equals(EnumAltarTier.ONE)) {
|
if (tier.equals(EnumAltarTier.ONE))
|
||||||
|
{
|
||||||
upgrade = null;
|
upgrade = null;
|
||||||
isUpgraded = false;
|
isUpgraded = false;
|
||||||
this.consumptionMultiplier = 0;
|
this.consumptionMultiplier = 0;
|
||||||
|
@ -424,7 +463,8 @@ public class BloodAltar {
|
||||||
this.dislocationMultiplier = 1;
|
this.dislocationMultiplier = 1;
|
||||||
this.accelerationUpgrades = 0;
|
this.accelerationUpgrades = 0;
|
||||||
return;
|
return;
|
||||||
} else if (!tier.equals(EnumAltarTier.ONE) && upgrade != null) {
|
} else if (!tier.equals(EnumAltarTier.ONE) && upgrade != null)
|
||||||
|
{
|
||||||
this.isUpgraded = true;
|
this.isUpgraded = true;
|
||||||
this.consumptionMultiplier = (float) (0.20 * upgrade.getSpeedCount());
|
this.consumptionMultiplier = (float) (0.20 * upgrade.getSpeedCount());
|
||||||
this.efficiencyMultiplier = (float) Math.pow(0.85, upgrade.getEfficiencyCount());
|
this.efficiencyMultiplier = (float) Math.pow(0.85, upgrade.getEfficiencyCount());
|
||||||
|
@ -439,131 +479,165 @@ public class BloodAltar {
|
||||||
this.capacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 10 * capacityMultiplier);
|
this.capacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 10 * capacityMultiplier);
|
||||||
this.bufferCapacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 1 * capacityMultiplier);
|
this.bufferCapacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 1 * capacityMultiplier);
|
||||||
|
|
||||||
if (this.fluid.amount > this.capacity) this.fluid.amount = this.capacity;
|
if (this.fluid.amount > this.capacity)
|
||||||
if (this.fluidOutput.amount > this.bufferCapacity) this.fluidOutput.amount = this.bufferCapacity;
|
this.fluid.amount = this.capacity;
|
||||||
if (this.fluidInput.amount > this.bufferCapacity) this.fluidInput.amount = this.bufferCapacity;
|
if (this.fluidOutput.amount > this.bufferCapacity)
|
||||||
|
this.fluidOutput.amount = this.bufferCapacity;
|
||||||
|
if (this.fluidInput.amount > this.bufferCapacity)
|
||||||
|
this.fluidInput.amount = this.bufferCapacity;
|
||||||
|
|
||||||
tileAltar.getWorld().markBlockForUpdate(tileAltar.getPos());
|
tileAltar.getWorld().markBlockForUpdate(tileAltar.getPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int fillMainTank(int amount) {
|
public int fillMainTank(int amount)
|
||||||
|
{
|
||||||
int filledAmount = Math.min(capacity - fluid.amount, amount);
|
int filledAmount = Math.min(capacity - fluid.amount, amount);
|
||||||
fluid.amount += filledAmount;
|
fluid.amount += filledAmount;
|
||||||
|
|
||||||
return filledAmount;
|
return filledAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sacrificialDaggerCall(int amount, boolean isSacrifice) {
|
public void sacrificialDaggerCall(int amount, boolean isSacrifice)
|
||||||
if (this.lockdownDuration > 0) {
|
{
|
||||||
|
if (this.lockdownDuration > 0)
|
||||||
|
{
|
||||||
int amt = (int) Math.min(bufferCapacity - fluidInput.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount);
|
int amt = (int) Math.min(bufferCapacity - fluidInput.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount);
|
||||||
fluidInput.amount += amt;
|
fluidInput.amount += amt;
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
fluid.amount += Math.min(capacity - fluid.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount);
|
fluid.amount += Math.min(capacity - fluid.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMainFluid(FluidStack fluid) {
|
public void setMainFluid(FluidStack fluid)
|
||||||
|
{
|
||||||
this.fluid = fluid;
|
this.fluid = fluid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOutputFluid(FluidStack fluid) {
|
public void setOutputFluid(FluidStack fluid)
|
||||||
|
{
|
||||||
this.fluidOutput = fluid;
|
this.fluidOutput = fluid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInputFluid(FluidStack fluid) {
|
public void setInputFluid(FluidStack fluid)
|
||||||
|
{
|
||||||
this.fluidInput = fluid;
|
this.fluidInput = fluid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AltarUpgrade getUpgrade() {
|
public AltarUpgrade getUpgrade()
|
||||||
|
{
|
||||||
return upgrade;
|
return upgrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUpgrade(AltarUpgrade upgrade) {
|
public void setUpgrade(AltarUpgrade upgrade)
|
||||||
|
{
|
||||||
this.upgrade = upgrade;
|
this.upgrade = upgrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCapacity() {
|
public int getCapacity()
|
||||||
|
{
|
||||||
return capacity;
|
return capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FluidStack getFluid() {
|
public FluidStack getFluid()
|
||||||
|
{
|
||||||
return fluid;
|
return fluid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFluidAmount() {
|
public int getFluidAmount()
|
||||||
|
{
|
||||||
return fluid.amount;
|
return fluid.amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCurrentBlood() {
|
public int getCurrentBlood()
|
||||||
|
{
|
||||||
return getFluidAmount();
|
return getFluidAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumAltarTier getTier() {
|
public EnumAltarTier getTier()
|
||||||
|
{
|
||||||
return altarTier;
|
return altarTier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTier(EnumAltarTier tier) {
|
public void setTier(EnumAltarTier tier)
|
||||||
|
{
|
||||||
this.altarTier = tier;
|
this.altarTier = tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProgress() {
|
public int getProgress()
|
||||||
|
{
|
||||||
return progress;
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getSacrificeMultiplier() {
|
public float getSacrificeMultiplier()
|
||||||
|
{
|
||||||
return sacrificeEfficiencyMultiplier;
|
return sacrificeEfficiencyMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getSelfSacrificeMultiplier() {
|
public float getSelfSacrificeMultiplier()
|
||||||
|
{
|
||||||
return selfSacrificeEfficiencyMultiplier;
|
return selfSacrificeEfficiencyMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getOrbMultiplier() {
|
public float getOrbMultiplier()
|
||||||
|
{
|
||||||
return orbCapacityMultiplier;
|
return orbCapacityMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getDislocationMultiplier() {
|
public float getDislocationMultiplier()
|
||||||
|
{
|
||||||
return dislocationMultiplier;
|
return dislocationMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getConsumptionMultiplier() {
|
public float getConsumptionMultiplier()
|
||||||
|
{
|
||||||
return consumptionMultiplier;
|
return consumptionMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getConsumptionRate() {
|
public float getConsumptionRate()
|
||||||
|
{
|
||||||
return consumptionRate;
|
return consumptionRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLiquidRequired() {
|
public int getLiquidRequired()
|
||||||
|
{
|
||||||
return liquidRequired;
|
return liquidRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBufferCapacity() {
|
public int getBufferCapacity()
|
||||||
|
{
|
||||||
return bufferCapacity;
|
return bufferCapacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addToDemonBloodDuration(int dur) {
|
public void addToDemonBloodDuration(int dur)
|
||||||
|
{
|
||||||
this.demonBloodDuration += dur;
|
this.demonBloodDuration += dur;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasDemonBlood() {
|
public boolean hasDemonBlood()
|
||||||
|
{
|
||||||
return this.demonBloodDuration > 0;
|
return this.demonBloodDuration > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void decrementDemonBlood() {
|
public void decrementDemonBlood()
|
||||||
|
{
|
||||||
this.demonBloodDuration = Math.max(0, this.demonBloodDuration - 1);
|
this.demonBloodDuration = Math.max(0, this.demonBloodDuration - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActive() {
|
public void setActive()
|
||||||
|
{
|
||||||
isActive = false;
|
isActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isActive() {
|
public boolean isActive()
|
||||||
|
{
|
||||||
return isActive;
|
return isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void requestPauseAfterCrafting(int amount) {
|
public void requestPauseAfterCrafting(int amount)
|
||||||
if (this.isActive) {
|
{
|
||||||
|
if (this.isActive)
|
||||||
|
{
|
||||||
this.cooldownAfterCrafting = amount;
|
this.cooldownAfterCrafting = amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,22 +7,26 @@ import net.minecraftforge.fml.common.registry.GameData;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class BlockStack {
|
public class BlockStack
|
||||||
|
{
|
||||||
|
|
||||||
private final Block block;
|
private final Block block;
|
||||||
private final int meta;
|
private final int meta;
|
||||||
|
|
||||||
public BlockStack(Block block, int meta) {
|
public BlockStack(Block block, int meta)
|
||||||
|
{
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.meta = meta;
|
this.meta = meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockStack(Block block) {
|
public BlockStack(Block block)
|
||||||
|
{
|
||||||
this(block, 0);
|
this(block, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString()
|
||||||
|
{
|
||||||
return GameData.getBlockRegistry().getNameForObject(block) + ":" + meta;
|
return GameData.getBlockRegistry().getNameForObject(block) + ":" + meta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,14 @@ import net.minecraft.util.DamageSource;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
public class BloodMagicAPI {
|
public class BloodMagicAPI
|
||||||
|
{
|
||||||
|
|
||||||
public static final String ORB = "ItemBloodOrb";
|
public static final String ORB = "ItemBloodOrb";
|
||||||
public static final String SCRIBE = "ItemInscriptionTool";
|
public static final String SCRIBE = "ItemInscriptionTool";
|
||||||
|
|
||||||
@Getter @Setter
|
@Getter
|
||||||
|
@Setter
|
||||||
private static boolean loggingEnabled;
|
private static boolean loggingEnabled;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -23,16 +25,20 @@ public class BloodMagicAPI {
|
||||||
private static DamageSource damageSource = new DamageSourceBloodMagic();
|
private static DamageSource damageSource = new DamageSourceBloodMagic();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to obtain Items from BloodMagic. Use the constants above for common items in case internal names
|
* Used to obtain Items from BloodMagic. Use the constants above for common
|
||||||
* change.
|
* items in case internal names change.
|
||||||
*
|
*
|
||||||
* @param name - The registered name of the item. Usually the same as the class name.
|
* @param name
|
||||||
|
* - The registered name of the item. Usually the same as the
|
||||||
|
* class name.
|
||||||
* @return - The requested Item
|
* @return - The requested Item
|
||||||
*/
|
*/
|
||||||
public static Item getItem(String name) {
|
public static Item getItem(String name)
|
||||||
|
{
|
||||||
return GameRegistry.findItem(Constants.Mod.MODID, name);
|
return GameRegistry.findItem(Constants.Mod.MODID, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter @Setter
|
@Getter
|
||||||
|
@Setter
|
||||||
private static Fluid lifeEssence;
|
private static Fluid lifeEssence;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,11 @@ import net.minecraft.potion.Potion;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class Constants {
|
public class Constants
|
||||||
|
{
|
||||||
|
|
||||||
public static class NBT {
|
public static class NBT
|
||||||
|
{
|
||||||
|
|
||||||
public static final String OWNER_UUID = "ownerUUID";
|
public static final String OWNER_UUID = "ownerUUID";
|
||||||
public static final String USES = "uses";
|
public static final String USES = "uses";
|
||||||
|
@ -62,7 +64,8 @@ public class Constants {
|
||||||
public static final String CONTAINED_BLOCK_META = "containedBlockMeta";
|
public static final String CONTAINED_BLOCK_META = "containedBlockMeta";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Mod {
|
public static class Mod
|
||||||
|
{
|
||||||
|
|
||||||
public static final String MODID = "BloodMagic";
|
public static final String MODID = "BloodMagic";
|
||||||
public static final String DOMAIN = MODID.toLowerCase(Locale.ENGLISH) + ":";
|
public static final String DOMAIN = MODID.toLowerCase(Locale.ENGLISH) + ":";
|
||||||
|
@ -71,13 +74,15 @@ public class Constants {
|
||||||
public static final String DEPEND = "";
|
public static final String DEPEND = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Compat {
|
public static class Compat
|
||||||
|
{
|
||||||
public static final String JEI_CATEGORY_ALTAR = Mod.MODID + ":altar";
|
public static final String JEI_CATEGORY_ALTAR = Mod.MODID + ":altar";
|
||||||
public static final String JEI_CATEGORY_BINDING = Mod.MODID + ":binding";
|
public static final String JEI_CATEGORY_BINDING = Mod.MODID + ":binding";
|
||||||
public static final String JEI_CATEGORY_ALCHEMYARRAY = Mod.MODID + ":alchemyArray";
|
public static final String JEI_CATEGORY_ALCHEMYARRAY = Mod.MODID + ":alchemyArray";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Misc {
|
public static class Misc
|
||||||
|
{
|
||||||
public static final int POTION_ARRAY_SIZE = Potion.potionTypes.length;
|
public static final int POTION_ARRAY_SIZE = Potion.potionTypes.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,11 @@ import net.minecraft.util.ChatComponentText;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.IChatComponent;
|
import net.minecraft.util.IChatComponent;
|
||||||
|
|
||||||
public class DamageSourceBloodMagic extends DamageSource {
|
public class DamageSourceBloodMagic extends DamageSource
|
||||||
|
{
|
||||||
|
|
||||||
public DamageSourceBloodMagic() {
|
public DamageSourceBloodMagic()
|
||||||
|
{
|
||||||
super("bloodMagic");
|
super("bloodMagic");
|
||||||
|
|
||||||
setDamageBypassesArmor();
|
setDamageBypassesArmor();
|
||||||
|
@ -16,7 +18,8 @@ public class DamageSourceBloodMagic extends DamageSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IChatComponent getDeathMessage(EntityLivingBase livingBase) {
|
public IChatComponent getDeathMessage(EntityLivingBase livingBase)
|
||||||
|
{
|
||||||
return new ChatComponentText(TextHelper.localizeEffect("chat.BloodMagic.damageSource", livingBase.getName()));
|
return new ChatComponentText(TextHelper.localizeEffect("chat.BloodMagic.damageSource", livingBase.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class ItemStackWrapper {
|
public class ItemStackWrapper
|
||||||
|
{
|
||||||
|
|
||||||
public final Item item;
|
public final Item item;
|
||||||
public final int stackSize;
|
public final int stackSize;
|
||||||
|
@ -18,44 +19,54 @@ public class ItemStackWrapper {
|
||||||
@Setter
|
@Setter
|
||||||
public NBTTagCompound nbtTag;
|
public NBTTagCompound nbtTag;
|
||||||
|
|
||||||
public ItemStackWrapper(Item item, int stackSize) {
|
public ItemStackWrapper(Item item, int stackSize)
|
||||||
|
{
|
||||||
this(item, stackSize, 0);
|
this(item, stackSize, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStackWrapper(Item item) {
|
public ItemStackWrapper(Item item)
|
||||||
|
{
|
||||||
this(item, 1, 0);
|
this(item, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStackWrapper(Block block, int stackSize, int meta) {
|
public ItemStackWrapper(Block block, int stackSize, int meta)
|
||||||
|
{
|
||||||
this(Item.getItemFromBlock(block), stackSize, meta);
|
this(Item.getItemFromBlock(block), stackSize, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStackWrapper(Block block, int stackSize) {
|
public ItemStackWrapper(Block block, int stackSize)
|
||||||
|
{
|
||||||
this(block, stackSize, 0);
|
this(block, stackSize, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStackWrapper(Block block) {
|
public ItemStackWrapper(Block block)
|
||||||
|
{
|
||||||
this(block, 1, 0);
|
this(block, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStackWrapper getHolder(ItemStack stack) {
|
public static ItemStackWrapper getHolder(ItemStack stack)
|
||||||
|
{
|
||||||
return new ItemStackWrapper(stack.getItem(), stack.stackSize, stack.getItemDamage());
|
return new ItemStackWrapper(stack.getItem(), stack.stackSize, stack.getItemDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack toStack() {
|
public ItemStack toStack()
|
||||||
|
{
|
||||||
return new ItemStack(item, stackSize, meta);
|
return new ItemStack(item, stackSize, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDisplayName() {
|
public String getDisplayName()
|
||||||
|
{
|
||||||
return toStack().getDisplayName();
|
return toStack().getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString()
|
||||||
|
{
|
||||||
return stackSize + "x" + item.getUnlocalizedName() + "@" + this.meta;
|
return stackSize + "x" + item.getUnlocalizedName() + "@" + this.meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack toStack(int count) {
|
public ItemStack toStack(int count)
|
||||||
|
{
|
||||||
ItemStack result = new ItemStack(item, count, meta);
|
ItemStack result = new ItemStack(item, count, meta);
|
||||||
result.setTagCompound(nbtTag);
|
result.setTagCompound(nbtTag);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -2,8 +2,9 @@ package WayofTime.bloodmagic.api.alchemyCrafting;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
public abstract class AlchemyArrayEffect {
|
public abstract class AlchemyArrayEffect
|
||||||
|
{
|
||||||
public abstract boolean update(TileEntity tile, int ticksActive);
|
|
||||||
|
public abstract boolean update(TileEntity tile, int ticksActive);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,39 +6,45 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
|
|
||||||
public class AlchemyArrayEffectCrafting extends AlchemyArrayEffect {
|
public class AlchemyArrayEffectCrafting extends AlchemyArrayEffect
|
||||||
|
{
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public final ItemStack outputStack;
|
public final ItemStack outputStack;
|
||||||
public int tickLimit;
|
public int tickLimit;
|
||||||
|
|
||||||
public AlchemyArrayEffectCrafting(ItemStack outputStack) {
|
public AlchemyArrayEffectCrafting(ItemStack outputStack)
|
||||||
this(outputStack, 200);
|
{
|
||||||
}
|
this(outputStack, 200);
|
||||||
|
}
|
||||||
public AlchemyArrayEffectCrafting(ItemStack outputStack, int tickLimit) {
|
|
||||||
this.outputStack = outputStack;
|
|
||||||
this.tickLimit = tickLimit;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public AlchemyArrayEffectCrafting(ItemStack outputStack, int tickLimit)
|
||||||
public boolean update(TileEntity tile, int ticksActive) {
|
{
|
||||||
//TODO: Add recipe rechecking to verify nothing screwy is going on.
|
this.outputStack = outputStack;
|
||||||
if(tile.getWorld().isRemote) {
|
this.tickLimit = tickLimit;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(ticksActive >= tickLimit){
|
|
||||||
BlockPos pos = tile.getPos();
|
|
||||||
|
|
||||||
ItemStack output = outputStack.copy();
|
@Override
|
||||||
EntityItem outputEntity = new EntityItem(tile.getWorld(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output);
|
public boolean update(TileEntity tile, int ticksActive)
|
||||||
|
{
|
||||||
|
// TODO: Add recipe rechecking to verify nothing screwy is going on.
|
||||||
|
if (tile.getWorld().isRemote)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
tile.getWorld().spawnEntityInWorld(outputEntity);
|
if (ticksActive >= tickLimit)
|
||||||
|
{
|
||||||
|
BlockPos pos = tile.getPos();
|
||||||
|
|
||||||
return true;
|
ItemStack output = outputStack.copy();
|
||||||
}
|
EntityItem outputEntity = new EntityItem(tile.getWorld(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output);
|
||||||
|
|
||||||
return false;
|
tile.getWorld().spawnEntityInWorld(outputEntity);
|
||||||
}
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,132 +9,146 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class AlchemyCircleRenderer {
|
public class AlchemyCircleRenderer
|
||||||
|
{
|
||||||
|
|
||||||
public float offsetFromFace = -0.9f;
|
public float offsetFromFace = -0.9f;
|
||||||
public final ResourceLocation arrayResource;
|
public final ResourceLocation arrayResource;
|
||||||
|
|
||||||
public AlchemyCircleRenderer() {
|
public AlchemyCircleRenderer()
|
||||||
this(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SightSigil.png"));
|
{
|
||||||
}
|
this(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SightSigil.png"));
|
||||||
|
}
|
||||||
public AlchemyCircleRenderer(ResourceLocation arrayResource) {
|
|
||||||
this.arrayResource = arrayResource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getRotation(float craftTime) {
|
public AlchemyCircleRenderer(ResourceLocation arrayResource)
|
||||||
float offset = 2;
|
{
|
||||||
if (craftTime >= offset) {
|
this.arrayResource = arrayResource;
|
||||||
float modifier = (float) Math.pow(craftTime - offset, 1.5);
|
}
|
||||||
return modifier * 1f;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getSecondaryRotation(float craftTime) {
|
public float getRotation(float craftTime)
|
||||||
float offset = 50;
|
{
|
||||||
if (craftTime >= offset) {
|
float offset = 2;
|
||||||
float modifier = (float) Math.pow(craftTime - offset, 1.7);
|
if (craftTime >= offset)
|
||||||
return modifier * 0.5f;
|
{
|
||||||
}
|
float modifier = (float) Math.pow(craftTime - offset, 1.5);
|
||||||
return 0;
|
return modifier * 1f;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
public float getSizeModifier(float craftTime) {
|
public float getSecondaryRotation(float craftTime)
|
||||||
if (craftTime >= 150 && craftTime <= 250) {
|
{
|
||||||
return (200 - craftTime) / 50f;
|
float offset = 50;
|
||||||
}
|
if (craftTime >= offset)
|
||||||
return 1.0f;
|
{
|
||||||
}
|
float modifier = (float) Math.pow(craftTime - offset, 1.7);
|
||||||
|
return modifier * 0.5f;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
public float getVerticalOffset(float craftTime) {
|
public float getSizeModifier(float craftTime)
|
||||||
if (craftTime >= 5) {
|
{
|
||||||
if (craftTime <= 40) {
|
if (craftTime >= 150 && craftTime <= 250)
|
||||||
return (float) ((-0.4) * Math.pow((craftTime - 5) / 35f, 3));
|
{
|
||||||
} else {
|
return (200 - craftTime) / 50f;
|
||||||
return -0.4f;
|
}
|
||||||
}
|
return 1.0f;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void renderAt(TileEntity tile, double x, double y, double z, float craftTime) {
|
public float getVerticalOffset(float craftTime)
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
{
|
||||||
WorldRenderer wr = tessellator.getWorldRenderer();
|
if (craftTime >= 5)
|
||||||
|
{
|
||||||
|
if (craftTime <= 40)
|
||||||
|
{
|
||||||
|
return (float) ((-0.4) * Math.pow((craftTime - 5) / 35f, 3));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return -0.4f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
public void renderAt(TileEntity tile, double x, double y, double z, float craftTime)
|
||||||
// float rot = (float)(this.worldObj.provider.getWorldTime() % (360 /
|
{
|
||||||
// this.rotationspeed) * this.rotationspeed) + this.rotationspeed * f;
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
float rot = getRotation(craftTime);
|
WorldRenderer wr = tessellator.getWorldRenderer();
|
||||||
float secondaryRot = getSecondaryRotation(craftTime);
|
|
||||||
|
|
||||||
float size = 1.0F * getSizeModifier(craftTime);
|
GlStateManager.pushMatrix();
|
||||||
|
// float rot = (float)(this.worldObj.provider.getWorldTime() % (360 /
|
||||||
|
// this.rotationspeed) * this.rotationspeed) + this.rotationspeed * f;
|
||||||
|
float rot = getRotation(craftTime);
|
||||||
|
float secondaryRot = getSecondaryRotation(craftTime);
|
||||||
|
|
||||||
// Bind the texture to the circle
|
float size = 1.0F * getSizeModifier(craftTime);
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(arrayResource);
|
|
||||||
|
|
||||||
GlStateManager.disableCull();
|
// Bind the texture to the circle
|
||||||
GlStateManager.enableBlend();
|
Minecraft.getMinecraft().renderEngine.bindTexture(arrayResource);
|
||||||
GlStateManager.blendFunc(770, 1);
|
|
||||||
|
|
||||||
GlStateManager.translate(x, y, z);
|
GlStateManager.disableCull();
|
||||||
|
GlStateManager.enableBlend();
|
||||||
|
GlStateManager.blendFunc(770, 1);
|
||||||
|
|
||||||
EnumFacing sideHit = EnumFacing.UP; // Specify which face this "circle"
|
GlStateManager.translate(x, y, z);
|
||||||
// is located on
|
|
||||||
GlStateManager.translate(sideHit.getFrontOffsetX() * offsetFromFace, sideHit.getFrontOffsetY()
|
|
||||||
* offsetFromFace, sideHit.getFrontOffsetZ() * offsetFromFace);
|
|
||||||
|
|
||||||
switch (sideHit) {
|
EnumFacing sideHit = EnumFacing.UP; // Specify which face this "circle"
|
||||||
case DOWN:
|
// is located on
|
||||||
GlStateManager.translate(0, 0, 1);
|
GlStateManager.translate(sideHit.getFrontOffsetX() * offsetFromFace, sideHit.getFrontOffsetY() * offsetFromFace, sideHit.getFrontOffsetZ() * offsetFromFace);
|
||||||
GlStateManager.rotate(-90.0f, 1, 0, 0);
|
|
||||||
break;
|
|
||||||
case EAST:
|
|
||||||
GlStateManager.rotate(-90.0f, 0, 1, 0);
|
|
||||||
GlStateManager.translate(0, 0, -1);
|
|
||||||
break;
|
|
||||||
case NORTH:
|
|
||||||
break;
|
|
||||||
case SOUTH:
|
|
||||||
GlStateManager.rotate(180.0f, 0, 1, 0);
|
|
||||||
GlStateManager.translate(-1, 0, -1);
|
|
||||||
break;
|
|
||||||
case UP:
|
|
||||||
GlStateManager.translate(0, 1, 0);
|
|
||||||
GlStateManager.rotate(90.0f, 1, 0, 0);
|
|
||||||
break;
|
|
||||||
case WEST:
|
|
||||||
GlStateManager.translate(0, 0, 1);
|
|
||||||
GlStateManager.rotate(90.0f, 0, 1, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
switch (sideHit)
|
||||||
GlStateManager.translate(0.5f, 0.5f, getVerticalOffset(craftTime));
|
{
|
||||||
GlStateManager.rotate(rot, 0, 0, 1);
|
case DOWN:
|
||||||
GlStateManager.rotate(secondaryRot, 1, 0, 0);
|
GlStateManager.translate(0, 0, 1);
|
||||||
GlStateManager.rotate(secondaryRot * 0.45812f, 0, 0, 1);
|
GlStateManager.rotate(-90.0f, 1, 0, 0);
|
||||||
double var31 = 0.0D;
|
break;
|
||||||
double var33 = 1.0D;
|
case EAST:
|
||||||
double var35 = 0;
|
GlStateManager.rotate(-90.0f, 0, 1, 0);
|
||||||
double var37 = 1;
|
GlStateManager.translate(0, 0, -1);
|
||||||
|
break;
|
||||||
|
case NORTH:
|
||||||
|
break;
|
||||||
|
case SOUTH:
|
||||||
|
GlStateManager.rotate(180.0f, 0, 1, 0);
|
||||||
|
GlStateManager.translate(-1, 0, -1);
|
||||||
|
break;
|
||||||
|
case UP:
|
||||||
|
GlStateManager.translate(0, 1, 0);
|
||||||
|
GlStateManager.rotate(90.0f, 1, 0, 0);
|
||||||
|
break;
|
||||||
|
case WEST:
|
||||||
|
GlStateManager.translate(0, 0, 1);
|
||||||
|
GlStateManager.rotate(90.0f, 0, 1, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
GlStateManager.color(0.5f, 1f, 1f, 1f);
|
GlStateManager.pushMatrix();
|
||||||
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
|
GlStateManager.translate(0.5f, 0.5f, getVerticalOffset(craftTime));
|
||||||
// wr.setBrightness(200);
|
GlStateManager.rotate(rot, 0, 0, 1);
|
||||||
wr.pos(size / 2f, size / 2f, 0.0D).tex(var33, var37).endVertex();
|
GlStateManager.rotate(secondaryRot, 1, 0, 0);
|
||||||
wr.pos(size / 2f, -size / 2f, 0.0D).tex(var33, var35).endVertex();
|
GlStateManager.rotate(secondaryRot * 0.45812f, 0, 0, 1);
|
||||||
wr.pos(-size / 2f, -size / 2f, 0.0D).tex(var31, var35).endVertex();
|
double var31 = 0.0D;
|
||||||
wr.pos(-size / 2f, size / 2f, 0.0D).tex(var31, var37).endVertex();
|
double var33 = 1.0D;
|
||||||
tessellator.draw();
|
double var35 = 0;
|
||||||
|
double var37 = 1;
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.color(0.5f, 1f, 1f, 1f);
|
||||||
|
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||||
|
// wr.setBrightness(200);
|
||||||
|
wr.pos(size / 2f, size / 2f, 0.0D).tex(var33, var37).endVertex();
|
||||||
|
wr.pos(size / 2f, -size / 2f, 0.0D).tex(var33, var35).endVertex();
|
||||||
|
wr.pos(-size / 2f, -size / 2f, 0.0D).tex(var31, var35).endVertex();
|
||||||
|
wr.pos(-size / 2f, size / 2f, 0.0D).tex(var31, var37).endVertex();
|
||||||
|
tessellator.draw();
|
||||||
|
|
||||||
// GlStateManager.depthMask(true);
|
GlStateManager.popMatrix();
|
||||||
GlStateManager.disableBlend();
|
|
||||||
GlStateManager.enableCull();
|
|
||||||
// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
// GlStateManager.depthMask(true);
|
||||||
}
|
GlStateManager.disableBlend();
|
||||||
|
GlStateManager.enableCull();
|
||||||
|
// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,8 @@ import net.minecraft.util.BlockPos;
|
||||||
* Used for building the altar structure.
|
* Used for building the altar structure.
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public class AltarComponent {
|
public class AltarComponent
|
||||||
|
{
|
||||||
|
|
||||||
private BlockPos offset;
|
private BlockPos offset;
|
||||||
private boolean upgradeSlot;
|
private boolean upgradeSlot;
|
||||||
|
@ -16,11 +17,14 @@ public class AltarComponent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a component location for the altar.
|
* Sets a component location for the altar.
|
||||||
*
|
*
|
||||||
* @param offset - Where the block should be in relation to the Altar
|
* @param offset
|
||||||
* @param component - The type of Component the location should contain
|
* - Where the block should be in relation to the Altar
|
||||||
|
* @param component
|
||||||
|
* - The type of Component the location should contain
|
||||||
*/
|
*/
|
||||||
public AltarComponent(BlockPos offset, EnumAltarComponent component) {
|
public AltarComponent(BlockPos offset, EnumAltarComponent component)
|
||||||
|
{
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
this.component = component;
|
this.component = component;
|
||||||
}
|
}
|
||||||
|
@ -29,16 +33,18 @@ public class AltarComponent {
|
||||||
* Use for setting a location at which there must be a block, but the type
|
* Use for setting a location at which there must be a block, but the type
|
||||||
* of block does not matter.
|
* of block does not matter.
|
||||||
*/
|
*/
|
||||||
public AltarComponent(BlockPos offset) {
|
public AltarComponent(BlockPos offset)
|
||||||
|
{
|
||||||
this(offset, EnumAltarComponent.NOTAIR);
|
this(offset, EnumAltarComponent.NOTAIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the location to an upgrade slot.
|
* Sets the location to an upgrade slot.
|
||||||
*
|
*
|
||||||
* @return the current instance for further use.
|
* @return the current instance for further use.
|
||||||
*/
|
*/
|
||||||
public AltarComponent setUpgradeSlot() {
|
public AltarComponent setUpgradeSlot()
|
||||||
|
{
|
||||||
this.upgradeSlot = true;
|
this.upgradeSlot = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ import lombok.NoArgsConstructor;
|
||||||
@Getter
|
@Getter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class AltarUpgrade {
|
public class AltarUpgrade
|
||||||
|
{
|
||||||
|
|
||||||
private int speedCount;
|
private int speedCount;
|
||||||
private int efficiencyCount;
|
private int efficiencyCount;
|
||||||
|
@ -21,47 +22,56 @@ public class AltarUpgrade {
|
||||||
|
|
||||||
// Adders
|
// Adders
|
||||||
|
|
||||||
public AltarUpgrade addSpeed() {
|
public AltarUpgrade addSpeed()
|
||||||
|
{
|
||||||
speedCount++;
|
speedCount++;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AltarUpgrade addEfficiency() {
|
public AltarUpgrade addEfficiency()
|
||||||
|
{
|
||||||
efficiencyCount++;
|
efficiencyCount++;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AltarUpgrade addSacrifice() {
|
public AltarUpgrade addSacrifice()
|
||||||
|
{
|
||||||
sacrificeCount++;
|
sacrificeCount++;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AltarUpgrade addSelfSacrifice() {
|
public AltarUpgrade addSelfSacrifice()
|
||||||
|
{
|
||||||
selfSacrificeCount++;
|
selfSacrificeCount++;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AltarUpgrade addDisplacement() {
|
public AltarUpgrade addDisplacement()
|
||||||
|
{
|
||||||
displacementCount++;
|
displacementCount++;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AltarUpgrade addCapacity() {
|
public AltarUpgrade addCapacity()
|
||||||
|
{
|
||||||
capacityCount++;
|
capacityCount++;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AltarUpgrade addOrbCapacity() {
|
public AltarUpgrade addOrbCapacity()
|
||||||
|
{
|
||||||
orbCapacityCount++;
|
orbCapacityCount++;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AltarUpgrade addBetterCapacity() {
|
public AltarUpgrade addBetterCapacity()
|
||||||
|
{
|
||||||
betterCapacityCount++;
|
betterCapacityCount++;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AltarUpgrade addAcceleration() {
|
public AltarUpgrade addAcceleration()
|
||||||
|
{
|
||||||
accelerationCount++;
|
accelerationCount++;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
package WayofTime.bloodmagic.api.altar;
|
package WayofTime.bloodmagic.api.altar;
|
||||||
|
|
||||||
public enum EnumAltarComponent {
|
public enum EnumAltarComponent
|
||||||
|
{
|
||||||
|
|
||||||
GLOWSTONE,
|
GLOWSTONE, BLOODSTONE, BEACON, BLOODRUNE, CRYSTAL, NOTAIR
|
||||||
BLOODSTONE,
|
|
||||||
BEACON,
|
|
||||||
BLOODRUNE,
|
|
||||||
CRYSTAL,
|
|
||||||
NOTAIR
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,13 @@ import net.minecraft.util.BlockPos;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public enum EnumAltarTier {
|
public enum EnumAltarTier
|
||||||
ONE(),
|
{
|
||||||
TWO() {
|
ONE(), TWO()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public void buildComponents() {
|
public void buildComponents()
|
||||||
|
{
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(-1, -1, -1), EnumAltarComponent.BLOODRUNE));
|
altarComponents.add(new AltarComponent(new BlockPos(-1, -1, -1), EnumAltarComponent.BLOODRUNE));
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(0, -1, -1), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(0, -1, -1), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(1, -1, -1), EnumAltarComponent.BLOODRUNE));
|
altarComponents.add(new AltarComponent(new BlockPos(1, -1, -1), EnumAltarComponent.BLOODRUNE));
|
||||||
|
@ -21,9 +23,11 @@ public enum EnumAltarTier {
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(1, -1, 1), EnumAltarComponent.BLOODRUNE));
|
altarComponents.add(new AltarComponent(new BlockPos(1, -1, 1), EnumAltarComponent.BLOODRUNE));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
THREE() {
|
THREE()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public void buildComponents() {
|
public void buildComponents()
|
||||||
|
{
|
||||||
altarComponents.addAll(TWO.getAltarComponents());
|
altarComponents.addAll(TWO.getAltarComponents());
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(-1, -1, -1), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(-1, -1, -1), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(0, -1, -1), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(0, -1, -1), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
|
@ -46,7 +50,8 @@ public enum EnumAltarTier {
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(-3, 1, 3), EnumAltarComponent.GLOWSTONE));
|
altarComponents.add(new AltarComponent(new BlockPos(-3, 1, 3), EnumAltarComponent.GLOWSTONE));
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(3, 1, 3), EnumAltarComponent.GLOWSTONE));
|
altarComponents.add(new AltarComponent(new BlockPos(3, 1, 3), EnumAltarComponent.GLOWSTONE));
|
||||||
|
|
||||||
for (int i = -2; i <= 2; i++) {
|
for (int i = -2; i <= 2; i++)
|
||||||
|
{
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(3, -2, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(3, -2, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(-3, -2, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(-3, -2, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(i, -2, 3), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(i, -2, 3), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
|
@ -54,19 +59,23 @@ public enum EnumAltarTier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FOUR() {
|
FOUR()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public void buildComponents() {
|
public void buildComponents()
|
||||||
|
{
|
||||||
altarComponents.addAll(THREE.getAltarComponents());
|
altarComponents.addAll(THREE.getAltarComponents());
|
||||||
|
|
||||||
for (int i = -3; i <= 3; i++) {
|
for (int i = -3; i <= 3; i++)
|
||||||
|
{
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(5, -3, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(5, -3, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(-5, -3, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(-5, -3, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(i, -3, 5), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(i, -3, 5), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(i, -3, -5), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(i, -3, -5), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = -2; i <= 1; i++) {
|
for (int i = -2; i <= 1; i++)
|
||||||
|
{
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(5, i, 5)));
|
altarComponents.add(new AltarComponent(new BlockPos(5, i, 5)));
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(5, i, -5)));
|
altarComponents.add(new AltarComponent(new BlockPos(5, i, -5)));
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(-5, i, -5)));
|
altarComponents.add(new AltarComponent(new BlockPos(-5, i, -5)));
|
||||||
|
@ -79,16 +88,19 @@ public enum EnumAltarTier {
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(-5, 2, 5), EnumAltarComponent.BLOODSTONE));
|
altarComponents.add(new AltarComponent(new BlockPos(-5, 2, 5), EnumAltarComponent.BLOODSTONE));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FIVE() {
|
FIVE()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public void buildComponents() {
|
public void buildComponents()
|
||||||
|
{
|
||||||
altarComponents.addAll(FOUR.getAltarComponents());
|
altarComponents.addAll(FOUR.getAltarComponents());
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(-8, -3, 8), EnumAltarComponent.BEACON));
|
altarComponents.add(new AltarComponent(new BlockPos(-8, -3, 8), EnumAltarComponent.BEACON));
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(-8, -3, -8), EnumAltarComponent.BEACON));
|
altarComponents.add(new AltarComponent(new BlockPos(-8, -3, -8), EnumAltarComponent.BEACON));
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(8, -3, -8), EnumAltarComponent.BEACON));
|
altarComponents.add(new AltarComponent(new BlockPos(8, -3, -8), EnumAltarComponent.BEACON));
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(8, -3, 8), EnumAltarComponent.BEACON));
|
altarComponents.add(new AltarComponent(new BlockPos(8, -3, 8), EnumAltarComponent.BEACON));
|
||||||
|
|
||||||
for (int i = -6; i <= 6; i++) {
|
for (int i = -6; i <= 6; i++)
|
||||||
|
{
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(8, -4, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(8, -4, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(-8, -4, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(-8, -4, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(i, -4, 8), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(i, -4, 8), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
|
@ -96,12 +108,15 @@ public enum EnumAltarTier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
SIX() {
|
SIX()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public void buildComponents() {
|
public void buildComponents()
|
||||||
|
{
|
||||||
altarComponents.addAll(FIVE.getAltarComponents());
|
altarComponents.addAll(FIVE.getAltarComponents());
|
||||||
|
|
||||||
for (int i = -4; i <= 2; i++) {
|
for (int i = -4; i <= 2; i++)
|
||||||
|
{
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(11, i, 11)));
|
altarComponents.add(new AltarComponent(new BlockPos(11, i, 11)));
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(-11, i, -11)));
|
altarComponents.add(new AltarComponent(new BlockPos(-11, i, -11)));
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(11, i, -11)));
|
altarComponents.add(new AltarComponent(new BlockPos(11, i, -11)));
|
||||||
|
@ -113,7 +128,8 @@ public enum EnumAltarTier {
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(11, 3, -11), EnumAltarComponent.CRYSTAL));
|
altarComponents.add(new AltarComponent(new BlockPos(11, 3, -11), EnumAltarComponent.CRYSTAL));
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(-11, 3, 11), EnumAltarComponent.CRYSTAL));
|
altarComponents.add(new AltarComponent(new BlockPos(-11, 3, 11), EnumAltarComponent.CRYSTAL));
|
||||||
|
|
||||||
for (int i = -9; i <= 9; i++) {
|
for (int i = -9; i <= 9; i++)
|
||||||
|
{
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(11, -5, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(11, -5, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(-11, -5, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(-11, -5, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
altarComponents.add(new AltarComponent(new BlockPos(i, -5, 11), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
altarComponents.add(new AltarComponent(new BlockPos(i, -5, 11), EnumAltarComponent.BLOODRUNE).setUpgradeSlot());
|
||||||
|
@ -126,11 +142,13 @@ public enum EnumAltarTier {
|
||||||
|
|
||||||
ArrayList<AltarComponent> altarComponents = new ArrayList<AltarComponent>();
|
ArrayList<AltarComponent> altarComponents = new ArrayList<AltarComponent>();
|
||||||
|
|
||||||
public void buildComponents() {
|
public void buildComponents()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int toInt() {
|
public int toInt()
|
||||||
|
{
|
||||||
return ordinal() + 1;
|
return ordinal() + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package WayofTime.bloodmagic.api.altar;
|
package WayofTime.bloodmagic.api.altar;
|
||||||
|
|
||||||
public interface IAltarComponent {
|
public interface IAltarComponent
|
||||||
|
{
|
||||||
|
|
||||||
EnumAltarComponent getType(int meta);
|
EnumAltarComponent getType(int meta);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package WayofTime.bloodmagic.api.altar;
|
package WayofTime.bloodmagic.api.altar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Any item that implements this interface will not be pulled into the Altar
|
* Any item that implements this interface will not be pulled into the Altar on
|
||||||
* on right click.
|
* right click.
|
||||||
*/
|
*/
|
||||||
public interface IAltarManipulator {
|
public interface IAltarManipulator
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package WayofTime.bloodmagic.api.altar;
|
package WayofTime.bloodmagic.api.altar;
|
||||||
|
|
||||||
public interface IBloodAltar {
|
public interface IBloodAltar
|
||||||
|
{
|
||||||
|
|
||||||
int getCapacity();
|
int getCapacity();
|
||||||
|
|
||||||
|
@ -31,18 +32,20 @@ public interface IBloodAltar {
|
||||||
void startCycle();
|
void startCycle();
|
||||||
|
|
||||||
void checkTier();
|
void checkTier();
|
||||||
|
|
||||||
boolean isActive();
|
boolean isActive();
|
||||||
|
|
||||||
void setActive();
|
void setActive();
|
||||||
|
|
||||||
int fillMainTank(int amount);
|
int fillMainTank(int amount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will set the altar to initiate a cooldown cycle after it crafts before starting to craft again, giving the user time to interact with the altar.
|
* Will set the altar to initiate a cooldown cycle after it crafts before
|
||||||
|
* starting to craft again, giving the user time to interact with the altar.
|
||||||
* This can only be set while the altar is not active.
|
* This can only be set while the altar is not active.
|
||||||
*
|
*
|
||||||
* @param cooldown - How long the cooldown should last
|
* @param cooldown
|
||||||
|
* - How long the cooldown should last
|
||||||
*/
|
*/
|
||||||
void requestPauseAfterCrafting(int cooldown);
|
void requestPauseAfterCrafting(int cooldown);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,16 @@ package WayofTime.bloodmagic.api.compress;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public abstract class CompressionHandler {
|
public abstract class CompressionHandler
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to look at the inventory and syphons the required stack. Returns resultant stack if successful, and null if not.
|
* Called to look at the inventory and syphons the required stack. Returns
|
||||||
* @param inv The inventory iterated through
|
* resultant stack if successful, and null if not.
|
||||||
* @return The result of the compression
|
*
|
||||||
|
* @param inv
|
||||||
|
* The inventory iterated through
|
||||||
|
* @return The result of the compression
|
||||||
*/
|
*/
|
||||||
public abstract ItemStack compressInventory(ItemStack[] inv, World world);
|
public abstract ItemStack compressInventory(ItemStack[] inv, World world);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,31 +9,40 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A registry aimed to help compress items in an inventory into its compressible form.
|
* A registry aimed to help compress items in an inventory into its compressible
|
||||||
|
* form.
|
||||||
*/
|
*/
|
||||||
public class CompressionRegistry {
|
public class CompressionRegistry
|
||||||
|
{
|
||||||
|
|
||||||
public static List<CompressionHandler> compressionRegistry = new ArrayList<CompressionHandler>();
|
public static List<CompressionHandler> compressionRegistry = new ArrayList<CompressionHandler>();
|
||||||
public static Map<ItemStack, Integer> thresholdMap = new HashMap<ItemStack, Integer>();
|
public static Map<ItemStack, Integer> thresholdMap = new HashMap<ItemStack, Integer>();
|
||||||
|
|
||||||
public static void registerHandler(CompressionHandler handler) {
|
public static void registerHandler(CompressionHandler handler)
|
||||||
|
{
|
||||||
compressionRegistry.add(handler);
|
compressionRegistry.add(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers an item so that it only compresses while above this threshold
|
* Registers an item so that it only compresses while above this threshold
|
||||||
*
|
*
|
||||||
* @param stack item/block to be compressed
|
* @param stack
|
||||||
* @param threshold amount that is to be compressed
|
* item/block to be compressed
|
||||||
|
* @param threshold
|
||||||
|
* amount that is to be compressed
|
||||||
*/
|
*/
|
||||||
public static void registerItemThreshold(ItemStack stack, int threshold) {
|
public static void registerItemThreshold(ItemStack stack, int threshold)
|
||||||
|
{
|
||||||
thresholdMap.put(stack, threshold);
|
thresholdMap.put(stack, threshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack compressInventory(ItemStack[] inv, World world) {
|
public static ItemStack compressInventory(ItemStack[] inv, World world)
|
||||||
for (CompressionHandler handler : compressionRegistry) {
|
{
|
||||||
|
for (CompressionHandler handler : compressionRegistry)
|
||||||
|
{
|
||||||
ItemStack stack = handler.compressInventory(inv, world);
|
ItemStack stack = handler.compressInventory(inv, world);
|
||||||
if (stack != null) {
|
if (stack != null)
|
||||||
|
{
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,9 +50,12 @@ public class CompressionRegistry {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getItemThreshold(ItemStack stack) {
|
public static int getItemThreshold(ItemStack stack)
|
||||||
for (Map.Entry<ItemStack, Integer> entry : thresholdMap.entrySet()) {
|
{
|
||||||
if (areItemStacksEqual(entry.getKey(), stack)) {
|
for (Map.Entry<ItemStack, Integer> entry : thresholdMap.entrySet())
|
||||||
|
{
|
||||||
|
if (areItemStacksEqual(entry.getKey(), stack))
|
||||||
|
{
|
||||||
return entry.getValue();
|
return entry.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +63,8 @@ public class CompressionRegistry {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack) {
|
public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack)
|
||||||
|
{
|
||||||
return stack.isItemEqual(compressedStack) && (stack.getTagCompound() == null ? compressedStack.getTagCompound() == null : stack.getTagCompound().equals(compressedStack.getTagCompound()));
|
return stack.isItemEqual(compressedStack) && (stack.getTagCompound() == null ? compressedStack.getTagCompound() == null : stack.getTagCompound().equals(compressedStack.getTagCompound()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,21 +2,27 @@ package WayofTime.bloodmagic.api.event;
|
||||||
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
|
|
||||||
public class AddToNetworkEvent extends Event {
|
public class AddToNetworkEvent extends Event
|
||||||
|
{
|
||||||
|
|
||||||
public String ownerNetwork;
|
public String ownerNetwork;
|
||||||
public int addedAmount;
|
public int addedAmount;
|
||||||
public int maximum;
|
public int maximum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is called whenever the network is added to. If cancelled, no LP will be drained from the source. If result is set to Result.DENY,
|
* This event is called whenever the network is added to. If cancelled, no
|
||||||
* the LP will still be drained but the soul network will not be added to.
|
* LP will be drained from the source. If result is set to Result.DENY, the
|
||||||
*
|
* LP will still be drained but the soul network will not be added to.
|
||||||
* @param ownerNetwork Key used for the soul network
|
*
|
||||||
* @param addedAmount Amount added
|
* @param ownerNetwork
|
||||||
* @param maximum Ceiling that the network can add to
|
* Key used for the soul network
|
||||||
|
* @param addedAmount
|
||||||
|
* Amount added
|
||||||
|
* @param maximum
|
||||||
|
* Ceiling that the network can add to
|
||||||
*/
|
*/
|
||||||
public AddToNetworkEvent(String ownerNetwork, int addedAmount, int maximum) {
|
public AddToNetworkEvent(String ownerNetwork, int addedAmount, int maximum)
|
||||||
|
{
|
||||||
this.ownerNetwork = ownerNetwork;
|
this.ownerNetwork = ownerNetwork;
|
||||||
this.addedAmount = addedAmount;
|
this.addedAmount = addedAmount;
|
||||||
this.maximum = maximum;
|
this.maximum = maximum;
|
||||||
|
|
|
@ -5,32 +5,38 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
|
|
||||||
public class BoundToolEvent extends Event {
|
public class BoundToolEvent extends Event
|
||||||
|
{
|
||||||
|
|
||||||
public EntityPlayer player;
|
public EntityPlayer player;
|
||||||
|
|
||||||
public BoundToolEvent(EntityPlayer player) {
|
public BoundToolEvent(EntityPlayer player)
|
||||||
|
{
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class Charge extends BoundToolEvent {
|
public static class Charge extends BoundToolEvent
|
||||||
|
{
|
||||||
|
|
||||||
public ItemStack result;
|
public ItemStack result;
|
||||||
|
|
||||||
public Charge(EntityPlayer player, ItemStack result) {
|
public Charge(EntityPlayer player, ItemStack result)
|
||||||
|
{
|
||||||
super(player);
|
super(player);
|
||||||
this.result = result;
|
this.result = result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class Release extends BoundToolEvent {
|
public static class Release extends BoundToolEvent
|
||||||
|
{
|
||||||
|
|
||||||
public final ItemStack boundTool;
|
public final ItemStack boundTool;
|
||||||
public int charge;
|
public int charge;
|
||||||
|
|
||||||
public Release(EntityPlayer player, ItemStack boundTool, int charge) {
|
public Release(EntityPlayer player, ItemStack boundTool, int charge)
|
||||||
|
{
|
||||||
super(player);
|
super(player);
|
||||||
this.boundTool = boundTool;
|
this.boundTool = boundTool;
|
||||||
this.charge = charge;
|
this.charge = charge;
|
||||||
|
|
|
@ -6,13 +6,15 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
|
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public class ItemBindEvent extends Event {
|
public class ItemBindEvent extends Event
|
||||||
|
{
|
||||||
|
|
||||||
public final EntityPlayer player;
|
public final EntityPlayer player;
|
||||||
public String key;
|
public String key;
|
||||||
public ItemStack itemStack;
|
public ItemStack itemStack;
|
||||||
|
|
||||||
public ItemBindEvent(EntityPlayer player, String key, ItemStack itemStack) {
|
public ItemBindEvent(EntityPlayer player, String key, ItemStack itemStack)
|
||||||
|
{
|
||||||
super();
|
super();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
|
|
|
@ -12,30 +12,35 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
|
|
||||||
public class RitualEvent extends Event {
|
public class RitualEvent extends Event
|
||||||
|
{
|
||||||
|
|
||||||
public final IMasterRitualStone mrs;
|
public final IMasterRitualStone mrs;
|
||||||
public final String ownerName;
|
public final String ownerName;
|
||||||
public final Ritual ritual;
|
public final Ritual ritual;
|
||||||
|
|
||||||
private RitualEvent(IMasterRitualStone mrs, String ownerName, Ritual ritual) {
|
private RitualEvent(IMasterRitualStone mrs, String ownerName, Ritual ritual)
|
||||||
|
{
|
||||||
this.mrs = mrs;
|
this.mrs = mrs;
|
||||||
this.ownerName = ownerName;
|
this.ownerName = ownerName;
|
||||||
this.ritual = ritual;
|
this.ritual = ritual;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is called when a ritual is activated. If cancelled, it will not activate.
|
* This event is called when a ritual is activated. If cancelled, it will
|
||||||
*
|
* not activate.
|
||||||
|
*
|
||||||
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#activateRitual(ItemStack, EntityPlayer, Ritual)}
|
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#activateRitual(ItemStack, EntityPlayer, Ritual)}
|
||||||
*/
|
*/
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class RitualActivatedEvent extends RitualEvent {
|
public static class RitualActivatedEvent extends RitualEvent
|
||||||
|
{
|
||||||
public final EntityPlayer player;
|
public final EntityPlayer player;
|
||||||
public final ItemStack crystalStack;
|
public final ItemStack crystalStack;
|
||||||
public int crystalTier;
|
public int crystalTier;
|
||||||
|
|
||||||
public RitualActivatedEvent(IMasterRitualStone mrs, String owner, Ritual ritual, EntityPlayer player, ItemStack activationCrystal, int crystalTier) {
|
public RitualActivatedEvent(IMasterRitualStone mrs, String owner, Ritual ritual, EntityPlayer player, ItemStack activationCrystal, int crystalTier)
|
||||||
|
{
|
||||||
super(mrs, owner, ritual);
|
super(mrs, owner, ritual);
|
||||||
|
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
@ -45,28 +50,34 @@ public class RitualEvent extends Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is called when a Ritual effect is performed. If cancelled, the effect will not happen.
|
* This event is called when a Ritual effect is performed. If cancelled, the
|
||||||
*
|
* effect will not happen.
|
||||||
|
*
|
||||||
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#performRitual(World, BlockPos)}
|
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#performRitual(World, BlockPos)}
|
||||||
*/
|
*/
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class RitualRunEvent extends RitualEvent {
|
public static class RitualRunEvent extends RitualEvent
|
||||||
|
{
|
||||||
|
|
||||||
public RitualRunEvent(IMasterRitualStone mrs, String owner, Ritual ritual) {
|
public RitualRunEvent(IMasterRitualStone mrs, String owner, Ritual ritual)
|
||||||
|
{
|
||||||
super(mrs, owner, ritual);
|
super(mrs, owner, ritual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is called when a Ritual is stopped by a {@link Ritual.BreakType}.
|
* This event is called when a Ritual is stopped by a
|
||||||
*
|
* {@link Ritual.BreakType}.
|
||||||
|
*
|
||||||
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#stopRitual(Ritual.BreakType)}
|
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#stopRitual(Ritual.BreakType)}
|
||||||
* */
|
* */
|
||||||
public static class RitualStopEvent extends RitualEvent {
|
public static class RitualStopEvent extends RitualEvent
|
||||||
|
{
|
||||||
|
|
||||||
public final Ritual.BreakType method;
|
public final Ritual.BreakType method;
|
||||||
|
|
||||||
public RitualStopEvent(IMasterRitualStone mrs, String owner, Ritual ritual, Ritual.BreakType method) {
|
public RitualStopEvent(IMasterRitualStone mrs, String owner, Ritual ritual, Ritual.BreakType method)
|
||||||
|
{
|
||||||
super(mrs, owner, ritual);
|
super(mrs, owner, ritual);
|
||||||
|
|
||||||
this.method = method;
|
this.method = method;
|
||||||
|
@ -74,13 +85,15 @@ public class RitualEvent extends Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class ImperfectRitualActivatedEvent extends Event {
|
public static class ImperfectRitualActivatedEvent extends Event
|
||||||
|
{
|
||||||
|
|
||||||
public final IImperfectRitualStone ims;
|
public final IImperfectRitualStone ims;
|
||||||
public final String ownerName;
|
public final String ownerName;
|
||||||
public final ImperfectRitual imperfectRitual;
|
public final ImperfectRitual imperfectRitual;
|
||||||
|
|
||||||
public ImperfectRitualActivatedEvent(IImperfectRitualStone ims, String ownerName, ImperfectRitual imperfectRitual) {
|
public ImperfectRitualActivatedEvent(IImperfectRitualStone ims, String ownerName, ImperfectRitual imperfectRitual)
|
||||||
|
{
|
||||||
this.ims = ims;
|
this.ims = ims;
|
||||||
this.ownerName = ownerName;
|
this.ownerName = ownerName;
|
||||||
this.imperfectRitual = imperfectRitual;
|
this.imperfectRitual = imperfectRitual;
|
||||||
|
|
|
@ -5,13 +5,15 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
|
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public class SacrificeKnifeUsedEvent extends Event {
|
public class SacrificeKnifeUsedEvent extends Event
|
||||||
|
{
|
||||||
public final EntityPlayer player;
|
public final EntityPlayer player;
|
||||||
public final int healthDrained;
|
public final int healthDrained;
|
||||||
public boolean shouldDrainHealth;
|
public boolean shouldDrainHealth;
|
||||||
public boolean shouldFillAltar;
|
public boolean shouldFillAltar;
|
||||||
|
|
||||||
public SacrificeKnifeUsedEvent(EntityPlayer player, boolean shouldDrainHealth, boolean shouldFillAltar, int hp) {
|
public SacrificeKnifeUsedEvent(EntityPlayer player, boolean shouldDrainHealth, boolean shouldFillAltar, int hp)
|
||||||
|
{
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.shouldDrainHealth = shouldDrainHealth;
|
this.shouldDrainHealth = shouldDrainHealth;
|
||||||
this.shouldFillAltar = shouldFillAltar;
|
this.shouldFillAltar = shouldFillAltar;
|
||||||
|
|
|
@ -5,34 +5,41 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
|
|
||||||
public class SoulNetworkEvent extends Event {
|
public class SoulNetworkEvent extends Event
|
||||||
|
{
|
||||||
|
|
||||||
public final String ownerName;
|
public final String ownerName;
|
||||||
public int syphon;
|
public int syphon;
|
||||||
|
|
||||||
public SoulNetworkEvent(String ownerName, int syphon) {
|
public SoulNetworkEvent(String ownerName, int syphon)
|
||||||
|
{
|
||||||
this.ownerName = ownerName;
|
this.ownerName = ownerName;
|
||||||
this.syphon = syphon;
|
this.syphon = syphon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class ItemDrainInContainerEvent extends SoulNetworkEvent {
|
public static class ItemDrainInContainerEvent extends SoulNetworkEvent
|
||||||
|
{
|
||||||
|
|
||||||
public ItemStack stack;
|
public ItemStack stack;
|
||||||
|
|
||||||
public ItemDrainInContainerEvent(ItemStack stack, String ownerName, int syphon) {
|
public ItemDrainInContainerEvent(ItemStack stack, String ownerName, int syphon)
|
||||||
|
{
|
||||||
super(ownerName, syphon);
|
super(ownerName, syphon);
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class PlayerDrainNetworkEvent extends SoulNetworkEvent {
|
public static class PlayerDrainNetworkEvent extends SoulNetworkEvent
|
||||||
|
{
|
||||||
|
|
||||||
public final EntityPlayer player;
|
public final EntityPlayer player;
|
||||||
public boolean shouldDamage; //If true, will damage regardless of if the network had enough inside it
|
public boolean shouldDamage; // If true, will damage regardless of if
|
||||||
|
// the network had enough inside it
|
||||||
|
|
||||||
public PlayerDrainNetworkEvent(EntityPlayer player, String ownerNetwork, int drainAmount) {
|
public PlayerDrainNetworkEvent(EntityPlayer player, String ownerNetwork, int drainAmount)
|
||||||
|
{
|
||||||
super(ownerNetwork, drainAmount);
|
super(ownerNetwork, drainAmount);
|
||||||
this.shouldDamage = false;
|
this.shouldDamage = false;
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
@ -40,20 +47,28 @@ public class SoulNetworkEvent extends Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class ItemDrainNetworkEvent extends PlayerDrainNetworkEvent {
|
public static class ItemDrainNetworkEvent extends PlayerDrainNetworkEvent
|
||||||
|
{
|
||||||
|
|
||||||
public final ItemStack itemStack;
|
public final ItemStack itemStack;
|
||||||
public float damageAmount; //Amount of damage that would incur if the network could not drain properly
|
public float damageAmount; // Amount of damage that would incur if the
|
||||||
|
// network could not drain properly
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set result to deny the action i.e. damage/drain anyways. Cancelling event prevents action without penalties
|
* Set result to deny the action i.e. damage/drain anyways. Cancelling
|
||||||
*
|
* event prevents action without penalties
|
||||||
* @param player Player using the item
|
*
|
||||||
* @param ownerNetwork Network that the item is tied to
|
* @param player
|
||||||
* @param itemStack Item used
|
* Player using the item
|
||||||
* @param drainAmount Original drain amount - change to alter cost
|
* @param ownerNetwork
|
||||||
|
* Network that the item is tied to
|
||||||
|
* @param itemStack
|
||||||
|
* Item used
|
||||||
|
* @param drainAmount
|
||||||
|
* Original drain amount - change to alter cost
|
||||||
*/
|
*/
|
||||||
public ItemDrainNetworkEvent(EntityPlayer player, String ownerNetwork, ItemStack itemStack, int drainAmount) {
|
public ItemDrainNetworkEvent(EntityPlayer player, String ownerNetwork, ItemStack itemStack, int drainAmount)
|
||||||
|
{
|
||||||
super(player, ownerNetwork, drainAmount);
|
super(player, ownerNetwork, drainAmount);
|
||||||
this.itemStack = itemStack;
|
this.itemStack = itemStack;
|
||||||
this.damageAmount = (float) (drainAmount) / 100.0f;
|
this.damageAmount = (float) (drainAmount) / 100.0f;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package WayofTime.bloodmagic.api.iface;
|
package WayofTime.bloodmagic.api.iface;
|
||||||
|
|
||||||
public interface IAltarReader {
|
public interface IAltarReader
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,12 @@ import net.minecraft.item.ItemStack;
|
||||||
/**
|
/**
|
||||||
* Implement this interface on any Item that can be bound to a player.
|
* Implement this interface on any Item that can be bound to a player.
|
||||||
*/
|
*/
|
||||||
public interface IBindable {
|
public interface IBindable
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the player attempts to bind the item.
|
* Called when the player attempts to bind the item.
|
||||||
*
|
*
|
||||||
* If false, binding fails.
|
* If false, binding fails.
|
||||||
*/
|
*/
|
||||||
boolean onBind(EntityPlayer player, ItemStack stack);
|
boolean onBind(EntityPlayer player, ItemStack stack);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
package WayofTime.bloodmagic.api.iface;
|
package WayofTime.bloodmagic.api.iface;
|
||||||
|
|
||||||
public interface ISigil {
|
public interface ISigil
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,55 +7,68 @@ import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
public class LivingArmourHandler {
|
public class LivingArmourHandler
|
||||||
public static List<Class<? extends StatTracker>> trackers = new ArrayList();
|
{
|
||||||
public static HashMap<String, Class<? extends LivingArmourUpgrade>> upgradeMap = new HashMap();
|
public static List<Class<? extends StatTracker>> trackers = new ArrayList();
|
||||||
public static HashMap<String, Constructor<? extends LivingArmourUpgrade>> upgradeConstructorMap = new HashMap();
|
public static HashMap<String, Class<? extends LivingArmourUpgrade>> upgradeMap = new HashMap();
|
||||||
|
public static HashMap<String, Constructor<? extends LivingArmourUpgrade>> upgradeConstructorMap = new HashMap();
|
||||||
|
|
||||||
public static void registerStatTracker(Class<? extends StatTracker> tracker) {
|
public static void registerStatTracker(Class<? extends StatTracker> tracker)
|
||||||
trackers.add(tracker);
|
{
|
||||||
}
|
trackers.add(tracker);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a LivingArmourUpgrade using its unique identifier and class.
|
* Registers a LivingArmourUpgrade using its unique identifier and class.
|
||||||
* This is done to more easily load upgrades
|
* This is done to more easily load upgrades
|
||||||
*
|
*
|
||||||
* @param upgrade
|
* @param upgrade
|
||||||
*/
|
*/
|
||||||
public static void registerArmourUpgrade(LivingArmourUpgrade upgrade) {
|
public static void registerArmourUpgrade(LivingArmourUpgrade upgrade)
|
||||||
Class<? extends LivingArmourUpgrade> clazz = upgrade.getClass();
|
{
|
||||||
upgradeMap.put(upgrade.getUniqueIdentifier(), clazz);
|
Class<? extends LivingArmourUpgrade> clazz = upgrade.getClass();
|
||||||
try {
|
upgradeMap.put(upgrade.getUniqueIdentifier(), clazz);
|
||||||
Constructor<? extends LivingArmourUpgrade> ctor = clazz.getConstructor(int.class);
|
try
|
||||||
if (ctor == null) {
|
{
|
||||||
// TODO: This is bad - add something to the log
|
Constructor<? extends LivingArmourUpgrade> ctor = clazz.getConstructor(int.class);
|
||||||
} else {
|
if (ctor == null)
|
||||||
upgradeConstructorMap.put(upgrade.getUniqueIdentifier(), ctor);
|
{
|
||||||
}
|
// TODO: This is bad - add something to the log
|
||||||
} catch (Exception e) {
|
} else
|
||||||
e.printStackTrace();
|
{
|
||||||
}
|
upgradeConstructorMap.put(upgrade.getUniqueIdentifier(), ctor);
|
||||||
|
}
|
||||||
|
} catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LivingArmourUpgrade generateUpgradeFromKey(String key, int level) {
|
public static LivingArmourUpgrade generateUpgradeFromKey(String key, int level)
|
||||||
return generateUpgradeFromKey(key, level, null);
|
{
|
||||||
}
|
return generateUpgradeFromKey(key, level, null);
|
||||||
|
}
|
||||||
|
|
||||||
public static LivingArmourUpgrade generateUpgradeFromKey(String key, int level, NBTTagCompound tag) {
|
public static LivingArmourUpgrade generateUpgradeFromKey(String key, int level, NBTTagCompound tag)
|
||||||
Constructor<? extends LivingArmourUpgrade> ctor = upgradeConstructorMap.get(key);
|
{
|
||||||
if (ctor != null) {
|
Constructor<? extends LivingArmourUpgrade> ctor = upgradeConstructorMap.get(key);
|
||||||
try {
|
if (ctor != null)
|
||||||
LivingArmourUpgrade upgrade = ctor.newInstance(level);
|
{
|
||||||
if (upgrade != null && tag != null) {
|
try
|
||||||
upgrade.readFromNBT(tag);
|
{
|
||||||
}
|
LivingArmourUpgrade upgrade = ctor.newInstance(level);
|
||||||
return upgrade;
|
if (upgrade != null && tag != null)
|
||||||
} catch (Exception e) {
|
{
|
||||||
e.printStackTrace();
|
upgrade.readFromNBT(tag);
|
||||||
}
|
}
|
||||||
}
|
return upgrade;
|
||||||
|
} catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,45 +9,50 @@ import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
|
|
||||||
public abstract class LivingArmourUpgrade {
|
public abstract class LivingArmourUpgrade
|
||||||
|
{
|
||||||
|
|
||||||
protected int level = 0; // Upgrade level 0 is the first upgrade. Upgrade
|
protected int level = 0; // Upgrade level 0 is the first upgrade. Upgrade
|
||||||
// goes from 0 to getMaxTier() - 1.
|
// goes from 0 to getMaxTier() - 1.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The LivingArmourUpgrade must have a constructor that has a single integer
|
* The LivingArmourUpgrade must have a constructor that has a single integer
|
||||||
* parameter. Upgrades may have other constructors, but must have one of
|
* parameter. Upgrades may have other constructors, but must have one of
|
||||||
* these.
|
* these.
|
||||||
*
|
*
|
||||||
* @param level
|
* @param level
|
||||||
* The level of the upgrade
|
* The level of the upgrade
|
||||||
*/
|
*/
|
||||||
public LivingArmourUpgrade(int level) {
|
public LivingArmourUpgrade(int level)
|
||||||
this.level = level;
|
{
|
||||||
}
|
this.level = level;
|
||||||
|
}
|
||||||
public int getUpgradeLevel()
|
|
||||||
{
|
|
||||||
return this.level;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract String getUniqueIdentifier();
|
public int getUpgradeLevel()
|
||||||
|
{
|
||||||
|
return this.level;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public abstract String getUniqueIdentifier();
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public abstract int getMaxTier();
|
|
||||||
|
|
||||||
public abstract int getCostOfUpgrade();
|
|
||||||
|
|
||||||
public void onTick(World world, EntityPlayer player, LivingArmour livingArmour){}
|
|
||||||
|
|
||||||
public Multimap<String, AttributeModifier> getAttributeModifiers() {
|
/**
|
||||||
return HashMultimap.<String, AttributeModifier> create();
|
*
|
||||||
}
|
* @return
|
||||||
|
*/
|
||||||
public abstract void writeToNBT(NBTTagCompound tag);
|
public abstract int getMaxTier();
|
||||||
|
|
||||||
public abstract void readFromNBT(NBTTagCompound tag);
|
public abstract int getCostOfUpgrade();
|
||||||
|
|
||||||
|
public void onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Multimap<String, AttributeModifier> getAttributeModifiers()
|
||||||
|
{
|
||||||
|
return HashMultimap.<String, AttributeModifier> create();
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void writeToNBT(NBTTagCompound tag);
|
||||||
|
|
||||||
|
public abstract void readFromNBT(NBTTagCompound tag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,47 +5,51 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||||
|
|
||||||
public abstract class StatTracker {
|
public abstract class StatTracker
|
||||||
|
{
|
||||||
|
|
||||||
private boolean isDirty = false;
|
private boolean isDirty = false;
|
||||||
|
|
||||||
public abstract String getUniqueIdentifier();
|
public abstract String getUniqueIdentifier();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When called the StatTracker should reset all of its data, including
|
* When called the StatTracker should reset all of its data, including
|
||||||
* upgrades.
|
* upgrades.
|
||||||
*/
|
*/
|
||||||
public abstract void resetTracker();
|
public abstract void resetTracker();
|
||||||
|
|
||||||
public abstract void readFromNBT(NBTTagCompound tag);
|
public abstract void readFromNBT(NBTTagCompound tag);
|
||||||
|
|
||||||
public abstract void writeToNBT(NBTTagCompound tag);
|
public abstract void writeToNBT(NBTTagCompound tag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called each tick to update the tracker's information. Called in
|
* Called each tick to update the tracker's information. Called in
|
||||||
* LivingArmour
|
* LivingArmour
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* World the player is in
|
* World the player is in
|
||||||
* @param player
|
* @param player
|
||||||
* The player that has the armour equipped
|
* The player that has the armour equipped
|
||||||
* @param livingArmour
|
* @param livingArmour
|
||||||
* The equipped LivingArmour
|
* The equipped LivingArmour
|
||||||
* @return True if there is a new upgrade unlocked this tick.
|
* @return True if there is a new upgrade unlocked this tick.
|
||||||
*/
|
*/
|
||||||
public abstract boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour);
|
public abstract boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour);
|
||||||
|
|
||||||
public abstract LivingArmourUpgrade[] getUpgrades();
|
public abstract LivingArmourUpgrade[] getUpgrades();
|
||||||
|
|
||||||
public final boolean isDirty() {
|
public final boolean isDirty()
|
||||||
return isDirty;
|
{
|
||||||
}
|
return isDirty;
|
||||||
|
}
|
||||||
|
|
||||||
public final void markDirty() {
|
public final void markDirty()
|
||||||
this.isDirty = true;
|
{
|
||||||
}
|
this.isDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
public final void resetDirty() {
|
public final void resetDirty()
|
||||||
this.isDirty = false;
|
{
|
||||||
}
|
this.isDirty = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,14 +22,16 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class SoulNetwork extends WorldSavedData {
|
public class SoulNetwork extends WorldSavedData
|
||||||
|
{
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private final EntityPlayer player;
|
private final EntityPlayer player;
|
||||||
private int currentEssence;
|
private int currentEssence;
|
||||||
private int orbTier;
|
private int orbTier;
|
||||||
|
|
||||||
public SoulNetwork(String name) {
|
public SoulNetwork(String name)
|
||||||
|
{
|
||||||
super(name);
|
super(name);
|
||||||
|
|
||||||
currentEssence = 0;
|
currentEssence = 0;
|
||||||
|
@ -38,18 +40,21 @@ public class SoulNetwork extends WorldSavedData {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||||
|
{
|
||||||
currentEssence = nbttagcompound.getInteger(Constants.NBT.CURRENT_ESSENCE);
|
currentEssence = nbttagcompound.getInteger(Constants.NBT.CURRENT_ESSENCE);
|
||||||
orbTier = nbttagcompound.getInteger(Constants.NBT.ORB_TIER);
|
orbTier = nbttagcompound.getInteger(Constants.NBT.ORB_TIER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
public void writeToNBT(NBTTagCompound nbttagcompound)
|
||||||
|
{
|
||||||
nbttagcompound.setInteger(Constants.NBT.CURRENT_ESSENCE, currentEssence);
|
nbttagcompound.setInteger(Constants.NBT.CURRENT_ESSENCE, currentEssence);
|
||||||
nbttagcompound.setInteger(Constants.NBT.ORB_TIER, orbTier);
|
nbttagcompound.setInteger(Constants.NBT.ORB_TIER, orbTier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int addLifeEssence(int toAdd, int maximum) {
|
public int addLifeEssence(int toAdd, int maximum)
|
||||||
|
{
|
||||||
AddToNetworkEvent event = new AddToNetworkEvent(mapName, toAdd, maximum);
|
AddToNetworkEvent event = new AddToNetworkEvent(mapName, toAdd, maximum);
|
||||||
|
|
||||||
if (MinecraftForge.EVENT_BUS.post(event))
|
if (MinecraftForge.EVENT_BUS.post(event))
|
||||||
|
@ -61,7 +66,8 @@ public class SoulNetwork extends WorldSavedData {
|
||||||
World world = MinecraftServer.getServer().worldServers[0];
|
World world = MinecraftServer.getServer().worldServers[0];
|
||||||
SoulNetwork data = (SoulNetwork) world.loadItemData(SoulNetwork.class, event.ownerNetwork);
|
SoulNetwork data = (SoulNetwork) world.loadItemData(SoulNetwork.class, event.ownerNetwork);
|
||||||
|
|
||||||
if (data == null) {
|
if (data == null)
|
||||||
|
{
|
||||||
data = new SoulNetwork(event.ownerNetwork);
|
data = new SoulNetwork(event.ownerNetwork);
|
||||||
world.setItemData(event.ownerNetwork, data);
|
world.setItemData(event.ownerNetwork, data);
|
||||||
}
|
}
|
||||||
|
@ -83,8 +89,10 @@ public class SoulNetwork extends WorldSavedData {
|
||||||
/**
|
/**
|
||||||
* Used to syphon LP from the network
|
* Used to syphon LP from the network
|
||||||
*/
|
*/
|
||||||
public int syphon(int syphon) {
|
public int syphon(int syphon)
|
||||||
if (getCurrentEssence() >= syphon) {
|
{
|
||||||
|
if (getCurrentEssence() >= syphon)
|
||||||
|
{
|
||||||
setCurrentEssence(getCurrentEssence() - syphon);
|
setCurrentEssence(getCurrentEssence() - syphon);
|
||||||
markDirty();
|
markDirty();
|
||||||
return syphon;
|
return syphon;
|
||||||
|
@ -94,19 +102,22 @@ public class SoulNetwork extends WorldSavedData {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the player exists on the server, syphon the given amount of LP from the player's LP network and
|
* If the player exists on the server, syphon the given amount of LP from
|
||||||
* damage for any remaining LP required.
|
* the player's LP network and damage for any remaining LP required.
|
||||||
*
|
*
|
||||||
* Always returns false on the client side.
|
* Always returns false on the client side.
|
||||||
*
|
*
|
||||||
* @return - Whether the action should be performed.
|
* @return - Whether the action should be performed.
|
||||||
*/
|
*/
|
||||||
public boolean syphonAndDamage(int toSyphon) {
|
public boolean syphonAndDamage(int toSyphon)
|
||||||
if (getPlayer() != null) {
|
{
|
||||||
|
if (getPlayer() != null)
|
||||||
|
{
|
||||||
if (getPlayer().worldObj.isRemote)
|
if (getPlayer().worldObj.isRemote)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Strings.isNullOrEmpty(mapName)) {
|
if (!Strings.isNullOrEmpty(mapName))
|
||||||
|
{
|
||||||
SoulNetworkEvent.ItemDrainNetworkEvent event = new SoulNetworkEvent.ItemDrainNetworkEvent(player, mapName, getPlayer().getHeldItem(), toSyphon);
|
SoulNetworkEvent.ItemDrainNetworkEvent event = new SoulNetworkEvent.ItemDrainNetworkEvent(player, mapName, getPlayer().getHeldItem(), toSyphon);
|
||||||
|
|
||||||
if (MinecraftForge.EVENT_BUS.post(event))
|
if (MinecraftForge.EVENT_BUS.post(event))
|
||||||
|
@ -129,18 +140,25 @@ public class SoulNetwork extends WorldSavedData {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hurtPlayer(float syphon) {
|
public void hurtPlayer(float syphon)
|
||||||
if (getPlayer() != null) {
|
{
|
||||||
|
if (getPlayer() != null)
|
||||||
|
{
|
||||||
getPlayer().addPotionEffect(new PotionEffect(Potion.confusion.getId(), 20));
|
getPlayer().addPotionEffect(new PotionEffect(Potion.confusion.getId(), 20));
|
||||||
if (syphon < 100 && syphon > 0) {
|
if (syphon < 100 && syphon > 0)
|
||||||
if (!getPlayer().capabilities.isCreativeMode) {
|
{
|
||||||
|
if (!getPlayer().capabilities.isCreativeMode)
|
||||||
|
{
|
||||||
getPlayer().hurtResistantTime = 0;
|
getPlayer().hurtResistantTime = 0;
|
||||||
getPlayer().attackEntityFrom(BloodMagicAPI.getDamageSource(), 1.0F);
|
getPlayer().attackEntityFrom(BloodMagicAPI.getDamageSource(), 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (syphon >= 100) {
|
} else if (syphon >= 100)
|
||||||
if (!getPlayer().capabilities.isCreativeMode) {
|
{
|
||||||
for (int i = 0; i < ((syphon + 99) / 100); i++) {
|
if (!getPlayer().capabilities.isCreativeMode)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ((syphon + 99) / 100); i++)
|
||||||
|
{
|
||||||
getPlayer().hurtResistantTime = 0;
|
getPlayer().hurtResistantTime = 0;
|
||||||
getPlayer().attackEntityFrom(BloodMagicAPI.getDamageSource(), 1.0F);
|
getPlayer().attackEntityFrom(BloodMagicAPI.getDamageSource(), 1.0F);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,15 @@ import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base object for all Blood Orbs. Makes Orb creation quite a bit easier.
|
* Base object for all Blood Orbs. Makes Orb creation quite a bit easier.
|
||||||
*
|
*
|
||||||
* Just create a new BloodOrb instance then register it with {@link OrbRegistry#registerOrb(BloodOrb)}
|
* Just create a new BloodOrb instance then register it with
|
||||||
* This will allow the use of just one item ID for all orbs. If an addon dev needs more control over the intricacies
|
* {@link OrbRegistry#registerOrb(BloodOrb)} This will allow the use of just one
|
||||||
* of their orb (custom right clicking, renderers, etc), they can just create their own item as normal.
|
* item ID for all orbs. If an addon dev needs more control over the intricacies
|
||||||
|
* of their orb (custom right clicking, renderers, etc), they can just create
|
||||||
|
* their own item as normal.
|
||||||
*/
|
*/
|
||||||
public class BloodOrb {
|
public class BloodOrb
|
||||||
|
{
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private int tier;
|
private int tier;
|
||||||
|
@ -17,52 +20,58 @@ public class BloodOrb {
|
||||||
private String owner = "BloodMagic";
|
private String owner = "BloodMagic";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A base object for BloodOrbs. A bit cleaner than the
|
* A base object for BloodOrbs. A bit cleaner than the old way through
|
||||||
* old way through EnergyItems.
|
* EnergyItems.
|
||||||
*
|
*
|
||||||
* @param name - A name for the Orb. Gets put into an unlocalized name.
|
* @param name
|
||||||
* @param tier - The tier of the Orb.
|
* - A name for the Orb. Gets put into an unlocalized name.
|
||||||
* @param capacity - The max amount of LP the Orb can store.
|
* @param tier
|
||||||
|
* - The tier of the Orb.
|
||||||
|
* @param capacity
|
||||||
|
* - The max amount of LP the Orb can store.
|
||||||
*/
|
*/
|
||||||
public BloodOrb(String name, int tier, int capacity) {
|
public BloodOrb(String name, int tier, int capacity)
|
||||||
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
this.capacity = capacity;
|
this.capacity = capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName()
|
||||||
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTier() {
|
public int getTier()
|
||||||
|
{
|
||||||
return tier;
|
return tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCapacity() {
|
public int getCapacity()
|
||||||
|
{
|
||||||
return capacity;
|
return capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOwner() {
|
public String getOwner()
|
||||||
|
{
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For setting the MODID of the mod that creates the Orb. Not required, but preferred.
|
* For setting the MODID of the mod that creates the Orb. Not required, but
|
||||||
*
|
* preferred.
|
||||||
|
*
|
||||||
* @return - The BloodOrb object for further use.
|
* @return - The BloodOrb object for further use.
|
||||||
*/
|
*/
|
||||||
public BloodOrb setOwner(String owner) {
|
public BloodOrb setOwner(String owner)
|
||||||
|
{
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString()
|
||||||
return "BloodOrb{" +
|
{
|
||||||
"name='" + name + '\'' +
|
return "BloodOrb{" + "name='" + name + '\'' + ", tier=" + tier + ", capacity=" + capacity + ", owner=" + owner + '}';
|
||||||
", tier=" + tier +
|
|
||||||
", capacity=" + capacity +
|
|
||||||
", owner=" + owner +
|
|
||||||
'}';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package WayofTime.bloodmagic.api.orb;
|
package WayofTime.bloodmagic.api.orb;
|
||||||
|
|
||||||
public interface IBloodOrb {
|
public interface IBloodOrb
|
||||||
|
{
|
||||||
|
|
||||||
BloodOrb getOrb(int meta);
|
BloodOrb getOrb(int meta);
|
||||||
|
|
||||||
|
|
|
@ -19,227 +19,281 @@ import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||||
/**
|
/**
|
||||||
* Shaped Blood Orb Recipe Handler by joshie *
|
* Shaped Blood Orb Recipe Handler by joshie *
|
||||||
*/
|
*/
|
||||||
public class ShapedBloodOrbRecipe implements IRecipe {
|
public class ShapedBloodOrbRecipe implements IRecipe
|
||||||
private static final int MAX_CRAFT_GRID_WIDTH = 3;
|
{
|
||||||
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
|
private static final int MAX_CRAFT_GRID_WIDTH = 3;
|
||||||
|
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
|
||||||
|
|
||||||
private ItemStack output = null;
|
private ItemStack output = null;
|
||||||
private Object[] input = null;
|
private Object[] input = null;
|
||||||
public int width = 0;
|
public int width = 0;
|
||||||
public int height = 0;
|
public int height = 0;
|
||||||
private boolean mirrored = true;
|
private boolean mirrored = true;
|
||||||
|
|
||||||
public ShapedBloodOrbRecipe(Block result, Object... recipe) {
|
public ShapedBloodOrbRecipe(Block result, Object... recipe)
|
||||||
this(new ItemStack(result), recipe);
|
{
|
||||||
}
|
this(new ItemStack(result), recipe);
|
||||||
|
}
|
||||||
|
|
||||||
public ShapedBloodOrbRecipe(Item result, Object... recipe) {
|
public ShapedBloodOrbRecipe(Item result, Object... recipe)
|
||||||
this(new ItemStack(result), recipe);
|
{
|
||||||
}
|
this(new ItemStack(result), recipe);
|
||||||
|
}
|
||||||
|
|
||||||
public ShapedBloodOrbRecipe(ItemStack result, Object... recipe) {
|
public ShapedBloodOrbRecipe(ItemStack result, Object... recipe)
|
||||||
output = result.copy();
|
{
|
||||||
|
output = result.copy();
|
||||||
|
|
||||||
String shape = "";
|
String shape = "";
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
if (recipe[idx] instanceof Boolean) {
|
if (recipe[idx] instanceof Boolean)
|
||||||
mirrored = (Boolean) recipe[idx];
|
{
|
||||||
if (recipe[idx + 1] instanceof Object[]) {
|
mirrored = (Boolean) recipe[idx];
|
||||||
recipe = (Object[]) recipe[idx + 1];
|
if (recipe[idx + 1] instanceof Object[])
|
||||||
} else {
|
{
|
||||||
idx = 1;
|
recipe = (Object[]) recipe[idx + 1];
|
||||||
}
|
} else
|
||||||
}
|
{
|
||||||
|
idx = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (recipe[idx] instanceof String[]) {
|
if (recipe[idx] instanceof String[])
|
||||||
String[] parts = ((String[]) recipe[idx++]);
|
{
|
||||||
|
String[] parts = ((String[]) recipe[idx++]);
|
||||||
|
|
||||||
for (String s : parts) {
|
for (String s : parts)
|
||||||
width = s.length();
|
{
|
||||||
shape += s;
|
width = s.length();
|
||||||
}
|
shape += s;
|
||||||
|
}
|
||||||
|
|
||||||
height = parts.length;
|
height = parts.length;
|
||||||
} else {
|
} else
|
||||||
while (recipe[idx] instanceof String) {
|
{
|
||||||
String s = (String) recipe[idx++];
|
while (recipe[idx] instanceof String)
|
||||||
shape += s;
|
{
|
||||||
width = s.length();
|
String s = (String) recipe[idx++];
|
||||||
height++;
|
shape += s;
|
||||||
}
|
width = s.length();
|
||||||
}
|
height++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (width * height != shape.length()) {
|
if (width * height != shape.length())
|
||||||
String ret = "Invalid shaped ore recipe: ";
|
{
|
||||||
for (Object tmp : recipe) {
|
String ret = "Invalid shaped ore recipe: ";
|
||||||
ret += tmp + ", ";
|
for (Object tmp : recipe)
|
||||||
}
|
{
|
||||||
ret += output;
|
ret += tmp + ", ";
|
||||||
throw new RuntimeException(ret);
|
}
|
||||||
}
|
ret += output;
|
||||||
|
throw new RuntimeException(ret);
|
||||||
|
}
|
||||||
|
|
||||||
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
|
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
|
||||||
|
|
||||||
for (; idx < recipe.length; idx += 2) {
|
for (; idx < recipe.length; idx += 2)
|
||||||
Character chr = (Character) recipe[idx];
|
{
|
||||||
Object in = recipe[idx + 1];
|
Character chr = (Character) recipe[idx];
|
||||||
|
Object in = recipe[idx + 1];
|
||||||
|
|
||||||
if (in instanceof IBloodOrb || (in instanceof ItemStack && ((ItemStack) in).getItem() instanceof IBloodOrb)) {
|
if (in instanceof IBloodOrb || (in instanceof ItemStack && ((ItemStack) in).getItem() instanceof IBloodOrb))
|
||||||
// If the item is an instanceof IBloodOrb then save the level of the orb.
|
{
|
||||||
if (in instanceof ItemStack)
|
// If the item is an instanceof IBloodOrb then save the level of
|
||||||
itemMap.put(chr, ((IBloodOrb) ((ItemStack) in).getItem()).getOrbLevel(((ItemStack) in).getItemDamage()));
|
// the orb.
|
||||||
else
|
if (in instanceof ItemStack)
|
||||||
itemMap.put(chr, ((IBloodOrb) in).getOrbLevel(((ItemStack) in).getItemDamage()));
|
itemMap.put(chr, ((IBloodOrb) ((ItemStack) in).getItem()).getOrbLevel(((ItemStack) in).getItemDamage()));
|
||||||
} else if (in instanceof ItemStack) {
|
else
|
||||||
itemMap.put(chr, ((ItemStack) in).copy());
|
itemMap.put(chr, ((IBloodOrb) in).getOrbLevel(((ItemStack) in).getItemDamage()));
|
||||||
} else if (in instanceof Item) {
|
} else if (in instanceof ItemStack)
|
||||||
itemMap.put(chr, new ItemStack((Item) in));
|
{
|
||||||
} else if (in instanceof Block) {
|
itemMap.put(chr, ((ItemStack) in).copy());
|
||||||
itemMap.put(chr, new ItemStack((Block) in, 1, OreDictionary.WILDCARD_VALUE));
|
} else if (in instanceof Item)
|
||||||
} else if (in instanceof String) {
|
{
|
||||||
itemMap.put(chr, OreDictionary.getOres((String) in));
|
itemMap.put(chr, new ItemStack((Item) in));
|
||||||
} else {
|
} else if (in instanceof Block)
|
||||||
String ret = "Invalid shaped orb recipe: ";
|
{
|
||||||
for (Object tmp : recipe) {
|
itemMap.put(chr, new ItemStack((Block) in, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
ret += tmp + ", ";
|
} else if (in instanceof String)
|
||||||
}
|
{
|
||||||
ret += output;
|
itemMap.put(chr, OreDictionary.getOres((String) in));
|
||||||
throw new RuntimeException(ret);
|
} else
|
||||||
}
|
{
|
||||||
}
|
String ret = "Invalid shaped orb recipe: ";
|
||||||
|
for (Object tmp : recipe)
|
||||||
|
{
|
||||||
|
ret += tmp + ", ";
|
||||||
|
}
|
||||||
|
ret += output;
|
||||||
|
throw new RuntimeException(ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
input = new Object[width * height];
|
input = new Object[width * height];
|
||||||
int x = 0;
|
int x = 0;
|
||||||
for (char chr : shape.toCharArray()) {
|
for (char chr : shape.toCharArray())
|
||||||
input[x++] = itemMap.get(chr);
|
{
|
||||||
}
|
input[x++] = itemMap.get(chr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ShapedBloodOrbRecipe(ShapedRecipes recipe, Map<ItemStack, String> replacements) {
|
ShapedBloodOrbRecipe(ShapedRecipes recipe, Map<ItemStack, String> replacements)
|
||||||
output = recipe.getRecipeOutput();
|
{
|
||||||
width = recipe.recipeWidth;
|
output = recipe.getRecipeOutput();
|
||||||
height = recipe.recipeHeight;
|
width = recipe.recipeWidth;
|
||||||
|
height = recipe.recipeHeight;
|
||||||
|
|
||||||
input = new Object[recipe.recipeItems.length];
|
input = new Object[recipe.recipeItems.length];
|
||||||
|
|
||||||
for (int i = 0; i < input.length; i++) {
|
for (int i = 0; i < input.length; i++)
|
||||||
ItemStack ingred = recipe.recipeItems[i];
|
{
|
||||||
|
ItemStack ingred = recipe.recipeItems[i];
|
||||||
|
|
||||||
if (ingred == null)
|
if (ingred == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
input[i] = recipe.recipeItems[i];
|
input[i] = recipe.recipeItems[i];
|
||||||
|
|
||||||
for (Entry<ItemStack, String> replace : replacements.entrySet()) {
|
for (Entry<ItemStack, String> replace : replacements.entrySet())
|
||||||
if (OreDictionary.itemMatches(replace.getKey(), ingred, true)) {
|
{
|
||||||
input[i] = OreDictionary.getOres(replace.getValue());
|
if (OreDictionary.itemMatches(replace.getKey(), ingred, true))
|
||||||
break;
|
{
|
||||||
}
|
input[i] = OreDictionary.getOres(replace.getValue());
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getCraftingResult(InventoryCrafting var1) {
|
public ItemStack getCraftingResult(InventoryCrafting var1)
|
||||||
return output.copy();
|
{
|
||||||
}
|
return output.copy();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRecipeSize() {
|
public int getRecipeSize()
|
||||||
return input.length;
|
{
|
||||||
}
|
return input.length;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getRecipeOutput() {
|
public ItemStack getRecipeOutput()
|
||||||
return output;
|
{
|
||||||
}
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(InventoryCrafting inv, World world) {
|
public boolean matches(InventoryCrafting inv, World world)
|
||||||
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++) {
|
{
|
||||||
for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y) {
|
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++)
|
||||||
if (checkMatch(inv, x, y, false)) {
|
{
|
||||||
return true;
|
for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y)
|
||||||
}
|
{
|
||||||
|
if (checkMatch(inv, x, y, false))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (mirrored && checkMatch(inv, x, y, true)) {
|
if (mirrored && checkMatch(inv, x, y, true))
|
||||||
return true;
|
{
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror) {
|
private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror)
|
||||||
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++) {
|
{
|
||||||
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++) {
|
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++)
|
||||||
int subX = x - startX;
|
{
|
||||||
int subY = y - startY;
|
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++)
|
||||||
Object target = null;
|
{
|
||||||
|
int subX = x - startX;
|
||||||
|
int subY = y - startY;
|
||||||
|
Object target = null;
|
||||||
|
|
||||||
if (subX >= 0 && subY >= 0 && subX < width && subY < height) {
|
if (subX >= 0 && subY >= 0 && subX < width && subY < height)
|
||||||
if (mirror) {
|
{
|
||||||
target = input[width - subX - 1 + subY * width];
|
if (mirror)
|
||||||
} else {
|
{
|
||||||
target = input[subX + subY * width];
|
target = input[width - subX - 1 + subY * width];
|
||||||
}
|
} else
|
||||||
}
|
{
|
||||||
|
target = input[subX + subY * width];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ItemStack slot = inv.getStackInRowAndColumn(x, y);
|
ItemStack slot = inv.getStackInRowAndColumn(x, y);
|
||||||
// If target is integer, then we should be check the blood orb
|
// If target is integer, then we should be check the blood orb
|
||||||
// value of the item instead
|
// value of the item instead
|
||||||
if (target instanceof Integer) {
|
if (target instanceof Integer)
|
||||||
if (slot != null && slot.getItem() instanceof IBloodOrb) {
|
{
|
||||||
IBloodOrb orb = (IBloodOrb) slot.getItem();
|
if (slot != null && slot.getItem() instanceof IBloodOrb)
|
||||||
if (orb.getOrbLevel(slot.getItemDamage()) < (Integer) target) {
|
{
|
||||||
return false;
|
IBloodOrb orb = (IBloodOrb) slot.getItem();
|
||||||
}
|
if (orb.getOrbLevel(slot.getItemDamage()) < (Integer) target)
|
||||||
} else
|
{
|
||||||
return false;
|
return false;
|
||||||
} else if (target instanceof ItemStack) {
|
}
|
||||||
if (!OreDictionary.itemMatches((ItemStack) target, slot, false)) {
|
} else
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (target instanceof ItemStack)
|
||||||
} else if (target instanceof ArrayList) {
|
{
|
||||||
boolean matched = false;
|
if (!OreDictionary.itemMatches((ItemStack) target, slot, false))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (target instanceof ArrayList)
|
||||||
|
{
|
||||||
|
boolean matched = false;
|
||||||
|
|
||||||
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) target).iterator();
|
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) target).iterator();
|
||||||
while (itr.hasNext() && !matched) {
|
while (itr.hasNext() && !matched)
|
||||||
matched = OreDictionary.itemMatches(itr.next(), slot, false);
|
{
|
||||||
}
|
matched = OreDictionary.itemMatches(itr.next(), slot, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (!matched) {
|
if (!matched)
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
} else if (target == null && slot != null) {
|
}
|
||||||
return false;
|
} else if (target == null && slot != null)
|
||||||
}
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShapedBloodOrbRecipe setMirrored(boolean mirror) {
|
public ShapedBloodOrbRecipe setMirrored(boolean mirror)
|
||||||
mirrored = mirror;
|
{
|
||||||
return this;
|
mirrored = mirror;
|
||||||
}
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Object[] getInput() {
|
public Object[] getInput()
|
||||||
return this.input;
|
{
|
||||||
}
|
return this.input;
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack[] getRemainingItems(InventoryCrafting inv) {
|
public ItemStack[] getRemainingItems(InventoryCrafting inv)
|
||||||
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
|
{
|
||||||
|
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
|
||||||
|
|
||||||
for (int i = 0; i < aitemstack.length; ++i) {
|
for (int i = 0; i < aitemstack.length; ++i)
|
||||||
ItemStack itemstack = inv.getStackInSlot(i);
|
{
|
||||||
aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack);
|
ItemStack itemstack = inv.getStackInSlot(i);
|
||||||
}
|
aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack);
|
||||||
|
}
|
||||||
|
|
||||||
return aitemstack;
|
return aitemstack;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,139 +19,173 @@ import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||||
/**
|
/**
|
||||||
* Shapeless Blood Orb Recipe Handler by joshie *
|
* Shapeless Blood Orb Recipe Handler by joshie *
|
||||||
*/
|
*/
|
||||||
public class ShapelessBloodOrbRecipe implements IRecipe {
|
public class ShapelessBloodOrbRecipe implements IRecipe
|
||||||
private ItemStack output = null;
|
{
|
||||||
private ArrayList<Object> input = new ArrayList<Object>();
|
private ItemStack output = null;
|
||||||
|
private ArrayList<Object> input = new ArrayList<Object>();
|
||||||
|
|
||||||
public ShapelessBloodOrbRecipe(Block result, Object... recipe) {
|
public ShapelessBloodOrbRecipe(Block result, Object... recipe)
|
||||||
this(new ItemStack(result), recipe);
|
{
|
||||||
}
|
this(new ItemStack(result), recipe);
|
||||||
|
}
|
||||||
|
|
||||||
public ShapelessBloodOrbRecipe(Item result, Object... recipe) {
|
public ShapelessBloodOrbRecipe(Item result, Object... recipe)
|
||||||
this(new ItemStack(result), recipe);
|
{
|
||||||
}
|
this(new ItemStack(result), recipe);
|
||||||
|
}
|
||||||
|
|
||||||
public ShapelessBloodOrbRecipe(ItemStack result, Object... recipe) {
|
public ShapelessBloodOrbRecipe(ItemStack result, Object... recipe)
|
||||||
output = result.copy();
|
{
|
||||||
for (Object in : recipe) {
|
output = result.copy();
|
||||||
if (in instanceof ItemStack) {
|
for (Object in : recipe)
|
||||||
if (((ItemStack) in).getItem() instanceof IBloodOrb) {
|
{
|
||||||
input.add(((IBloodOrb) ((ItemStack) in).getItem()).getOrbLevel(((ItemStack) in).getItemDamage()));
|
if (in instanceof ItemStack)
|
||||||
} else
|
{
|
||||||
input.add(((ItemStack) in).copy());
|
if (((ItemStack) in).getItem() instanceof IBloodOrb)
|
||||||
} else if (in instanceof Item) {
|
{
|
||||||
input.add(new ItemStack((Item) in));
|
input.add(((IBloodOrb) ((ItemStack) in).getItem()).getOrbLevel(((ItemStack) in).getItemDamage()));
|
||||||
} else if (in instanceof Block) {
|
} else
|
||||||
input.add(new ItemStack((Block) in));
|
input.add(((ItemStack) in).copy());
|
||||||
} else if (in instanceof String) {
|
} else if (in instanceof Item)
|
||||||
input.add(OreDictionary.getOres((String) in));
|
{
|
||||||
} else {
|
input.add(new ItemStack((Item) in));
|
||||||
String ret = "Invalid shapeless ore recipe: ";
|
} else if (in instanceof Block)
|
||||||
for (Object tmp : recipe) {
|
{
|
||||||
ret += tmp + ", ";
|
input.add(new ItemStack((Block) in));
|
||||||
}
|
} else if (in instanceof String)
|
||||||
ret += output;
|
{
|
||||||
throw new RuntimeException(ret);
|
input.add(OreDictionary.getOres((String) in));
|
||||||
}
|
} else
|
||||||
}
|
{
|
||||||
}
|
String ret = "Invalid shapeless ore recipe: ";
|
||||||
|
for (Object tmp : recipe)
|
||||||
|
{
|
||||||
|
ret += tmp + ", ";
|
||||||
|
}
|
||||||
|
ret += output;
|
||||||
|
throw new RuntimeException(ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements) {
|
ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements)
|
||||||
output = recipe.getRecipeOutput();
|
{
|
||||||
|
output = recipe.getRecipeOutput();
|
||||||
|
|
||||||
for (ItemStack ingred : ((List<ItemStack>) recipe.recipeItems)) {
|
for (ItemStack ingred : ((List<ItemStack>) recipe.recipeItems))
|
||||||
Object finalObj = ingred;
|
{
|
||||||
for (Entry<ItemStack, String> replace : replacements.entrySet()) {
|
Object finalObj = ingred;
|
||||||
if (OreDictionary.itemMatches(replace.getKey(), ingred, false)) {
|
for (Entry<ItemStack, String> replace : replacements.entrySet())
|
||||||
finalObj = OreDictionary.getOres(replace.getValue());
|
{
|
||||||
break;
|
if (OreDictionary.itemMatches(replace.getKey(), ingred, false))
|
||||||
}
|
{
|
||||||
}
|
finalObj = OreDictionary.getOres(replace.getValue());
|
||||||
input.add(finalObj);
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
input.add(finalObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRecipeSize() {
|
public int getRecipeSize()
|
||||||
return input.size();
|
{
|
||||||
}
|
return input.size();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getRecipeOutput() {
|
public ItemStack getRecipeOutput()
|
||||||
return output;
|
{
|
||||||
}
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getCraftingResult(InventoryCrafting var1) {
|
public ItemStack getCraftingResult(InventoryCrafting var1)
|
||||||
return output.copy();
|
{
|
||||||
}
|
return output.copy();
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(InventoryCrafting var1, World world) {
|
public boolean matches(InventoryCrafting var1, World world)
|
||||||
ArrayList<Object> required = new ArrayList<Object>(input);
|
{
|
||||||
|
ArrayList<Object> required = new ArrayList<Object>(input);
|
||||||
|
|
||||||
for (int x = 0; x < var1.getSizeInventory(); x++) {
|
for (int x = 0; x < var1.getSizeInventory(); x++)
|
||||||
ItemStack slot = var1.getStackInSlot(x);
|
{
|
||||||
|
ItemStack slot = var1.getStackInSlot(x);
|
||||||
|
|
||||||
if (slot != null) {
|
if (slot != null)
|
||||||
boolean inRecipe = false;
|
{
|
||||||
Iterator<Object> req = required.iterator();
|
boolean inRecipe = false;
|
||||||
|
Iterator<Object> req = required.iterator();
|
||||||
|
|
||||||
while (req.hasNext()) {
|
while (req.hasNext())
|
||||||
boolean match = false;
|
{
|
||||||
|
boolean match = false;
|
||||||
|
|
||||||
Object next = req.next();
|
Object next = req.next();
|
||||||
|
|
||||||
// If target is integer, then we should be check the blood
|
// If target is integer, then we should be check the blood
|
||||||
// orb value of the item instead
|
// orb value of the item instead
|
||||||
if (next instanceof Integer) {
|
if (next instanceof Integer)
|
||||||
if (slot != null && slot.getItem() instanceof IBloodOrb) {
|
{
|
||||||
IBloodOrb orb = (IBloodOrb) slot.getItem();
|
if (slot != null && slot.getItem() instanceof IBloodOrb)
|
||||||
if (orb.getOrbLevel(slot.getItemDamage()) < (Integer) next) {
|
{
|
||||||
return false;
|
IBloodOrb orb = (IBloodOrb) slot.getItem();
|
||||||
}
|
if (orb.getOrbLevel(slot.getItemDamage()) < (Integer) next)
|
||||||
} else
|
{
|
||||||
return false;
|
return false;
|
||||||
match = true;
|
}
|
||||||
} else if (next instanceof ItemStack) {
|
} else
|
||||||
match = OreDictionary.itemMatches((ItemStack) next, slot, false);
|
return false;
|
||||||
} else if (next instanceof ArrayList) {
|
match = true;
|
||||||
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) next).iterator();
|
} else if (next instanceof ItemStack)
|
||||||
while (itr.hasNext() && !match) {
|
{
|
||||||
match = OreDictionary.itemMatches(itr.next(), slot, false);
|
match = OreDictionary.itemMatches((ItemStack) next, slot, false);
|
||||||
}
|
} else if (next instanceof ArrayList)
|
||||||
}
|
{
|
||||||
|
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) next).iterator();
|
||||||
|
while (itr.hasNext() && !match)
|
||||||
|
{
|
||||||
|
match = OreDictionary.itemMatches(itr.next(), slot, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (match) {
|
if (match)
|
||||||
inRecipe = true;
|
{
|
||||||
required.remove(next);
|
inRecipe = true;
|
||||||
break;
|
required.remove(next);
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!inRecipe) {
|
if (!inRecipe)
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return required.isEmpty();
|
return required.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Object> getInput() {
|
public ArrayList<Object> getInput()
|
||||||
return this.input;
|
{
|
||||||
}
|
return this.input;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack[] getRemainingItems(InventoryCrafting inv) {
|
public ItemStack[] getRemainingItems(InventoryCrafting inv)
|
||||||
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
|
{
|
||||||
|
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
|
||||||
|
|
||||||
for (int i = 0; i < aitemstack.length; ++i) {
|
for (int i = 0; i < aitemstack.length; ++i)
|
||||||
ItemStack itemstack = inv.getStackInSlot(i);
|
{
|
||||||
aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack);
|
ItemStack itemstack = inv.getStackInSlot(i);
|
||||||
}
|
aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack);
|
||||||
|
}
|
||||||
|
|
||||||
return aitemstack;
|
return aitemstack;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,177 +17,212 @@ import com.google.common.collect.HashBiMap;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class AlchemyArrayRecipeRegistry {
|
public class AlchemyArrayRecipeRegistry
|
||||||
|
{
|
||||||
|
|
||||||
public static final AlchemyCircleRenderer defaultRenderer = new AlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SightSigil.png"));
|
public static final AlchemyCircleRenderer defaultRenderer = new AlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SightSigil.png"));
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static BiMap<ItemStackWrapper, AlchemyArrayRecipe> recipes = HashBiMap.create();
|
private static BiMap<ItemStackWrapper, AlchemyArrayRecipe> recipes = HashBiMap.create();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* General case for creating an AlchemyArrayEffect for a given input.
|
* General case for creating an AlchemyArrayEffect for a given input.
|
||||||
*
|
*
|
||||||
* @param inputStack
|
* @param inputStack
|
||||||
* - Input item that is used to change the Alchemy Circle into
|
* - Input item that is used to change the Alchemy Circle into
|
||||||
* the circle that you are making
|
* the circle that you are making
|
||||||
* @param catalystStack
|
* @param catalystStack
|
||||||
* - Catalyst item that, when right-clicked onto the array, will
|
* - Catalyst item that, when right-clicked onto the array, will
|
||||||
* cause an effect
|
* cause an effect
|
||||||
* @param arrayEffect
|
* @param arrayEffect
|
||||||
* - The effect that will be activated once the array is
|
* - The effect that will be activated once the array is
|
||||||
* activated
|
* activated
|
||||||
* @param circleRenderer
|
* @param circleRenderer
|
||||||
* - Circle rendered when the array is passive - can be
|
* - Circle rendered when the array is passive - can be
|
||||||
* substituted for a special renderer
|
* substituted for a special renderer
|
||||||
*/
|
*/
|
||||||
public static void registerRecipe(ItemStack inputStack, @Nullable ItemStack catalystStack, AlchemyArrayEffect arrayEffect, AlchemyCircleRenderer circleRenderer) {
|
public static void registerRecipe(ItemStack inputStack, @Nullable ItemStack catalystStack, AlchemyArrayEffect arrayEffect, AlchemyCircleRenderer circleRenderer)
|
||||||
for (Entry<ItemStackWrapper, AlchemyArrayRecipe> entry : recipes.entrySet()) {
|
{
|
||||||
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
for (Entry<ItemStackWrapper, AlchemyArrayRecipe> entry : recipes.entrySet())
|
||||||
if (arrayRecipe.doesInputMatchRecipe(inputStack)) {
|
{
|
||||||
AlchemyArrayEffect eff = arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack);
|
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
||||||
if (eff != null) {
|
if (arrayRecipe.doesInputMatchRecipe(inputStack))
|
||||||
return; // Recipe already exists!
|
{
|
||||||
} else {
|
AlchemyArrayEffect eff = arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack);
|
||||||
arrayRecipe.catalystMap.put(ItemStackWrapper.getHolder(catalystStack), arrayEffect);
|
if (eff != null)
|
||||||
if (circleRenderer != null) {
|
{
|
||||||
arrayRecipe.circleRenderer = circleRenderer;
|
return; // Recipe already exists!
|
||||||
}
|
} else
|
||||||
return;
|
{
|
||||||
}
|
arrayRecipe.catalystMap.put(ItemStackWrapper.getHolder(catalystStack), arrayEffect);
|
||||||
}
|
if (circleRenderer != null)
|
||||||
}
|
{
|
||||||
|
arrayRecipe.circleRenderer = circleRenderer;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (circleRenderer == null) {
|
if (circleRenderer == null)
|
||||||
recipes.put(ItemStackWrapper.getHolder(inputStack), new AlchemyArrayRecipe(inputStack, catalystStack, arrayEffect, defaultRenderer));
|
{
|
||||||
} else {
|
recipes.put(ItemStackWrapper.getHolder(inputStack), new AlchemyArrayRecipe(inputStack, catalystStack, arrayEffect, defaultRenderer));
|
||||||
recipes.put(ItemStackWrapper.getHolder(inputStack), new AlchemyArrayRecipe(inputStack, catalystStack, arrayEffect, circleRenderer));
|
} else
|
||||||
}
|
{
|
||||||
|
recipes.put(ItemStackWrapper.getHolder(inputStack), new AlchemyArrayRecipe(inputStack, catalystStack, arrayEffect, circleRenderer));
|
||||||
|
}
|
||||||
|
|
||||||
recipes.put(ItemStackWrapper.getHolder(inputStack), new AlchemyArrayRecipe(inputStack, catalystStack, arrayEffect, circleRenderer));
|
recipes.put(ItemStackWrapper.getHolder(inputStack), new AlchemyArrayRecipe(inputStack, catalystStack, arrayEffect, circleRenderer));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerCraftingRecipe(ItemStack inputStack, ItemStack catalystStack, ItemStack outputStack, AlchemyCircleRenderer circleRenderer) {
|
public static void registerCraftingRecipe(ItemStack inputStack, ItemStack catalystStack, ItemStack outputStack, AlchemyCircleRenderer circleRenderer)
|
||||||
registerRecipe(inputStack, catalystStack, new AlchemyArrayEffectCrafting(outputStack), circleRenderer);
|
{
|
||||||
}
|
registerRecipe(inputStack, catalystStack, new AlchemyArrayEffectCrafting(outputStack), circleRenderer);
|
||||||
|
}
|
||||||
|
|
||||||
public static void registerCraftingRecipe(ItemStack inputStack, ItemStack catalystStack, ItemStack outputStack, ResourceLocation arrayResource) {
|
public static void registerCraftingRecipe(ItemStack inputStack, ItemStack catalystStack, ItemStack outputStack, ResourceLocation arrayResource)
|
||||||
registerRecipe(inputStack, catalystStack, new AlchemyArrayEffectCrafting(outputStack), arrayResource);
|
{
|
||||||
}
|
registerRecipe(inputStack, catalystStack, new AlchemyArrayEffectCrafting(outputStack), arrayResource);
|
||||||
|
}
|
||||||
|
|
||||||
public static void registerCraftingRecipe(ItemStack inputStack, ItemStack catalystStack, ItemStack outputStack) {
|
public static void registerCraftingRecipe(ItemStack inputStack, ItemStack catalystStack, ItemStack outputStack)
|
||||||
registerRecipe(inputStack, catalystStack, new AlchemyArrayEffectCrafting(outputStack));
|
{
|
||||||
}
|
registerRecipe(inputStack, catalystStack, new AlchemyArrayEffectCrafting(outputStack));
|
||||||
|
}
|
||||||
|
|
||||||
public static void registerRecipe(ItemStack inputStack, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, ResourceLocation arrayResource) {
|
public static void registerRecipe(ItemStack inputStack, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, ResourceLocation arrayResource)
|
||||||
AlchemyCircleRenderer circleRenderer = null;
|
{
|
||||||
if (arrayResource == null) {
|
AlchemyCircleRenderer circleRenderer = null;
|
||||||
circleRenderer = defaultRenderer;
|
if (arrayResource == null)
|
||||||
} else {
|
{
|
||||||
circleRenderer = new AlchemyCircleRenderer(arrayResource);
|
circleRenderer = defaultRenderer;
|
||||||
}
|
} else
|
||||||
|
{
|
||||||
|
circleRenderer = new AlchemyCircleRenderer(arrayResource);
|
||||||
|
}
|
||||||
|
|
||||||
registerRecipe(inputStack, catalystStack, arrayEffect, circleRenderer);
|
registerRecipe(inputStack, catalystStack, arrayEffect, circleRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerRecipe(ItemStack inputStack, ItemStack catalystStack, AlchemyArrayEffect arrayEffect) {
|
public static void registerRecipe(ItemStack inputStack, ItemStack catalystStack, AlchemyArrayEffect arrayEffect)
|
||||||
registerRecipe(inputStack, catalystStack, arrayEffect, (AlchemyCircleRenderer) null);
|
{
|
||||||
}
|
registerRecipe(inputStack, catalystStack, arrayEffect, (AlchemyCircleRenderer) null);
|
||||||
|
}
|
||||||
|
|
||||||
public static void replaceAlchemyCircle(ItemStack inputStack, AlchemyCircleRenderer circleRenderer) {
|
public static void replaceAlchemyCircle(ItemStack inputStack, AlchemyCircleRenderer circleRenderer)
|
||||||
if (circleRenderer == null) {
|
{
|
||||||
return;
|
if (circleRenderer == null)
|
||||||
}
|
{
|
||||||
for (Entry<ItemStackWrapper, AlchemyArrayRecipe> entry : recipes.entrySet()) {
|
return;
|
||||||
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
}
|
||||||
if (arrayRecipe.doesInputMatchRecipe(inputStack)) {
|
for (Entry<ItemStackWrapper, AlchemyArrayRecipe> entry : recipes.entrySet())
|
||||||
arrayRecipe.circleRenderer = circleRenderer;
|
{
|
||||||
}
|
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
||||||
}
|
if (arrayRecipe.doesInputMatchRecipe(inputStack))
|
||||||
}
|
{
|
||||||
|
arrayRecipe.circleRenderer = circleRenderer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static AlchemyArrayRecipe getRecipeForInput(ItemStack input) {
|
public static AlchemyArrayRecipe getRecipeForInput(ItemStack input)
|
||||||
return recipes.get(input);
|
{
|
||||||
}
|
return recipes.get(input);
|
||||||
|
}
|
||||||
|
|
||||||
public static AlchemyArrayEffect getAlchemyArrayEffect(ItemStack inputStack, @Nullable ItemStack catalystStack) {
|
public static AlchemyArrayEffect getAlchemyArrayEffect(ItemStack inputStack, @Nullable ItemStack catalystStack)
|
||||||
for (Entry<ItemStackWrapper, AlchemyArrayRecipe> entry : recipes.entrySet()) {
|
{
|
||||||
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
for (Entry<ItemStackWrapper, AlchemyArrayRecipe> entry : recipes.entrySet())
|
||||||
if (ItemStackWrapper.getHolder(arrayRecipe.getInputStack()).equals(ItemStackWrapper.getHolder(inputStack))) {
|
{
|
||||||
AlchemyArrayEffect effect = arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack);
|
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
||||||
|
if (ItemStackWrapper.getHolder(arrayRecipe.getInputStack()).equals(ItemStackWrapper.getHolder(inputStack)))
|
||||||
|
{
|
||||||
|
AlchemyArrayEffect effect = arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack);
|
||||||
|
|
||||||
return effect; // TODO: Decide if a copy should be returned.
|
return effect; // TODO: Decide if a copy should be returned.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AlchemyCircleRenderer getAlchemyCircleRenderer(ItemStack inputStack) {
|
public static AlchemyCircleRenderer getAlchemyCircleRenderer(ItemStack inputStack)
|
||||||
for (Entry<ItemStackWrapper, AlchemyArrayRecipe> entry : recipes.entrySet()) {
|
{
|
||||||
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
for (Entry<ItemStackWrapper, AlchemyArrayRecipe> entry : recipes.entrySet())
|
||||||
if (arrayRecipe.doesInputMatchRecipe(inputStack)) {
|
{
|
||||||
return arrayRecipe.circleRenderer;
|
AlchemyArrayRecipe arrayRecipe = entry.getValue();
|
||||||
}
|
if (arrayRecipe.doesInputMatchRecipe(inputStack))
|
||||||
}
|
{
|
||||||
|
return arrayRecipe.circleRenderer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return defaultRenderer;
|
return defaultRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ToString
|
@ToString
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public static class AlchemyArrayRecipe {
|
public static class AlchemyArrayRecipe
|
||||||
|
{
|
||||||
|
|
||||||
public AlchemyCircleRenderer circleRenderer;
|
public AlchemyCircleRenderer circleRenderer;
|
||||||
public final ItemStack inputStack;
|
public final ItemStack inputStack;
|
||||||
public final BiMap<ItemStackWrapper, AlchemyArrayEffect> catalystMap = HashBiMap.create();
|
public final BiMap<ItemStackWrapper, AlchemyArrayEffect> catalystMap = HashBiMap.create();
|
||||||
|
|
||||||
public AlchemyArrayRecipe(ItemStack inputStack, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, AlchemyCircleRenderer circleRenderer) {
|
public AlchemyArrayRecipe(ItemStack inputStack, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, AlchemyCircleRenderer circleRenderer)
|
||||||
this.inputStack = inputStack;
|
{
|
||||||
|
this.inputStack = inputStack;
|
||||||
catalystMap.put(ItemStackWrapper.getHolder(catalystStack), arrayEffect);
|
|
||||||
|
|
||||||
this.circleRenderer = circleRenderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
catalystMap.put(ItemStackWrapper.getHolder(catalystStack), arrayEffect);
|
||||||
* Compares the inputed ItemStack to see if it matches with the recipe's
|
|
||||||
* inputStack.
|
|
||||||
*
|
|
||||||
* @param comparedStack
|
|
||||||
* @return - true if the ItemStack is a compatible item
|
|
||||||
*/
|
|
||||||
public boolean doesInputMatchRecipe(ItemStack comparedStack) {
|
|
||||||
if (comparedStack == null || this.inputStack == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return this.inputStack.isItemEqual(comparedStack);
|
this.circleRenderer = circleRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the actual AlchemyArrayEffect for the given catalyst.
|
* Compares the inputed ItemStack to see if it matches with the recipe's
|
||||||
*
|
* inputStack.
|
||||||
* @param comparedStack
|
*
|
||||||
* The catalyst that is being checked
|
* @param comparedStack
|
||||||
* @return
|
* @return - true if the ItemStack is a compatible item
|
||||||
*/
|
*/
|
||||||
public AlchemyArrayEffect getAlchemyArrayEffectForCatalyst(@Nullable ItemStack comparedStack) {
|
public boolean doesInputMatchRecipe(ItemStack comparedStack)
|
||||||
for (Entry<ItemStackWrapper, AlchemyArrayEffect> entry : catalystMap.entrySet()) {
|
{
|
||||||
ItemStack catalystStack = entry.getKey().toStack();
|
if (comparedStack == null || this.inputStack == null)
|
||||||
if (comparedStack == null && catalystStack == null) {
|
return false;
|
||||||
return entry.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (comparedStack == null || catalystStack == null) {
|
return this.inputStack.isItemEqual(comparedStack);
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (catalystStack.isItemEqual(comparedStack)) {
|
/**
|
||||||
return entry.getValue();
|
* Gets the actual AlchemyArrayEffect for the given catalyst.
|
||||||
}
|
*
|
||||||
}
|
* @param comparedStack
|
||||||
|
* The catalyst that is being checked
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public AlchemyArrayEffect getAlchemyArrayEffectForCatalyst(@Nullable ItemStack comparedStack)
|
||||||
|
{
|
||||||
|
for (Entry<ItemStackWrapper, AlchemyArrayEffect> entry : catalystMap.entrySet())
|
||||||
|
{
|
||||||
|
ItemStack catalystStack = entry.getKey().toStack();
|
||||||
|
if (comparedStack == null && catalystStack == null)
|
||||||
|
{
|
||||||
|
return entry.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
if (comparedStack == null || catalystStack == null)
|
||||||
}
|
{
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (catalystStack.isItemEqual(comparedStack))
|
||||||
|
{
|
||||||
|
return entry.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,26 +11,29 @@ import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class AltarRecipeRegistry {
|
public class AltarRecipeRegistry
|
||||||
|
{
|
||||||
@Getter
|
@Getter
|
||||||
private static BiMap<ItemStack, AltarRecipe> recipes = HashBiMap.create();
|
private static BiMap<ItemStack, AltarRecipe> recipes = HashBiMap.create();
|
||||||
|
|
||||||
public static void registerRecipe(AltarRecipe recipe) {
|
public static void registerRecipe(AltarRecipe recipe)
|
||||||
|
{
|
||||||
if (!recipes.containsValue(recipe))
|
if (!recipes.containsValue(recipe))
|
||||||
recipes.put(recipe.input, recipe);
|
recipes.put(recipe.input, recipe);
|
||||||
else
|
else
|
||||||
BloodMagicAPI.getLogger().error("Error adding altar recipe for %s. Recipe already exists.", recipe.input.getDisplayName(), recipe.output == null ? "" : " -> " );
|
BloodMagicAPI.getLogger().error("Error adding altar recipe for %s. Recipe already exists.", recipe.input.getDisplayName(), recipe.output == null ? "" : " -> ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AltarRecipe getRecipeForInput(ItemStack input) {
|
public static AltarRecipe getRecipeForInput(ItemStack input)
|
||||||
|
{
|
||||||
return recipes.get(input);
|
return recipes.get(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ToString
|
@ToString
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public static class AltarRecipe {
|
public static class AltarRecipe
|
||||||
|
{
|
||||||
|
|
||||||
public final int syphon, consumeRate, drainRate;
|
public final int syphon, consumeRate, drainRate;
|
||||||
public final boolean useTag;
|
public final boolean useTag;
|
||||||
|
@ -38,18 +41,29 @@ public class AltarRecipeRegistry {
|
||||||
public final EnumAltarTier minTier;
|
public final EnumAltarTier minTier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows creation of a recipe for the {@link WayofTime.bloodmagic.block.BlockAltar} / {@link WayofTime.bloodmagic.tile.TileAltar}.
|
* Allows creation of a recipe for the
|
||||||
* The output ItemStack is allowed to be null as some recipes do not contain an output. (Blood Orbs)
|
* {@link WayofTime.bloodmagic.block.BlockAltar} /
|
||||||
*
|
* {@link WayofTime.bloodmagic.tile.TileAltar}. The output ItemStack is
|
||||||
* @param input - The input ItemStack
|
* allowed to be null as some recipes do not contain an output. (Blood
|
||||||
* @param output - The ItemStack obtained from the recipe
|
* Orbs)
|
||||||
* @param minTier - The minimum tier of Altar required
|
*
|
||||||
* @param syphon - The amount of LP to syphon from the Altar
|
* @param input
|
||||||
* @param consumeRate - The rate at which LP is consumed during crafting
|
* - The input ItemStack
|
||||||
* @param drainRate - The rate at which LP is drained during crafting
|
* @param output
|
||||||
* @param useTag -
|
* - The ItemStack obtained from the recipe
|
||||||
|
* @param minTier
|
||||||
|
* - The minimum tier of Altar required
|
||||||
|
* @param syphon
|
||||||
|
* - The amount of LP to syphon from the Altar
|
||||||
|
* @param consumeRate
|
||||||
|
* - The rate at which LP is consumed during crafting
|
||||||
|
* @param drainRate
|
||||||
|
* - The rate at which LP is drained during crafting
|
||||||
|
* @param useTag
|
||||||
|
* -
|
||||||
*/
|
*/
|
||||||
public AltarRecipe(ItemStack input, @Nullable ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean useTag) {
|
public AltarRecipe(ItemStack input, @Nullable ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean useTag)
|
||||||
|
{
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.minTier = minTier;
|
this.minTier = minTier;
|
||||||
|
@ -59,19 +73,27 @@ public class AltarRecipeRegistry {
|
||||||
this.useTag = useTag;
|
this.useTag = useTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AltarRecipe(ItemStack input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate) {
|
public AltarRecipe(ItemStack input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate)
|
||||||
|
{
|
||||||
this(input, output, minTier, syphon, consumeRate, drainRate, false);
|
this(input, output, minTier, syphon, consumeRate, drainRate, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AltarRecipe(ItemStack input, EnumAltarTier minTier, int consumeRate, int drainRate) {
|
public AltarRecipe(ItemStack input, EnumAltarTier minTier, int consumeRate, int drainRate)
|
||||||
|
{
|
||||||
this(input, null, minTier, 0, consumeRate, drainRate);
|
this(input, null, minTier, 0, consumeRate, drainRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean doesRequiredItemMatch(ItemStack comparedStack, EnumAltarTier tierCheck) {
|
public boolean doesRequiredItemMatch(ItemStack comparedStack, EnumAltarTier tierCheck)
|
||||||
|
{
|
||||||
if (comparedStack == null || this.input == null)
|
if (comparedStack == null || this.input == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return tierCheck.ordinal() >= minTier.ordinal() && this.input.isItemEqual(comparedStack);// && (this.useTag ? this.areRequiredTagsEqual(comparedStack) : true);
|
return tierCheck.ordinal() >= minTier.ordinal() && this.input.isItemEqual(comparedStack);// &&
|
||||||
|
// (this.useTag
|
||||||
|
// ?
|
||||||
|
// this.areRequiredTagsEqual(comparedStack)
|
||||||
|
// :
|
||||||
|
// true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,19 +10,24 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ImperfectRitualRegistry {
|
public class ImperfectRitualRegistry
|
||||||
|
{
|
||||||
|
|
||||||
public static final Map<ImperfectRitual, Boolean> enabledRituals = new HashMap<ImperfectRitual, Boolean>();
|
public static final Map<ImperfectRitual, Boolean> enabledRituals = new HashMap<ImperfectRitual, Boolean>();
|
||||||
private static final BiMap<String, ImperfectRitual> registry = HashBiMap.create();
|
private static final BiMap<String, ImperfectRitual> registry = HashBiMap.create();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The safe way to register a new Ritual.
|
* The safe way to register a new Ritual.
|
||||||
*
|
*
|
||||||
* @param imperfectRitual - The imperfect ritual to register.
|
* @param imperfectRitual
|
||||||
* @param id - The ID for the imperfect ritual. Cannot be duplicated.
|
* - The imperfect ritual to register.
|
||||||
|
* @param id
|
||||||
|
* - The ID for the imperfect ritual. Cannot be duplicated.
|
||||||
*/
|
*/
|
||||||
public static void registerRitual(ImperfectRitual imperfectRitual, String id) {
|
public static void registerRitual(ImperfectRitual imperfectRitual, String id)
|
||||||
if (imperfectRitual != null) {
|
{
|
||||||
|
if (imperfectRitual != null)
|
||||||
|
{
|
||||||
if (registry.containsKey(id))
|
if (registry.containsKey(id))
|
||||||
BloodMagicAPI.getLogger().error("Duplicate imperfect ritual id: %s", id);
|
BloodMagicAPI.getLogger().error("Duplicate imperfect ritual id: %s", id);
|
||||||
else
|
else
|
||||||
|
@ -30,11 +35,13 @@ public class ImperfectRitualRegistry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerRitual(ImperfectRitual imperfectRitual) {
|
public static void registerRitual(ImperfectRitual imperfectRitual)
|
||||||
|
{
|
||||||
registerRitual(imperfectRitual, imperfectRitual.getName());
|
registerRitual(imperfectRitual, imperfectRitual.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ImperfectRitual getRitualForBlock(BlockStack blockStack) {
|
public static ImperfectRitual getRitualForBlock(BlockStack blockStack)
|
||||||
|
{
|
||||||
for (ImperfectRitual imperfectRitual : getRegistry().values())
|
for (ImperfectRitual imperfectRitual : getRegistry().values())
|
||||||
if (imperfectRitual.getRequiredBlock().equals(blockStack))
|
if (imperfectRitual.getRequiredBlock().equals(blockStack))
|
||||||
return imperfectRitual;
|
return imperfectRitual;
|
||||||
|
@ -42,44 +49,55 @@ public class ImperfectRitualRegistry {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ImperfectRitual getRitualForId(String id) {
|
public static ImperfectRitual getRitualForId(String id)
|
||||||
|
{
|
||||||
return registry.get(id);
|
return registry.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getIdForRitual(ImperfectRitual imperfectRitual) {
|
public static String getIdForRitual(ImperfectRitual imperfectRitual)
|
||||||
|
{
|
||||||
return registry.inverse().get(imperfectRitual);
|
return registry.inverse().get(imperfectRitual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMapEmpty() {
|
public static boolean isMapEmpty()
|
||||||
|
{
|
||||||
return registry.isEmpty();
|
return registry.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getMapSize() {
|
public static int getMapSize()
|
||||||
|
{
|
||||||
return registry.size();
|
return registry.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean ritualEnabled(ImperfectRitual imperfectRitual) {
|
public static boolean ritualEnabled(ImperfectRitual imperfectRitual)
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
return enabledRituals.get(imperfectRitual);
|
return enabledRituals.get(imperfectRitual);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e)
|
||||||
|
{
|
||||||
BloodMagicAPI.getLogger().error("Invalid Imperfect Ritual was called");
|
BloodMagicAPI.getLogger().error("Invalid Imperfect Ritual was called");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BiMap<String, ImperfectRitual> getRegistry() {
|
public static BiMap<String, ImperfectRitual> getRegistry()
|
||||||
|
{
|
||||||
return HashBiMap.create(registry);
|
return HashBiMap.create(registry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BiMap<ImperfectRitual, Boolean> getEnabledMap() {
|
public static BiMap<ImperfectRitual, Boolean> getEnabledMap()
|
||||||
|
{
|
||||||
return HashBiMap.create(enabledRituals);
|
return HashBiMap.create(enabledRituals);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<String> getIds() {
|
public static ArrayList<String> getIds()
|
||||||
|
{
|
||||||
return new ArrayList<String>(registry.keySet());
|
return new ArrayList<String>(registry.keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<ImperfectRitual> getRituals() {
|
public static ArrayList<ImperfectRitual> getRituals()
|
||||||
|
{
|
||||||
return new ArrayList<ImperfectRitual>(registry.values());
|
return new ArrayList<ImperfectRitual>(registry.values());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,15 +14,17 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is only for those who wish to add a basic {@link BloodOrb}. If you need custom handling,
|
* This is only for those who wish to add a basic {@link BloodOrb}. If you need
|
||||||
* you will need your own item class.
|
* custom handling, you will need your own item class.
|
||||||
*/
|
*/
|
||||||
public class OrbRegistry {
|
public class OrbRegistry
|
||||||
|
{
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static List<BloodOrb> orbs = new ArrayList<BloodOrb>();
|
private static List<BloodOrb> orbs = new ArrayList<BloodOrb>();
|
||||||
|
|
||||||
public static void registerOrb(BloodOrb orb) {
|
public static void registerOrb(BloodOrb orb)
|
||||||
|
{
|
||||||
if (!orbs.contains(orb))
|
if (!orbs.contains(orb))
|
||||||
orbs.add(orb);
|
orbs.add(orb);
|
||||||
else
|
else
|
||||||
|
@ -30,30 +32,36 @@ public class OrbRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public static void registerOrbTexture(BloodOrb orb, String resourceLocation) {
|
public static void registerOrbTexture(BloodOrb orb, String resourceLocation)
|
||||||
|
{
|
||||||
int meta = getIndexOf(orb);
|
int meta = getIndexOf(orb);
|
||||||
|
|
||||||
ModelBakery.addVariantName(BloodMagicAPI.getItem(BloodMagicAPI.ORB), resourceLocation);
|
ModelBakery.addVariantName(BloodMagicAPI.getItem(BloodMagicAPI.ORB), resourceLocation);
|
||||||
ModelLoader.setCustomModelResourceLocation(BloodMagicAPI.getItem(BloodMagicAPI.ORB), meta, new ModelResourceLocation(resourceLocation, "inventory"));
|
ModelLoader.setCustomModelResourceLocation(BloodMagicAPI.getItem(BloodMagicAPI.ORB), meta, new ModelResourceLocation(resourceLocation, "inventory"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BloodOrb getOrb(int index) {
|
public static BloodOrb getOrb(int index)
|
||||||
|
{
|
||||||
return orbs.get(index);
|
return orbs.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getIndexOf(BloodOrb orb) {
|
public static int getIndexOf(BloodOrb orb)
|
||||||
|
{
|
||||||
return orbs.indexOf(orb);
|
return orbs.indexOf(orb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEmpty() {
|
public static boolean isEmpty()
|
||||||
|
{
|
||||||
return orbs.isEmpty();
|
return orbs.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSize() {
|
public static int getSize()
|
||||||
|
{
|
||||||
return orbs.size();
|
return orbs.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getOrbStack(BloodOrb orb) {
|
public static ItemStack getOrbStack(BloodOrb orb)
|
||||||
|
{
|
||||||
return new ItemStack(BloodMagicAPI.getItem(BloodMagicAPI.ORB), 1, getIndexOf(orb));
|
return new ItemStack(BloodMagicAPI.getItem(BloodMagicAPI.ORB), 1, getIndexOf(orb));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,72 +10,91 @@ import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.google.common.collect.HashBiMap;
|
import com.google.common.collect.HashBiMap;
|
||||||
|
|
||||||
public class RitualRegistry {
|
public class RitualRegistry
|
||||||
|
{
|
||||||
|
|
||||||
public static final Map<Ritual, Boolean> enabledRituals = new HashMap<Ritual, Boolean>();
|
public static final Map<Ritual, Boolean> enabledRituals = new HashMap<Ritual, Boolean>();
|
||||||
private static final BiMap<String, Ritual> registry = HashBiMap.create();
|
private static final BiMap<String, Ritual> registry = HashBiMap.create();
|
||||||
// Ordered list for actions that depend on the order that the rituals were registered in
|
// Ordered list for actions that depend on the order that the rituals were
|
||||||
private static final ArrayList<String> orderedIdList = new ArrayList<String>();
|
// registered in
|
||||||
|
private static final ArrayList<String> orderedIdList = new ArrayList<String>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The safe way to register a new Ritual.
|
* The safe way to register a new Ritual.
|
||||||
*
|
*
|
||||||
* @param ritual - The ritual to register.
|
* @param ritual
|
||||||
* @param id - The ID for the ritual. Cannot be duplicated.
|
* - The ritual to register.
|
||||||
|
* @param id
|
||||||
|
* - The ID for the ritual. Cannot be duplicated.
|
||||||
*/
|
*/
|
||||||
public static void registerRitual(Ritual ritual, String id) {
|
public static void registerRitual(Ritual ritual, String id)
|
||||||
if (ritual != null) {
|
{
|
||||||
|
if (ritual != null)
|
||||||
|
{
|
||||||
if (registry.containsKey(id))
|
if (registry.containsKey(id))
|
||||||
BloodMagicAPI.getLogger().error("Duplicate ritual id: %s", id);
|
BloodMagicAPI.getLogger().error("Duplicate ritual id: %s", id);
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
registry.put(id, ritual);
|
registry.put(id, ritual);
|
||||||
orderedIdList.add(id);
|
orderedIdList.add(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Ritual getRitualForId(String id) {
|
public static Ritual getRitualForId(String id)
|
||||||
|
{
|
||||||
return registry.get(id);
|
return registry.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getIdForRitual(Ritual ritual) {
|
public static String getIdForRitual(Ritual ritual)
|
||||||
|
{
|
||||||
return registry.inverse().get(ritual);
|
return registry.inverse().get(ritual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMapEmpty() {
|
public static boolean isMapEmpty()
|
||||||
|
{
|
||||||
return registry.isEmpty();
|
return registry.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getMapSize() {
|
public static int getMapSize()
|
||||||
|
{
|
||||||
return registry.size();
|
return registry.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean ritualEnabled(Ritual ritual) {
|
public static boolean ritualEnabled(Ritual ritual)
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
return enabledRituals.get(ritual);
|
return enabledRituals.get(ritual);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e)
|
||||||
|
{
|
||||||
BloodMagicAPI.getLogger().error("Invalid Ritual was called");
|
BloodMagicAPI.getLogger().error("Invalid Ritual was called");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BiMap<String, Ritual> getRegistry() {
|
public static BiMap<String, Ritual> getRegistry()
|
||||||
|
{
|
||||||
return HashBiMap.create(registry);
|
return HashBiMap.create(registry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<Ritual, Boolean> getEnabledMap() {
|
public static Map<Ritual, Boolean> getEnabledMap()
|
||||||
|
{
|
||||||
return new HashMap<Ritual, Boolean>(enabledRituals);
|
return new HashMap<Ritual, Boolean>(enabledRituals);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<String> getIds() {
|
public static ArrayList<String> getIds()
|
||||||
|
{
|
||||||
return new ArrayList<String>(registry.keySet());
|
return new ArrayList<String>(registry.keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<String> getOrderedIds() {
|
public static ArrayList<String> getOrderedIds()
|
||||||
return orderedIdList;
|
{
|
||||||
|
return orderedIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<Ritual> getRituals() {
|
public static ArrayList<Ritual> getRituals()
|
||||||
|
{
|
||||||
return new ArrayList<Ritual>(registry.values());
|
return new ArrayList<Ritual>(registry.values());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,16 @@ import java.util.List;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
|
|
||||||
public class AreaDescriptor {
|
public class AreaDescriptor
|
||||||
|
{
|
||||||
public List<BlockPos> getContainedPositions() {
|
|
||||||
return new ArrayList();
|
public List<BlockPos> getContainedPositions()
|
||||||
}
|
{
|
||||||
|
return new ArrayList();
|
||||||
public AxisAlignedBB getAABB() {
|
}
|
||||||
return null;
|
|
||||||
}
|
public AxisAlignedBB getAABB()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,34 +6,33 @@ import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public enum EnumRuneType implements IStringSerializable {
|
public enum EnumRuneType implements IStringSerializable
|
||||||
|
{
|
||||||
|
|
||||||
BLANK,
|
BLANK, WATER, FIRE, EARTH, AIR, DUSK, DAWN;
|
||||||
WATER,
|
|
||||||
FIRE,
|
|
||||||
EARTH,
|
|
||||||
AIR,
|
|
||||||
DUSK,
|
|
||||||
DAWN;
|
|
||||||
|
|
||||||
public static EnumRuneType byMetadata(int meta) {
|
public static EnumRuneType byMetadata(int meta)
|
||||||
|
{
|
||||||
if (meta < 0 || meta >= values().length)
|
if (meta < 0 || meta >= values().length)
|
||||||
meta = 0;
|
meta = 0;
|
||||||
|
|
||||||
return values()[meta];
|
return values()[meta];
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getScribeStack() {
|
public ItemStack getScribeStack()
|
||||||
|
{
|
||||||
return new ItemStack(BloodMagicAPI.getItem(BloodMagicAPI.SCRIBE), 1, ordinal());
|
return new ItemStack(BloodMagicAPI.getItem(BloodMagicAPI.SCRIBE), 1, ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString()
|
||||||
|
{
|
||||||
return name().toLowerCase(Locale.ENGLISH);
|
return name().toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName()
|
||||||
|
{
|
||||||
return this.toString();
|
return this.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,11 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is for internal implementation only.
|
* This interface is for internal implementation only.
|
||||||
*
|
*
|
||||||
* It is provided via the API for easy obtaining of basic data.
|
* It is provided via the API for easy obtaining of basic data.
|
||||||
*/
|
*/
|
||||||
public interface IMasterRitualStone {
|
public interface IMasterRitualStone
|
||||||
|
{
|
||||||
|
|
||||||
String getOwner();
|
String getOwner();
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,16 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is for internal implementation only.
|
* This interface is for internal implementation only.
|
||||||
*
|
*
|
||||||
* It is provided via the API for easy obtaining of basic data.
|
* 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);
|
boolean isRuneType(World world, BlockPos pos, EnumRuneType runeType);
|
||||||
|
|
||||||
interface Tile {
|
interface Tile
|
||||||
|
{
|
||||||
boolean isRuneType(EnumRuneType runeType);
|
boolean isRuneType(EnumRuneType runeType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,140 +21,152 @@ import net.minecraft.world.World;
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@EqualsAndHashCode(exclude = { "modableRangeMap" })
|
@EqualsAndHashCode(exclude = { "modableRangeMap" })
|
||||||
@ToString
|
@ToString
|
||||||
public abstract class Ritual {
|
public abstract class Ritual
|
||||||
|
{
|
||||||
|
|
||||||
public final ArrayList<RitualComponent> ritualComponents = new ArrayList<RitualComponent>();
|
public final ArrayList<RitualComponent> ritualComponents = new ArrayList<RitualComponent>();
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int crystalLevel;
|
private final int crystalLevel;
|
||||||
private final int activationCost;
|
private final int activationCost;
|
||||||
private final RitualRenderer renderer;
|
private final RitualRenderer renderer;
|
||||||
private final String unlocalizedName;
|
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
|
* @param name
|
||||||
* - The name of the ritual
|
* - The name of the ritual
|
||||||
* @param crystalLevel
|
* @param crystalLevel
|
||||||
* - Required Activation Crystal tier
|
* - Required Activation Crystal tier
|
||||||
* @param activationCost
|
* @param activationCost
|
||||||
* - Base LP cost for activating the ritual
|
* - Base LP cost for activating the ritual
|
||||||
*/
|
*/
|
||||||
public Ritual(String name, int crystalLevel, int activationCost, String unlocalizedName) {
|
public Ritual(String name, int crystalLevel, int activationCost, String unlocalizedName)
|
||||||
this(name, crystalLevel, activationCost, null, unlocalizedName);
|
{
|
||||||
}
|
this(name, crystalLevel, activationCost, null, unlocalizedName);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the player attempts to activate the ritual.
|
* Called when the player attempts to activate the ritual.
|
||||||
*
|
*
|
||||||
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#activateRitual(ItemStack, EntityPlayer, Ritual)}
|
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#activateRitual(ItemStack, EntityPlayer, Ritual)}
|
||||||
*
|
*
|
||||||
* @param masterRitualStone
|
* @param masterRitualStone
|
||||||
* - The {@link IMasterRitualStone} that the ritual is bound to
|
* - The {@link IMasterRitualStone} that the ritual is bound to
|
||||||
* @param player
|
* @param player
|
||||||
* - The activating player
|
* - The activating player
|
||||||
* @return - Whether activation was successful
|
* @return - Whether activation was successful
|
||||||
*/
|
*/
|
||||||
public boolean activateRitual(IMasterRitualStone masterRitualStone, EntityPlayer player) {
|
public boolean activateRitual(IMasterRitualStone masterRitualStone, EntityPlayer player)
|
||||||
return true;
|
{
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called every {@link #getRefreshTime()} ticks while active.
|
* Called every {@link #getRefreshTime()} ticks while active.
|
||||||
*
|
*
|
||||||
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#performRitual(World, BlockPos)}
|
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#performRitual(World, BlockPos)}
|
||||||
*
|
*
|
||||||
* @param masterRitualStone
|
* @param masterRitualStone
|
||||||
* - The {@link IMasterRitualStone} that the ritual is bound to
|
* - The {@link IMasterRitualStone} that the ritual is bound to
|
||||||
*/
|
*/
|
||||||
public abstract void performRitual(IMasterRitualStone masterRitualStone);
|
public abstract void performRitual(IMasterRitualStone masterRitualStone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the ritual is stopped for a given {@link BreakType}.
|
* Called when the ritual is stopped for a given {@link BreakType}.
|
||||||
*
|
*
|
||||||
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#stopRitual(BreakType)}
|
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#stopRitual(BreakType)}
|
||||||
*
|
*
|
||||||
* @param masterRitualStone
|
* @param masterRitualStone
|
||||||
* - The {@link IMasterRitualStone} that the ritual is bound to
|
* - The {@link IMasterRitualStone} that the ritual is bound to
|
||||||
* @param breakType
|
* @param breakType
|
||||||
* - The type of break that caused the stoppage.
|
* - The type of break that caused the stoppage.
|
||||||
*/
|
*/
|
||||||
public void stopRitual(IMasterRitualStone masterRitualStone, BreakType breakType) {
|
public void stopRitual(IMasterRitualStone masterRitualStone, BreakType breakType)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to set the amount of LP drained every {@link #getRefreshTime()}
|
* Used to set the amount of LP drained every {@link #getRefreshTime()}
|
||||||
* ticks.
|
* ticks.
|
||||||
*
|
*
|
||||||
* @return - The amount of LP drained per refresh
|
* @return - The amount of LP drained per refresh
|
||||||
*/
|
*/
|
||||||
public abstract int getRefreshCost();
|
public abstract int getRefreshCost();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to set the refresh rate of the ritual. (How often
|
* Used to set the refresh rate of the ritual. (How often
|
||||||
* {@link #performRitual(IMasterRitualStone)} is called.
|
* {@link #performRitual(IMasterRitualStone)} is called.
|
||||||
*
|
*
|
||||||
* @return - How often to perform the effect in ticks.
|
* @return - How often to perform the effect in ticks.
|
||||||
*/
|
*/
|
||||||
public int getRefreshTime() {
|
public int getRefreshTime()
|
||||||
return 20;
|
{
|
||||||
}
|
return 20;
|
||||||
|
}
|
||||||
|
|
||||||
public void addBlockRange(String range, BlockPos[] defaultRange) {
|
public void addBlockRange(String range, BlockPos[] defaultRange)
|
||||||
modableRangeMap.put(range, defaultRange);
|
{
|
||||||
}
|
modableRangeMap.put(range, defaultRange);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to grab the range of a ritual for a given effect. The order of the
|
* Used to grab the range of a ritual for a given effect. The order of the
|
||||||
* blockPos array is: bottom corner, top corner.
|
* blockPos array is: bottom corner, top corner.
|
||||||
*
|
*
|
||||||
* @param range
|
* @param range
|
||||||
* - Range that needs to be pulled.
|
* - Range that needs to be pulled.
|
||||||
* @return - The range of the ritual effect. Array must be of size 2 and
|
* @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
|
* have non-null values, with the first BlockPos having the lower
|
||||||
* offset values and the second BlockPos having the higher offset
|
* offset values and the second BlockPos having the higher offset
|
||||||
* values
|
* values
|
||||||
*/
|
*/
|
||||||
public BlockPos[] getBlockRange(String range) {
|
public BlockPos[] getBlockRange(String range)
|
||||||
if (modableRangeMap.containsKey(range)) {
|
{
|
||||||
return modableRangeMap.get(range);
|
if (modableRangeMap.containsKey(range))
|
||||||
}
|
{
|
||||||
|
return modableRangeMap.get(range);
|
||||||
return new BlockPos[] { new BlockPos(0, 0, 0), new BlockPos(0, 0, 0) };
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
return new BlockPos[] { new BlockPos(0, 0, 0), new BlockPos(0, 0, 0) };
|
||||||
* @return a list of {@link RitualComponent} for checking the ritual.
|
}
|
||||||
*/
|
|
||||||
public abstract ArrayList<RitualComponent> getComponents();
|
|
||||||
|
|
||||||
public void addOffsetRunes(ArrayList<RitualComponent> components, int offset1, int offset2, int y, EnumRuneType rune) {
|
/**
|
||||||
components.add(new RitualComponent(new BlockPos(offset1, y, offset2), rune));
|
* @return a list of {@link RitualComponent} for checking the ritual.
|
||||||
components.add(new RitualComponent(new BlockPos(offset2, y, offset1), rune));
|
*/
|
||||||
components.add(new RitualComponent(new BlockPos(offset1, y, -offset2), rune));
|
public abstract ArrayList<RitualComponent> getComponents();
|
||||||
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) {
|
public void addOffsetRunes(ArrayList<RitualComponent> components, int offset1, int offset2, 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(offset1, y, offset2), rune));
|
||||||
components.add(new RitualComponent(new BlockPos(-offset, y, -offset), rune));
|
components.add(new RitualComponent(new BlockPos(offset2, y, offset1), rune));
|
||||||
components.add(new RitualComponent(new BlockPos(-offset, y, offset), 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) {
|
public void addCornerRunes(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(offset, y, offset), rune));
|
||||||
components.add(new RitualComponent(new BlockPos(0, y, -offset), rune));
|
components.add(new RitualComponent(new BlockPos(offset, y, -offset), rune));
|
||||||
components.add(new RitualComponent(new BlockPos(0, 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 {
|
public void addParallelRunes(ArrayList<RitualComponent> components, int offset, int y, EnumRuneType rune)
|
||||||
REDSTONE, BREAK_MRS, BREAK_STONE, ACTIVATE, DEACTIVATE, EXPLOSION,
|
{
|
||||||
}
|
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,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,43 +6,49 @@ import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to set a {@link EnumRuneType} type to a given {@link BlockPos}
|
* Used to set a {@link EnumRuneType} type to a given {@link BlockPos} for usage
|
||||||
* for usage in Ritual creation.
|
* in Ritual creation.
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class RitualComponent {
|
public class RitualComponent
|
||||||
|
{
|
||||||
|
|
||||||
private final BlockPos offset;
|
private final BlockPos offset;
|
||||||
private final EnumRuneType runeType;
|
private final EnumRuneType runeType;
|
||||||
|
|
||||||
public int getX(EnumFacing direction) {
|
public int getX(EnumFacing direction)
|
||||||
switch (direction) {
|
{
|
||||||
case EAST:
|
switch (direction)
|
||||||
return -this.getOffset().getZ();
|
{
|
||||||
case SOUTH:
|
case EAST:
|
||||||
return -this.getOffset().getX();
|
return -this.getOffset().getZ();
|
||||||
case WEST:
|
case SOUTH:
|
||||||
return this.getOffset().getZ();
|
return -this.getOffset().getX();
|
||||||
default:
|
case WEST:
|
||||||
return this.getOffset().getX();
|
return this.getOffset().getZ();
|
||||||
|
default:
|
||||||
|
return this.getOffset().getX();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getZ(EnumFacing direction) {
|
public int getZ(EnumFacing direction)
|
||||||
switch (direction) {
|
{
|
||||||
case EAST:
|
switch (direction)
|
||||||
return this.getOffset().getX();
|
{
|
||||||
case SOUTH:
|
case EAST:
|
||||||
return -this.getOffset().getZ();
|
return this.getOffset().getX();
|
||||||
case WEST:
|
case SOUTH:
|
||||||
return -this.getOffset().getX();
|
return -this.getOffset().getZ();
|
||||||
default:
|
case WEST:
|
||||||
return this.getOffset().getZ();
|
return -this.getOffset().getX();
|
||||||
|
default:
|
||||||
|
return this.getOffset().getZ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockPos getOffset(EnumFacing direction) {
|
public BlockPos getOffset(EnumFacing direction)
|
||||||
return new BlockPos(getX(direction), offset.getY(), getZ(direction));
|
{
|
||||||
|
return new BlockPos(getX(direction), offset.getY(), getZ(direction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,13 @@ package WayofTime.bloodmagic.api.ritual;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.util.ResourceLocation;
|
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);
|
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);
|
Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,11 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is for internal implementation only.
|
* This interface is for internal implementation only.
|
||||||
*
|
*
|
||||||
* It is provided via the API for easy obtaining of basic data.
|
* 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);
|
boolean performRitual(World world, BlockPos pos, ImperfectRitual imperfectRitual, EntityPlayer player);
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,15 @@ import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.World;
|
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)}
|
* {@link WayofTime.bloodmagic.api.registry.ImperfectRitualRegistry#registerRitual(ImperfectRitual)}
|
||||||
*/
|
*/
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public abstract class ImperfectRitual {
|
public abstract class ImperfectRitual
|
||||||
|
{
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final BlockStack requiredBlock;
|
private final BlockStack requiredBlock;
|
||||||
|
@ -23,26 +25,34 @@ public abstract class ImperfectRitual {
|
||||||
private final boolean lightshow;
|
private final boolean lightshow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name - The name of the ritual
|
* @param name
|
||||||
* @param requiredBlock - The block required above the ImperfectRitualStone
|
* - The name of the ritual
|
||||||
* @param activationCost - Base LP cost for activating 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);
|
this(name, requiredBlock, activationCost, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the player activates the ritual
|
* Called when the player activates the ritual
|
||||||
* {@link WayofTime.bloodmagic.tile.TileImperfectRitualStone#performRitual(World, BlockPos, ImperfectRitual, EntityPlayer)}
|
* {@link WayofTime.bloodmagic.tile.TileImperfectRitualStone#performRitual(World, BlockPos, ImperfectRitual, EntityPlayer)}
|
||||||
*
|
*
|
||||||
* @param imperfectRitualStone - The {@link IImperfectRitualStone} that the ritual is bound to
|
* @param imperfectRitualStone
|
||||||
* @param player - The player activating the ritual
|
* - The {@link IImperfectRitualStone} that the ritual is bound
|
||||||
|
* to
|
||||||
|
* @param player
|
||||||
|
* - The player activating the ritual
|
||||||
* @return - Whether activation was successful
|
* @return - Whether activation was successful
|
||||||
*/
|
*/
|
||||||
public abstract boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player);
|
public abstract boolean onActivate(IImperfectRitualStone imperfectRitualStone, EntityPlayer player);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString()
|
||||||
|
{
|
||||||
return getName() + ":" + getRequiredBlock().toString() + "@" + getActivationCost();
|
return getName() + ":" + getRequiredBlock().toString() + "@" + getActivationCost();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,40 +10,50 @@ import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class BindableHelper {
|
public class BindableHelper
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind an item to a player. Handles checking if the player was an instanceof
|
* Bind an item to a player. Handles checking if the player was an
|
||||||
* {@link net.minecraftforge.common.util.FakePlayer} or other type of Fake Player.
|
* instanceof {@link net.minecraftforge.common.util.FakePlayer} or other
|
||||||
*
|
* type of Fake Player.
|
||||||
* @param stack - The ItemStack to bind
|
*
|
||||||
* @param player - The Player to bind the ItemStack to
|
* @param stack
|
||||||
*
|
* - The ItemStack to bind
|
||||||
|
* @param player
|
||||||
|
* - The Player to bind the ItemStack to
|
||||||
|
*
|
||||||
* @return - Whether binding was successful
|
* @return - Whether binding was successful
|
||||||
*/
|
*/
|
||||||
public static boolean checkAndSetItemOwner(ItemStack stack, EntityPlayer player) {
|
public static boolean checkAndSetItemOwner(ItemStack stack, EntityPlayer player)
|
||||||
|
{
|
||||||
return !PlayerHelper.isFakePlayer(player) && checkAndSetItemOwner(stack, PlayerHelper.getUUIDFromPlayer(player));
|
return !PlayerHelper.isFakePlayer(player) && checkAndSetItemOwner(stack, PlayerHelper.getUUIDFromPlayer(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind an item to a username.
|
* Bind an item to a username.
|
||||||
*
|
*
|
||||||
* Requires the Item contained in the ItemStack to be an instanceof {@link IBindable}
|
* Requires the Item contained in the ItemStack to be an instanceof
|
||||||
*
|
* {@link IBindable}
|
||||||
|
*
|
||||||
* Fires {@link ItemBindEvent}.
|
* Fires {@link ItemBindEvent}.
|
||||||
*
|
*
|
||||||
* @param stack - The ItemStack to bind
|
* @param stack
|
||||||
* @param uuid - The username to bind the ItemStack to
|
* - The ItemStack to bind
|
||||||
*
|
* @param uuid
|
||||||
|
* - The username to bind the ItemStack to
|
||||||
|
*
|
||||||
* @return - Whether the binding was successful
|
* @return - Whether the binding was successful
|
||||||
*/
|
*/
|
||||||
public static boolean checkAndSetItemOwner(ItemStack stack, String uuid) {
|
public static boolean checkAndSetItemOwner(ItemStack stack, String uuid)
|
||||||
|
{
|
||||||
stack = NBTHelper.checkNBT(stack);
|
stack = NBTHelper.checkNBT(stack);
|
||||||
|
|
||||||
if (!(stack.getItem() instanceof IBindable))
|
if (!(stack.getItem() instanceof IBindable))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Strings.isNullOrEmpty(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID))) {
|
if (Strings.isNullOrEmpty(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID)))
|
||||||
|
{
|
||||||
MinecraftForge.EVENT_BUS.post(new ItemBindEvent(PlayerHelper.getPlayerFromUUID(uuid), uuid, stack));
|
MinecraftForge.EVENT_BUS.post(new ItemBindEvent(PlayerHelper.getPlayerFromUUID(uuid), uuid, stack));
|
||||||
((IBindable) stack.getItem()).onBind(PlayerHelper.getPlayerFromUUID(uuid), stack);
|
((IBindable) stack.getItem()).onBind(PlayerHelper.getPlayerFromUUID(uuid), stack);
|
||||||
stack.getTagCompound().setString(Constants.NBT.OWNER_UUID, uuid);
|
stack.getTagCompound().setString(Constants.NBT.OWNER_UUID, uuid);
|
||||||
|
@ -56,18 +66,22 @@ public class BindableHelper {
|
||||||
/**
|
/**
|
||||||
* @see BindableHelper#checkAndSetItemOwner(ItemStack, String)
|
* @see BindableHelper#checkAndSetItemOwner(ItemStack, String)
|
||||||
*/
|
*/
|
||||||
public static boolean checkAndSetItemOwner(ItemStack stack, UUID uuid) {
|
public static boolean checkAndSetItemOwner(ItemStack stack, UUID uuid)
|
||||||
|
{
|
||||||
return checkAndSetItemOwner(stack, uuid.toString());
|
return checkAndSetItemOwner(stack, uuid.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Owner of the item without checking if it is already bound.
|
* Sets the Owner of the item without checking if it is already bound. Also
|
||||||
* Also bypasses {@link ItemBindEvent}.
|
* bypasses {@link ItemBindEvent}.
|
||||||
*
|
*
|
||||||
* @param stack - The ItemStack to bind
|
* @param stack
|
||||||
* @param ownerName - The username to bind the ItemStack to
|
* - The ItemStack to bind
|
||||||
|
* @param ownerName
|
||||||
|
* - The username to bind the ItemStack to
|
||||||
*/
|
*/
|
||||||
public static void setItemOwner(ItemStack stack, String ownerName) {
|
public static void setItemOwner(ItemStack stack, String ownerName)
|
||||||
|
{
|
||||||
stack = NBTHelper.checkNBT(stack);
|
stack = NBTHelper.checkNBT(stack);
|
||||||
|
|
||||||
stack.getTagCompound().setString(Constants.NBT.OWNER_UUID, ownerName);
|
stack.getTagCompound().setString(Constants.NBT.OWNER_UUID, ownerName);
|
||||||
|
@ -75,12 +89,14 @@ public class BindableHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to safely obtain the username of the ItemStack's owner
|
* Used to safely obtain the username of the ItemStack's owner
|
||||||
*
|
*
|
||||||
* @param stack - The ItemStack to check the owner of
|
* @param stack
|
||||||
*
|
* - The ItemStack to check the owner of
|
||||||
|
*
|
||||||
* @return - The username of the ItemStack's owner
|
* @return - The username of the ItemStack's owner
|
||||||
*/
|
*/
|
||||||
public static String getOwnerName(ItemStack stack) {
|
public static String getOwnerName(ItemStack stack)
|
||||||
|
{
|
||||||
stack = NBTHelper.checkNBT(stack);
|
stack = NBTHelper.checkNBT(stack);
|
||||||
|
|
||||||
return PlayerHelper.getUsernameFromStack(stack);
|
return PlayerHelper.getUsernameFromStack(stack);
|
||||||
|
@ -88,12 +104,14 @@ public class BindableHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to safely obtain the UUID of the ItemStack's owner
|
* Used to safely obtain the UUID of the ItemStack's owner
|
||||||
*
|
*
|
||||||
* @param stack - The ItemStack to check the owner of
|
* @param stack
|
||||||
*
|
* - The ItemStack to check the owner of
|
||||||
|
*
|
||||||
* @return - The UUID of the ItemStack's owner
|
* @return - The UUID of the ItemStack's owner
|
||||||
*/
|
*/
|
||||||
public static String getOwnerUUID(ItemStack stack) {
|
public static String getOwnerUUID(ItemStack stack)
|
||||||
|
{
|
||||||
stack = NBTHelper.checkNBT(stack);
|
stack = NBTHelper.checkNBT(stack);
|
||||||
|
|
||||||
return stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
return stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
||||||
|
|
|
@ -4,18 +4,22 @@ import WayofTime.bloodmagic.api.Constants;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
public class IncenseHelper {
|
public class IncenseHelper
|
||||||
|
{
|
||||||
|
|
||||||
public static float getCurrentIncense(EntityPlayer player) {
|
public static float getCurrentIncense(EntityPlayer player)
|
||||||
|
{
|
||||||
NBTTagCompound data = player.getEntityData();
|
NBTTagCompound data = player.getEntityData();
|
||||||
if (data.hasKey(Constants.NBT.CURRENT_INCENSE)) {
|
if (data.hasKey(Constants.NBT.CURRENT_INCENSE))
|
||||||
|
{
|
||||||
return data.getFloat(Constants.NBT.CURRENT_INCENSE);
|
return data.getFloat(Constants.NBT.CURRENT_INCENSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCurrentIncense(EntityPlayer player, float amount) {
|
public static void setCurrentIncense(EntityPlayer player, float amount)
|
||||||
|
{
|
||||||
NBTTagCompound data = player.getEntityData();
|
NBTTagCompound data = player.getEntityData();
|
||||||
data.setFloat(Constants.NBT.CURRENT_INCENSE, amount);
|
data.setFloat(Constants.NBT.CURRENT_INCENSE, amount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,34 +4,41 @@ import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
public class LogHelper {
|
public class LogHelper
|
||||||
|
{
|
||||||
|
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
public LogHelper(String logger) {
|
public LogHelper(String logger)
|
||||||
|
{
|
||||||
this.logger = LogManager.getLogger(logger);
|
this.logger = LogManager.getLogger(logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void info(String info, Object ... format) {
|
public void info(String info, Object... format)
|
||||||
|
{
|
||||||
if (BloodMagicAPI.isLoggingEnabled())
|
if (BloodMagicAPI.isLoggingEnabled())
|
||||||
logger.info(info, format);
|
logger.info(info, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void error(String error, Object ... format) {
|
public void error(String error, Object... format)
|
||||||
|
{
|
||||||
if (BloodMagicAPI.isLoggingEnabled())
|
if (BloodMagicAPI.isLoggingEnabled())
|
||||||
logger.info(error, format);
|
logger.info(error, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debug(String debug, Object ... format) {
|
public void debug(String debug, Object... format)
|
||||||
|
{
|
||||||
if (BloodMagicAPI.isLoggingEnabled())
|
if (BloodMagicAPI.isLoggingEnabled())
|
||||||
logger.info(debug, format);
|
logger.info(debug, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fatal(String fatal, Object ... format) {
|
public void fatal(String fatal, Object... format)
|
||||||
|
{
|
||||||
logger.fatal(fatal, format);
|
logger.fatal(fatal, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Logger getLogger() {
|
public Logger getLogger()
|
||||||
|
{
|
||||||
return logger;
|
return logger;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,11 @@ package WayofTime.bloodmagic.api.util.helper;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
public class NBTHelper {
|
public class NBTHelper
|
||||||
|
{
|
||||||
|
|
||||||
public static ItemStack checkNBT(ItemStack stack) {
|
public static ItemStack checkNBT(ItemStack stack)
|
||||||
|
{
|
||||||
if (stack.getTagCompound() == null)
|
if (stack.getTagCompound() == null)
|
||||||
stack.setTagCompound(new NBTTagCompound());
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
|
|
||||||
|
|
|
@ -15,22 +15,27 @@ import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class NetworkHelper {
|
public class NetworkHelper
|
||||||
|
{
|
||||||
|
|
||||||
// Get
|
// Get
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the SoulNetwork for the player.
|
* Gets the SoulNetwork for the player.
|
||||||
*
|
*
|
||||||
* @param name - The username of the SoulNetwork owner
|
* @param name
|
||||||
* @param world - The world
|
* - The username of the SoulNetwork owner
|
||||||
*
|
* @param world
|
||||||
|
* - The world
|
||||||
|
*
|
||||||
* @return - The SoulNetwork for the given name.
|
* @return - The SoulNetwork for the given name.
|
||||||
*/
|
*/
|
||||||
public static SoulNetwork getSoulNetwork(String name, World world) {
|
public static SoulNetwork getSoulNetwork(String name, World world)
|
||||||
|
{
|
||||||
SoulNetwork network = (SoulNetwork) world.getMapStorage().loadData(SoulNetwork.class, name);
|
SoulNetwork network = (SoulNetwork) world.getMapStorage().loadData(SoulNetwork.class, name);
|
||||||
|
|
||||||
if (network == null) {
|
if (network == null)
|
||||||
|
{
|
||||||
network = new SoulNetwork(name);
|
network = new SoulNetwork(name);
|
||||||
world.getMapStorage().setData(name, network);
|
world.getMapStorage().setData(name, network);
|
||||||
}
|
}
|
||||||
|
@ -41,42 +46,51 @@ public class NetworkHelper {
|
||||||
/**
|
/**
|
||||||
* @see NetworkHelper#getSoulNetwork(String, World)
|
* @see NetworkHelper#getSoulNetwork(String, World)
|
||||||
*/
|
*/
|
||||||
public static SoulNetwork getSoulNetwork(UUID uuid, World world) {
|
public static SoulNetwork getSoulNetwork(UUID uuid, World world)
|
||||||
|
{
|
||||||
return getSoulNetwork(PlayerHelper.getUsernameFromUUID(uuid), world);
|
return getSoulNetwork(PlayerHelper.getUsernameFromUUID(uuid), world);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see NetworkHelper#getSoulNetwork(String, World)
|
* @see NetworkHelper#getSoulNetwork(String, World)
|
||||||
*/
|
*/
|
||||||
public static SoulNetwork getSoulNetwork(EntityPlayer player, World world) {
|
public static SoulNetwork getSoulNetwork(EntityPlayer player, World world)
|
||||||
|
{
|
||||||
return getSoulNetwork(PlayerHelper.getUUIDFromPlayer(player), world);
|
return getSoulNetwork(PlayerHelper.getUUIDFromPlayer(player), world);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current orb tier of the SoulNetwork.
|
* Gets the current orb tier of the SoulNetwork.
|
||||||
*
|
*
|
||||||
* @param soulNetwork - SoulNetwork to get the tier of.
|
* @param soulNetwork
|
||||||
*
|
* - SoulNetwork to get the tier of.
|
||||||
|
*
|
||||||
* @return - The Orb tier of the given SoulNetwork
|
* @return - The Orb tier of the given SoulNetwork
|
||||||
*/
|
*/
|
||||||
public static int getCurrentMaxOrb(SoulNetwork soulNetwork) {
|
public static int getCurrentMaxOrb(SoulNetwork soulNetwork)
|
||||||
|
{
|
||||||
return soulNetwork.getOrbTier();
|
return soulNetwork.getOrbTier();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Syphon
|
// Syphon
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Syphons from the player and damages them if there was not enough stored LP.
|
* Syphons from the player and damages them if there was not enough stored
|
||||||
*
|
* LP.
|
||||||
|
*
|
||||||
* Handles null-checking the player for you.
|
* Handles null-checking the player for you.
|
||||||
*
|
*
|
||||||
* @param soulNetwork - SoulNetwork to syphon from
|
* @param soulNetwork
|
||||||
* @param toSyphon - Amount of LP to syphon
|
* - SoulNetwork to syphon from
|
||||||
*
|
* @param toSyphon
|
||||||
|
* - Amount of LP to syphon
|
||||||
|
*
|
||||||
* @return - Whether the action should be performed.
|
* @return - Whether the action should be performed.
|
||||||
*/
|
*/
|
||||||
public static boolean syphonAndDamage(SoulNetwork soulNetwork, int toSyphon) {
|
public static boolean syphonAndDamage(SoulNetwork soulNetwork, int toSyphon)
|
||||||
if (soulNetwork.getPlayer() == null) {
|
{
|
||||||
|
if (soulNetwork.getPlayer() == null)
|
||||||
|
{
|
||||||
soulNetwork.syphon(toSyphon);
|
soulNetwork.syphon(toSyphon);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -86,14 +100,18 @@ public class NetworkHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Syphons a player from within a container.
|
* Syphons a player from within a container.
|
||||||
*
|
*
|
||||||
* @param stack - ItemStack in the Container.
|
* @param stack
|
||||||
* @param world - The world the Container is in
|
* - ItemStack in the Container.
|
||||||
* @param toSyphon - Amount of LP to syphon
|
* @param world
|
||||||
*
|
* - The world the Container is in
|
||||||
|
* @param toSyphon
|
||||||
|
* - Amount of LP to syphon
|
||||||
|
*
|
||||||
* @return - If the syphon was successful.
|
* @return - If the syphon was successful.
|
||||||
*/
|
*/
|
||||||
public static boolean syphonFromContainer(ItemStack stack, World world, int toSyphon) {
|
public static boolean syphonFromContainer(ItemStack stack, World world, int toSyphon)
|
||||||
|
{
|
||||||
stack = NBTHelper.checkNBT(stack);
|
stack = NBTHelper.checkNBT(stack);
|
||||||
String ownerName = stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
String ownerName = stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
||||||
|
|
||||||
|
@ -110,13 +128,16 @@ public class NetworkHelper {
|
||||||
// Set
|
// Set
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the orb tier of the SoulNetwork to the given orb. Will not set
|
* Sets the orb tier of the SoulNetwork to the given orb. Will not set if
|
||||||
* if the given tier is lower than the current tier.
|
* the given tier is lower than the current tier.
|
||||||
*
|
*
|
||||||
* @param soulNetwork - SoulNetwork to set the orb tier of
|
* @param soulNetwork
|
||||||
* @param maxOrb - Tier of orb to set to
|
* - SoulNetwork to set the orb tier of
|
||||||
|
* @param maxOrb
|
||||||
|
* - Tier of orb to set to
|
||||||
*/
|
*/
|
||||||
public static void setMaxOrb(SoulNetwork soulNetwork, int maxOrb) {
|
public static void setMaxOrb(SoulNetwork soulNetwork, int maxOrb)
|
||||||
|
{
|
||||||
soulNetwork.setOrbTier(Math.max(maxOrb, soulNetwork.getOrbTier()));
|
soulNetwork.setOrbTier(Math.max(maxOrb, soulNetwork.getOrbTier()));
|
||||||
soulNetwork.markDirty();
|
soulNetwork.markDirty();
|
||||||
}
|
}
|
||||||
|
@ -124,23 +145,29 @@ public class NetworkHelper {
|
||||||
// TODO - Remove everything below. It is deprecated and should not be used.
|
// TODO - Remove everything below. It is deprecated and should not be used.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Master method used to syphon from the player's network, and will damage them accordingly if they do not have enough LP.
|
* Master method used to syphon from the player's network, and will damage
|
||||||
* Does not drain on the client side.
|
* them accordingly if they do not have enough LP. Does not drain on the
|
||||||
*
|
* client side.
|
||||||
* @param stack Owned itemStack
|
*
|
||||||
* @param player Player using the item
|
* @param stack
|
||||||
*
|
* Owned itemStack
|
||||||
* @return True if the action should be executed and false if it should not. Always returns false if client-sided.
|
* @param player
|
||||||
|
* Player using the item
|
||||||
|
*
|
||||||
|
* @return True if the action should be executed and false if it should not.
|
||||||
|
* Always returns false if client-sided.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean syphonAndDamageFromNetwork(ItemStack stack, EntityPlayer player, int syphon) {
|
public static boolean syphonAndDamageFromNetwork(ItemStack stack, EntityPlayer player, int syphon)
|
||||||
|
{
|
||||||
if (player.worldObj.isRemote)
|
if (player.worldObj.isRemote)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
stack = NBTHelper.checkNBT(stack);
|
stack = NBTHelper.checkNBT(stack);
|
||||||
String ownerName = stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
String ownerName = stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
||||||
|
|
||||||
if (!Strings.isNullOrEmpty(ownerName)) {
|
if (!Strings.isNullOrEmpty(ownerName))
|
||||||
|
{
|
||||||
SoulNetworkEvent.ItemDrainNetworkEvent event = new SoulNetworkEvent.ItemDrainNetworkEvent(player, ownerName, stack, syphon);
|
SoulNetworkEvent.ItemDrainNetworkEvent event = new SoulNetworkEvent.ItemDrainNetworkEvent(player, ownerName, stack, syphon);
|
||||||
|
|
||||||
if (MinecraftForge.EVENT_BUS.post(event))
|
if (MinecraftForge.EVENT_BUS.post(event))
|
||||||
|
@ -151,7 +178,8 @@ public class NetworkHelper {
|
||||||
if (drainAmount == 0 || event.shouldDamage)
|
if (drainAmount == 0 || event.shouldDamage)
|
||||||
hurtPlayer(player, event.syphon);
|
hurtPlayer(player, event.syphon);
|
||||||
|
|
||||||
//The event has been told to prevent the action but allow all repercussions of using the item.
|
// The event has been told to prevent the action but allow all
|
||||||
|
// repercussions of using the item.
|
||||||
return event.getResult() != Event.Result.DENY;
|
return event.getResult() != Event.Result.DENY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +191,8 @@ public class NetworkHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean syphonFromNetworkWhileInContainer(ItemStack stack, int syphon) {
|
public static boolean syphonFromNetworkWhileInContainer(ItemStack stack, int syphon)
|
||||||
|
{
|
||||||
stack = NBTHelper.checkNBT(stack);
|
stack = NBTHelper.checkNBT(stack);
|
||||||
String ownerName = stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
String ownerName = stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
||||||
|
|
||||||
|
@ -179,7 +208,8 @@ public class NetworkHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static int syphonFromNetwork(ItemStack stack, int syphon) {
|
public static int syphonFromNetwork(ItemStack stack, int syphon)
|
||||||
|
{
|
||||||
stack = NBTHelper.checkNBT(stack);
|
stack = NBTHelper.checkNBT(stack);
|
||||||
String ownerName = stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
String ownerName = stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
||||||
if (!Strings.isNullOrEmpty(ownerName))
|
if (!Strings.isNullOrEmpty(ownerName))
|
||||||
|
@ -189,19 +219,22 @@ public class NetworkHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static int syphonFromNetwork(String ownerName, int syphon) {
|
public static int syphonFromNetwork(String ownerName, int syphon)
|
||||||
|
{
|
||||||
if (MinecraftServer.getServer() == null)
|
if (MinecraftServer.getServer() == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
World world = MinecraftServer.getServer().worldServers[0];
|
World world = MinecraftServer.getServer().worldServers[0];
|
||||||
SoulNetwork network = (SoulNetwork) world.loadItemData(SoulNetwork.class, ownerName);
|
SoulNetwork network = (SoulNetwork) world.loadItemData(SoulNetwork.class, ownerName);
|
||||||
|
|
||||||
if (network == null) {
|
if (network == null)
|
||||||
|
{
|
||||||
network = new SoulNetwork(ownerName);
|
network = new SoulNetwork(ownerName);
|
||||||
world.setItemData(ownerName, network);
|
world.setItemData(ownerName, network);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (network.getCurrentEssence() >= syphon) {
|
if (network.getCurrentEssence() >= syphon)
|
||||||
|
{
|
||||||
network.setCurrentEssence(network.getCurrentEssence() - syphon);
|
network.setCurrentEssence(network.getCurrentEssence() - syphon);
|
||||||
network.markDirty();
|
network.markDirty();
|
||||||
return syphon;
|
return syphon;
|
||||||
|
@ -214,11 +247,12 @@ public class NetworkHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A method to add to an owner's network up to a maximum value.
|
* A method to add to an owner's network up to a maximum value.
|
||||||
*
|
*
|
||||||
* @return amount added to the network
|
* @return amount added to the network
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence, int maximum) {
|
public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence, int maximum)
|
||||||
|
{
|
||||||
AddToNetworkEvent event = new AddToNetworkEvent(ownerName, addedEssence, maximum);
|
AddToNetworkEvent event = new AddToNetworkEvent(ownerName, addedEssence, maximum);
|
||||||
|
|
||||||
if (MinecraftForge.EVENT_BUS.post(event))
|
if (MinecraftForge.EVENT_BUS.post(event))
|
||||||
|
@ -230,7 +264,8 @@ public class NetworkHelper {
|
||||||
World world = MinecraftServer.getServer().worldServers[0];
|
World world = MinecraftServer.getServer().worldServers[0];
|
||||||
SoulNetwork data = (SoulNetwork) world.loadItemData(SoulNetwork.class, event.ownerNetwork);
|
SoulNetwork data = (SoulNetwork) world.loadItemData(SoulNetwork.class, event.ownerNetwork);
|
||||||
|
|
||||||
if (data == null) {
|
if (data == null)
|
||||||
|
{
|
||||||
data = new SoulNetwork(event.ownerNetwork);
|
data = new SoulNetwork(event.ownerNetwork);
|
||||||
world.setItemData(event.ownerNetwork, data);
|
world.setItemData(event.ownerNetwork, data);
|
||||||
}
|
}
|
||||||
|
@ -250,14 +285,16 @@ public class NetworkHelper {
|
||||||
// Get
|
// Get
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static int getCurrentEssence(String ownerName) {
|
public static int getCurrentEssence(String ownerName)
|
||||||
|
{
|
||||||
if (MinecraftServer.getServer() == null)
|
if (MinecraftServer.getServer() == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
World world = MinecraftServer.getServer().worldServers[0];
|
World world = MinecraftServer.getServer().worldServers[0];
|
||||||
SoulNetwork network = (SoulNetwork) world.loadItemData(SoulNetwork.class, ownerName);
|
SoulNetwork network = (SoulNetwork) world.loadItemData(SoulNetwork.class, ownerName);
|
||||||
|
|
||||||
if (network == null) {
|
if (network == null)
|
||||||
|
{
|
||||||
network = new SoulNetwork(ownerName);
|
network = new SoulNetwork(ownerName);
|
||||||
world.setItemData(ownerName, network);
|
world.setItemData(ownerName, network);
|
||||||
}
|
}
|
||||||
|
@ -268,20 +305,27 @@ public class NetworkHelper {
|
||||||
// Do damage
|
// Do damage
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void hurtPlayer(EntityPlayer user, int energySyphoned) {
|
public static void hurtPlayer(EntityPlayer user, int energySyphoned)
|
||||||
if (energySyphoned < 100 && energySyphoned > 0) {
|
{
|
||||||
if (!user.capabilities.isCreativeMode) {
|
if (energySyphoned < 100 && energySyphoned > 0)
|
||||||
|
{
|
||||||
|
if (!user.capabilities.isCreativeMode)
|
||||||
|
{
|
||||||
user.setHealth((user.getHealth() - 1));
|
user.setHealth((user.getHealth() - 1));
|
||||||
|
|
||||||
if (user.getHealth() <= 0.0005f)
|
if (user.getHealth() <= 0.0005f)
|
||||||
user.onDeath(BloodMagicAPI.getDamageSource());
|
user.onDeath(BloodMagicAPI.getDamageSource());
|
||||||
}
|
}
|
||||||
} else if (energySyphoned >= 100) {
|
} else if (energySyphoned >= 100)
|
||||||
if (!user.capabilities.isCreativeMode) {
|
{
|
||||||
for (int i = 0; i < ((energySyphoned + 99) / 100); i++) {
|
if (!user.capabilities.isCreativeMode)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ((energySyphoned + 99) / 100); i++)
|
||||||
|
{
|
||||||
user.setHealth((user.getHealth() - 1));
|
user.setHealth((user.getHealth() - 1));
|
||||||
|
|
||||||
if (user.getHealth() <= 0.0005f) {
|
if (user.getHealth() <= 0.0005f)
|
||||||
|
{
|
||||||
user.onDeath(BloodMagicAPI.getDamageSource());
|
user.onDeath(BloodMagicAPI.getDamageSource());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -291,8 +335,10 @@ public class NetworkHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void hurtPlayer(EntityPlayer user, float damage) {
|
public static void hurtPlayer(EntityPlayer user, float damage)
|
||||||
if (!user.capabilities.isCreativeMode) {
|
{
|
||||||
|
if (!user.capabilities.isCreativeMode)
|
||||||
|
{
|
||||||
user.attackEntityFrom(BloodMagicAPI.getDamageSource(), 0F);
|
user.attackEntityFrom(BloodMagicAPI.getDamageSource(), 0F);
|
||||||
user.setHealth((user.getHealth() - damage));
|
user.setHealth((user.getHealth() - damage));
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,59 +13,71 @@ import net.minecraftforge.common.util.FakePlayer;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class PlayerHelper {
|
public class PlayerHelper
|
||||||
|
{
|
||||||
|
|
||||||
private static final Pattern FAKE_PLAYER_PATTERN = Pattern.compile("^(?:\\[.*\\])|(?:ComputerCraft)$");
|
private static final Pattern FAKE_PLAYER_PATTERN = Pattern.compile("^(?:\\[.*\\])|(?:ComputerCraft)$");
|
||||||
|
|
||||||
public static String getUsernameFromPlayer(EntityPlayer player) {
|
public static String getUsernameFromPlayer(EntityPlayer player)
|
||||||
|
{
|
||||||
return UsernameCache.getLastKnownUsername(getUUIDFromPlayer(player));
|
return UsernameCache.getLastKnownUsername(getUUIDFromPlayer(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityPlayer getPlayerFromUsername(String username) {
|
public static EntityPlayer getPlayerFromUsername(String username)
|
||||||
|
{
|
||||||
if (MinecraftServer.getServer() == null)
|
if (MinecraftServer.getServer() == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(username);
|
return MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityPlayer getPlayerFromUUID(String uuid) {
|
public static EntityPlayer getPlayerFromUUID(String uuid)
|
||||||
|
{
|
||||||
return getPlayerFromUsername(getUsernameFromUUID(uuid));
|
return getPlayerFromUsername(getUsernameFromUUID(uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityPlayer getPlayerFromUUID(UUID uuid) {
|
public static EntityPlayer getPlayerFromUUID(UUID uuid)
|
||||||
|
{
|
||||||
return getPlayerFromUsername(getUsernameFromUUID(uuid));
|
return getPlayerFromUsername(getUsernameFromUUID(uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UUID getUUIDFromPlayer(EntityPlayer player) {
|
public static UUID getUUIDFromPlayer(EntityPlayer player)
|
||||||
|
{
|
||||||
return player.getGameProfile().getId();
|
return player.getGameProfile().getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUsernameFromUUID(String uuid) {
|
public static String getUsernameFromUUID(String uuid)
|
||||||
|
{
|
||||||
return UsernameCache.getLastKnownUsername(UUID.fromString(uuid));
|
return UsernameCache.getLastKnownUsername(UUID.fromString(uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUsernameFromUUID(UUID uuid) {
|
public static String getUsernameFromUUID(UUID uuid)
|
||||||
|
{
|
||||||
return UsernameCache.getLastKnownUsername(uuid);
|
return UsernameCache.getLastKnownUsername(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUsernameFromStack(ItemStack stack) {
|
public static String getUsernameFromStack(ItemStack stack)
|
||||||
|
{
|
||||||
stack = NBTHelper.checkNBT(stack);
|
stack = NBTHelper.checkNBT(stack);
|
||||||
|
|
||||||
return PlayerHelper.getUsernameFromUUID(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID));
|
return PlayerHelper.getUsernameFromUUID(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isFakePlayer(EntityPlayer player) {
|
public static boolean isFakePlayer(EntityPlayer player)
|
||||||
|
{
|
||||||
return player instanceof FakePlayer || FAKE_PLAYER_PATTERN.matcher(getUsernameFromPlayer(player)).matches();
|
return player instanceof FakePlayer || FAKE_PLAYER_PATTERN.matcher(getUsernameFromPlayer(player)).matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void causeNauseaToPlayer(ItemStack stack) {
|
public static void causeNauseaToPlayer(ItemStack stack)
|
||||||
|
{
|
||||||
stack = NBTHelper.checkNBT(stack);
|
stack = NBTHelper.checkNBT(stack);
|
||||||
|
|
||||||
if (!Strings.isNullOrEmpty(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID)))
|
if (!Strings.isNullOrEmpty(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID)))
|
||||||
causeNauseaToPlayer(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID));
|
causeNauseaToPlayer(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void causeNauseaToPlayer(String ownerName) {
|
public static void causeNauseaToPlayer(String ownerName)
|
||||||
|
{
|
||||||
EntityPlayer player = getPlayerFromUsername(ownerName);
|
EntityPlayer player = getPlayerFromUsername(ownerName);
|
||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
|
|
|
@ -8,48 +8,59 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class PlayerSacrificeHelper {
|
public class PlayerSacrificeHelper
|
||||||
|
{
|
||||||
public static float scalingOfSacrifice = 0.001f;
|
public static float scalingOfSacrifice = 0.001f;
|
||||||
public static int soulFrayDuration = 400;
|
public static int soulFrayDuration = 400;
|
||||||
public static Potion soulFrayId;
|
public static Potion soulFrayId;
|
||||||
|
|
||||||
public static float getPlayerIncense(EntityPlayer player) {
|
public static float getPlayerIncense(EntityPlayer player)
|
||||||
|
{
|
||||||
return IncenseHelper.getCurrentIncense(player);
|
return IncenseHelper.getCurrentIncense(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPlayerIncense(EntityPlayer player, float amount) {
|
public static void setPlayerIncense(EntityPlayer player, float amount)
|
||||||
|
{
|
||||||
IncenseHelper.setCurrentIncense(player, amount);
|
IncenseHelper.setCurrentIncense(player, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean incrementIncense(EntityPlayer player, float min, float max, float increment) {
|
public static boolean incrementIncense(EntityPlayer player, float min, float max, float increment)
|
||||||
|
{
|
||||||
float amount = getPlayerIncense(player);
|
float amount = getPlayerIncense(player);
|
||||||
if (amount < min || amount >= max) {
|
if (amount < min || amount >= max)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
amount = amount + Math.min(increment, max - amount);
|
amount = amount + Math.min(increment, max - amount);
|
||||||
setPlayerIncense(player, amount);
|
setPlayerIncense(player, amount);
|
||||||
|
|
||||||
// System.out.println("Amount of incense: " + amount + ", Increment: " + increment);
|
// System.out.println("Amount of incense: " + amount + ", Increment: " +
|
||||||
|
// increment);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean sacrificePlayerHealth(EntityPlayer player) {
|
public static boolean sacrificePlayerHealth(EntityPlayer player)
|
||||||
if (player.isPotionActive(soulFrayId)) {
|
{
|
||||||
|
if (player.isPotionActive(soulFrayId))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
float amount = getPlayerIncense(player);
|
float amount = getPlayerIncense(player);
|
||||||
|
|
||||||
if (amount >= 0) {
|
if (amount >= 0)
|
||||||
|
{
|
||||||
float health = player.getHealth();
|
float health = player.getHealth();
|
||||||
float maxHealth = player.getMaxHealth();
|
float maxHealth = player.getMaxHealth();
|
||||||
|
|
||||||
if (health > maxHealth / 10.0) {
|
if (health > maxHealth / 10.0)
|
||||||
|
{
|
||||||
float sacrificedHealth = health - maxHealth / 10.0f;
|
float sacrificedHealth = health - maxHealth / 10.0f;
|
||||||
|
|
||||||
if (findAndFillAltar(player.getEntityWorld(), player, (int) (sacrificedHealth * 100f * getModifier(amount)))) {
|
if (findAndFillAltar(player.getEntityWorld(), player, (int) (sacrificedHealth * 100f * getModifier(amount))))
|
||||||
|
{
|
||||||
player.setHealth(maxHealth / 10.0f);
|
player.setHealth(maxHealth / 10.0f);
|
||||||
setPlayerIncense(player, 0);
|
setPlayerIncense(player, 0);
|
||||||
player.addPotionEffect(new PotionEffect(soulFrayId.id, soulFrayDuration));
|
player.addPotionEffect(new PotionEffect(soulFrayId.id, soulFrayDuration));
|
||||||
|
@ -62,17 +73,20 @@ public class PlayerSacrificeHelper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getModifier(float amount) {
|
public static float getModifier(float amount)
|
||||||
|
{
|
||||||
return 1 + amount * scalingOfSacrifice;
|
return 1 + amount * scalingOfSacrifice;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean findAndFillAltar(World world, EntityPlayer player, int amount) {
|
public static boolean findAndFillAltar(World world, EntityPlayer player, int amount)
|
||||||
|
{
|
||||||
int posX = (int) Math.round(player.posX - 0.5f);
|
int posX = (int) Math.round(player.posX - 0.5f);
|
||||||
int posY = (int) player.posY;
|
int posY = (int) player.posY;
|
||||||
int posZ = (int) Math.round(player.posZ - 0.5f);
|
int posZ = (int) Math.round(player.posZ - 0.5f);
|
||||||
IBloodAltar altarEntity = getAltar(world, new BlockPos(posX, posY, posZ));
|
IBloodAltar altarEntity = getAltar(world, new BlockPos(posX, posY, posZ));
|
||||||
|
|
||||||
if (altarEntity == null) {
|
if (altarEntity == null)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,15 +96,20 @@ public class PlayerSacrificeHelper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IBloodAltar getAltar(World world, BlockPos blockPos) {
|
public static IBloodAltar getAltar(World world, BlockPos blockPos)
|
||||||
|
{
|
||||||
TileEntity tileEntity;
|
TileEntity tileEntity;
|
||||||
|
|
||||||
for (int i = -2; i <= 2; i++) {
|
for (int i = -2; i <= 2; i++)
|
||||||
for (int j = -2; j <= 2; j++) {
|
{
|
||||||
for (int k = -2; k <= 1; k++) {
|
for (int j = -2; j <= 2; j++)
|
||||||
|
{
|
||||||
|
for (int k = -2; k <= 1; k++)
|
||||||
|
{
|
||||||
tileEntity = world.getTileEntity(new BlockPos(i + blockPos.getX(), k + blockPos.getY(), j + blockPos.getZ()));
|
tileEntity = world.getTileEntity(new BlockPos(i + blockPos.getX(), k + blockPos.getY(), j + blockPos.getZ()));
|
||||||
|
|
||||||
if (tileEntity instanceof IBloodAltar) {
|
if (tileEntity instanceof IBloodAltar)
|
||||||
|
{
|
||||||
return (IBloodAltar) tileEntity;
|
return (IBloodAltar) tileEntity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,20 +19,24 @@ import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||||
import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
|
import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
|
||||||
|
|
||||||
public class RitualHelper {
|
public class RitualHelper
|
||||||
|
{
|
||||||
|
|
||||||
public static boolean canCrystalActivate(Ritual ritual, int crystalLevel) {
|
public static boolean canCrystalActivate(Ritual ritual, int crystalLevel)
|
||||||
|
{
|
||||||
return ritual.getCrystalLevel() <= crystalLevel && RitualRegistry.ritualEnabled(ritual);
|
return ritual.getCrystalLevel() <= crystalLevel && RitualRegistry.ritualEnabled(ritual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getNextRitualKey(String currentKey) {
|
public static String getNextRitualKey(String currentKey)
|
||||||
|
{
|
||||||
int currentIndex = RitualRegistry.getIds().indexOf(currentKey);
|
int currentIndex = RitualRegistry.getIds().indexOf(currentKey);
|
||||||
int nextIndex = RitualRegistry.getRituals().listIterator(currentIndex).nextIndex();
|
int nextIndex = RitualRegistry.getRituals().listIterator(currentIndex).nextIndex();
|
||||||
|
|
||||||
return RitualRegistry.getIds().get(nextIndex);
|
return RitualRegistry.getIds().get(nextIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPrevRitualKey(String currentKey) {
|
public static String getPrevRitualKey(String currentKey)
|
||||||
|
{
|
||||||
int currentIndex = RitualRegistry.getIds().indexOf(currentKey);
|
int currentIndex = RitualRegistry.getIds().indexOf(currentKey);
|
||||||
int previousIndex = RitualRegistry.getIds().listIterator(currentIndex).previousIndex();
|
int previousIndex = RitualRegistry.getIds().listIterator(currentIndex).previousIndex();
|
||||||
|
|
||||||
|
@ -40,87 +44,106 @@ public class RitualHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the RitualRegistry to see if the configuration of the ritual stones in the world is valid
|
* Checks the RitualRegistry to see if the configuration of the ritual
|
||||||
* for the given EnumFacing.
|
* stones in the world is valid for the given EnumFacing.
|
||||||
*
|
*
|
||||||
* @return The ID of the valid ritual
|
* @return The ID of the valid ritual
|
||||||
*/
|
*/
|
||||||
public static String getValidRitual(World world, BlockPos pos) {
|
public static String getValidRitual(World world, BlockPos pos)
|
||||||
for(String key : RitualRegistry.getIds()) {
|
{
|
||||||
for(EnumFacing direction : EnumFacing.HORIZONTALS) {
|
for (String key : RitualRegistry.getIds())
|
||||||
boolean test = checkValidRitual(world, pos, key, direction);
|
{
|
||||||
if(test) {
|
for (EnumFacing direction : EnumFacing.HORIZONTALS)
|
||||||
return key;
|
{
|
||||||
}
|
boolean test = checkValidRitual(world, pos, key, direction);
|
||||||
}
|
if (test)
|
||||||
}
|
{
|
||||||
|
return key;
|
||||||
return "";
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumFacing getDirectionOfRitual(World world, BlockPos pos, String key) {
|
public static EnumFacing getDirectionOfRitual(World world, BlockPos pos, String key)
|
||||||
for(EnumFacing direction : EnumFacing.HORIZONTALS) {
|
{
|
||||||
boolean test = checkValidRitual(world, pos, key, direction);
|
for (EnumFacing direction : EnumFacing.HORIZONTALS)
|
||||||
if(test) {
|
{
|
||||||
return direction;
|
boolean test = checkValidRitual(world, pos, key, direction);
|
||||||
}
|
if (test)
|
||||||
}
|
{
|
||||||
|
return direction;
|
||||||
return null;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkValidRitual(World world, BlockPos pos, String ritualId, EnumFacing direction) {
|
public static boolean checkValidRitual(World world, BlockPos pos, String ritualId, EnumFacing direction)
|
||||||
Ritual ritual = RitualRegistry.getRitualForId(ritualId);
|
{
|
||||||
if(ritual == null) {
|
Ritual ritual = RitualRegistry.getRitualForId(ritualId);
|
||||||
return false;
|
if (ritual == null)
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<RitualComponent> components = ritual.getComponents();
|
ArrayList<RitualComponent> components = ritual.getComponents();
|
||||||
|
|
||||||
if (components == null)
|
if (components == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (RitualComponent component : components) {
|
for (RitualComponent component : components)
|
||||||
BlockPos newPos = pos.add(component.getOffset(direction));
|
{
|
||||||
|
BlockPos newPos = pos.add(component.getOffset(direction));
|
||||||
IBlockState worldState = world.getBlockState(newPos);
|
IBlockState worldState = world.getBlockState(newPos);
|
||||||
Block block = worldState.getBlock();
|
Block block = worldState.getBlock();
|
||||||
if (block instanceof IRitualStone) {
|
if (block instanceof IRitualStone)
|
||||||
if(!((IRitualStone)block).isRuneType(world, newPos, component.getRuneType())) {
|
{
|
||||||
return false;
|
if (!((IRitualStone) block).isRuneType(world, newPos, component.getRuneType()))
|
||||||
}
|
{
|
||||||
}else {
|
return false;
|
||||||
return false;
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkImperfectRituals(Configuration config, String packageName, String category) {
|
public static void checkImperfectRituals(Configuration config, String packageName, String category)
|
||||||
|
{
|
||||||
checkRituals(config, packageName, category, ImperfectRitual.class, ImperfectRitualRegistry.enabledRituals);
|
checkRituals(config, packageName, category, ImperfectRitual.class, ImperfectRitualRegistry.enabledRituals);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkRituals(Configuration config, String packageName, String category) {
|
public static void checkRituals(Configuration config, String packageName, String category)
|
||||||
|
{
|
||||||
checkRituals(config, packageName, category, Ritual.class, RitualRegistry.enabledRituals);
|
checkRituals(config, packageName, category, Ritual.class, RitualRegistry.enabledRituals);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds your Ritual to the {@link RitualRegistry#enabledRituals} Map.
|
* Adds your Ritual to the {@link RitualRegistry#enabledRituals} Map. This
|
||||||
* This is used to determine whether your effect is enabled or not.
|
* is used to determine whether your effect is enabled or not.
|
||||||
*
|
*
|
||||||
* The config option will be created as {@code B:ClassName=true} with a comment of
|
* The config option will be created as {@code B:ClassName=true} with a
|
||||||
* {@code Enables the ClassName ritual}.
|
* comment of {@code Enables the ClassName ritual}.
|
||||||
*
|
*
|
||||||
* Use {@link #}
|
* Use {@link #}
|
||||||
*
|
*
|
||||||
* Should be safe to modify at any point.
|
* Should be safe to modify at any point.
|
||||||
*
|
*
|
||||||
* @param config - Your mod's Forge {@link Configuration} object.
|
* @param config
|
||||||
* @param packageName - The package your Rituals are located in.
|
* - Your mod's Forge {@link Configuration} object.
|
||||||
* @param category - The config category to write to.
|
* @param packageName
|
||||||
|
* - The package your Rituals are located in.
|
||||||
|
* @param category
|
||||||
|
* - The config category to write to.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private static void checkRituals(Configuration config, String packageName, String category, Class ritualClass, Map enabledMap) {
|
private static void checkRituals(Configuration config, String packageName, String category, Class ritualClass, Map enabledMap)
|
||||||
|
{
|
||||||
String name = packageName;
|
String name = packageName;
|
||||||
if (!name.startsWith("/"))
|
if (!name.startsWith("/"))
|
||||||
name = "/" + name;
|
name = "/" + name;
|
||||||
|
@ -129,24 +152,31 @@ public class RitualHelper {
|
||||||
URL url = BloodMagic.class.getResource(name);
|
URL url = BloodMagic.class.getResource(name);
|
||||||
File directory = new File(url.getFile());
|
File directory = new File(url.getFile());
|
||||||
|
|
||||||
if (directory.exists()) {
|
if (directory.exists())
|
||||||
|
{
|
||||||
String[] files = directory.list();
|
String[] files = directory.list();
|
||||||
|
|
||||||
for (String file : files) {
|
for (String file : files)
|
||||||
if (file.endsWith(".class")) {
|
{
|
||||||
|
if (file.endsWith(".class"))
|
||||||
|
{
|
||||||
String className = file.substring(0, file.length() - 6);
|
String className = file.substring(0, file.length() - 6);
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
Object o = Class.forName(packageName + "." + className).newInstance();
|
Object o = Class.forName(packageName + "." + className).newInstance();
|
||||||
|
|
||||||
if (ritualClass.isInstance(o))
|
if (ritualClass.isInstance(o))
|
||||||
enabledMap.put(ritualClass.cast(o), config.get(category, className, true).getBoolean());
|
enabledMap.put(ritualClass.cast(o), config.get(category, className, true).getBoolean());
|
||||||
|
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e)
|
||||||
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e)
|
||||||
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e)
|
||||||
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,76 +23,90 @@ import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
||||||
import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
||||||
import WayofTime.bloodmagic.util.Utils;
|
import WayofTime.bloodmagic.util.Utils;
|
||||||
|
|
||||||
public class BlockAlchemyArray extends BlockContainer {
|
public class BlockAlchemyArray extends BlockContainer
|
||||||
|
{
|
||||||
|
|
||||||
public BlockAlchemyArray() {
|
public BlockAlchemyArray()
|
||||||
super(Material.cloth);
|
{
|
||||||
|
super(Material.cloth);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".alchemyArray");
|
setUnlocalizedName(Constants.Mod.MODID + ".alchemyArray");
|
||||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||||
this.setHardness(0.1f);
|
this.setHardness(0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube()
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public EnumWorldBlockLayer getBlockLayer() {
|
public EnumWorldBlockLayer getBlockLayer()
|
||||||
return EnumWorldBlockLayer.CUTOUT;
|
{
|
||||||
}
|
return EnumWorldBlockLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube() {
|
public boolean isFullCube()
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) {
|
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity)
|
||||||
this.setBlockBounds(0, 0, 0, 1, 0.1f, 1);
|
{
|
||||||
}
|
this.setBlockBounds(0, 0, 0, 1, 0.1f, 1);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
TileAlchemyArray array = (TileAlchemyArray) world.getTileEntity(pos);
|
{
|
||||||
|
TileAlchemyArray array = (TileAlchemyArray) world.getTileEntity(pos);
|
||||||
|
|
||||||
if (array == null || player.isSneaking())
|
if (array == null || player.isSneaking())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||||
|
|
||||||
if (playerItem != null) {
|
if (playerItem != null)
|
||||||
if (array.getStackInSlot(0) == null) {
|
{
|
||||||
Utils.insertItemToTile(array, player, 0);
|
if (array.getStackInSlot(0) == null)
|
||||||
} else {
|
{
|
||||||
Utils.insertItemToTile(array, player, 1);
|
Utils.insertItemToTile(array, player, 0);
|
||||||
array.attemptCraft();
|
} else
|
||||||
}
|
{
|
||||||
}
|
Utils.insertItemToTile(array, player, 1);
|
||||||
|
array.attemptCraft();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
world.markBlockForUpdate(pos);
|
world.markBlockForUpdate(pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(Random random) {
|
public int quantityDropped(Random random)
|
||||||
return 0;
|
{
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType()
|
||||||
return -1;
|
{
|
||||||
}
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||||
return new TileAlchemyArray();
|
{
|
||||||
}
|
return new TileAlchemyArray();
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
|
@Override
|
||||||
|
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||||
|
{
|
||||||
TileAlchemyArray alchemyArray = (TileAlchemyArray) world.getTileEntity(blockPos);
|
TileAlchemyArray alchemyArray = (TileAlchemyArray) world.getTileEntity(blockPos);
|
||||||
if (alchemyArray != null)
|
if (alchemyArray != null)
|
||||||
alchemyArray.dropItems();
|
alchemyArray.dropItems();
|
||||||
|
|
|
@ -16,9 +16,11 @@ import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockAltar extends BlockContainer {
|
public class BlockAltar extends BlockContainer
|
||||||
|
{
|
||||||
|
|
||||||
public BlockAltar() {
|
public BlockAltar()
|
||||||
|
{
|
||||||
super(Material.rock);
|
super(Material.rock);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".altar");
|
setUnlocalizedName(Constants.Mod.MODID + ".altar");
|
||||||
|
@ -26,32 +28,38 @@ public class BlockAltar extends BlockContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube()
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube() {
|
public boolean isFullCube()
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisuallyOpaque() {
|
public boolean isVisuallyOpaque()
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType()
|
||||||
|
{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta)
|
||||||
|
{
|
||||||
return new TileAltar();
|
return new TileAltar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
|
{
|
||||||
TileAltar altar = (TileAltar) world.getTileEntity(pos);
|
TileAltar altar = (TileAltar) world.getTileEntity(pos);
|
||||||
|
|
||||||
if (altar == null || player.isSneaking())
|
if (altar == null || player.isSneaking())
|
||||||
|
@ -59,8 +67,10 @@ public class BlockAltar extends BlockContainer {
|
||||||
|
|
||||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||||
|
|
||||||
if (playerItem != null) {
|
if (playerItem != null)
|
||||||
if (playerItem.getItem() instanceof IAltarReader || playerItem.getItem() instanceof IAltarManipulator) {
|
{
|
||||||
|
if (playerItem.getItem() instanceof IAltarReader || playerItem.getItem() instanceof IAltarManipulator)
|
||||||
|
{
|
||||||
playerItem.getItem().onItemRightClick(playerItem, world, player);
|
playerItem.getItem().onItemRightClick(playerItem, world, player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +86,8 @@ public class BlockAltar extends BlockContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
|
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||||
|
{
|
||||||
TileAltar tileAltar = (TileAltar) world.getTileEntity(blockPos);
|
TileAltar tileAltar = (TileAltar) world.getTileEntity(blockPos);
|
||||||
if (tileAltar != null)
|
if (tileAltar != null)
|
||||||
tileAltar.dropItems();
|
tileAltar.dropItems();
|
||||||
|
|
|
@ -17,9 +17,11 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockBloodLight extends Block {
|
public class BlockBloodLight extends Block
|
||||||
|
{
|
||||||
|
|
||||||
public BlockBloodLight() {
|
public BlockBloodLight()
|
||||||
|
{
|
||||||
super(Material.cloth);
|
super(Material.cloth);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".bloodLight");
|
setUnlocalizedName(Constants.Mod.MODID + ".bloodLight");
|
||||||
|
@ -27,30 +29,36 @@ public class BlockBloodLight extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube()
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public EnumWorldBlockLayer getBlockLayer() {
|
public EnumWorldBlockLayer getBlockLayer()
|
||||||
|
{
|
||||||
return EnumWorldBlockLayer.CUTOUT;
|
return EnumWorldBlockLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube() {
|
public boolean isFullCube()
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue() {
|
public int getLightValue()
|
||||||
|
{
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer) {
|
public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer)
|
||||||
if (world.getBlockState(pos).getBlock() == this) {
|
{
|
||||||
|
if (world.getBlockState(pos).getBlock() == this)
|
||||||
|
{
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
float f = 1.0F;
|
float f = 1.0F;
|
||||||
float f1 = f * 0.6F + 0.4F;
|
float f1 = f * 0.6F + 0.4F;
|
||||||
|
@ -63,8 +71,10 @@ public class BlockBloodLight extends Block {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
|
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
|
||||||
if (rand.nextInt(3) != 0) {
|
{
|
||||||
|
if (rand.nextInt(3) != 0)
|
||||||
|
{
|
||||||
float f = 1.0F;
|
float f = 1.0F;
|
||||||
float f1 = f * 0.6F + 0.4F;
|
float f1 = f * 0.6F + 0.4F;
|
||||||
float f2 = f * f * 0.7F - 0.5F;
|
float f2 = f * f * 0.7F - 0.5F;
|
||||||
|
@ -74,12 +84,14 @@ public class BlockBloodLight extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) {
|
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity)
|
||||||
|
{
|
||||||
this.setBlockBounds(0.35F, 0.35F, 0.35F, 0.65F, 0.65F, 0.65F);
|
this.setBlockBounds(0.35F, 0.35F, 0.35F, 0.65F, 0.65F, 0.65F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(Random par1Random) {
|
public int quantityDropped(Random par1Random)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,13 @@ import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.block.base.BlockString;
|
import WayofTime.bloodmagic.block.base.BlockString;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
|
||||||
public class BlockBloodRune extends BlockString {
|
public class BlockBloodRune extends BlockString
|
||||||
|
{
|
||||||
|
|
||||||
public static final String[] names = {"blank", "speed", "efficiency", "sacrifice", "selfSacrifice", "displacement", "capacity", "augCapacity", "orb", "acceleration"};
|
public static final String[] names = { "blank", "speed", "efficiency", "sacrifice", "selfSacrifice", "displacement", "capacity", "augCapacity", "orb", "acceleration" };
|
||||||
|
|
||||||
public BlockBloodRune() {
|
public BlockBloodRune()
|
||||||
|
{
|
||||||
super(Material.rock, names);
|
super(Material.rock, names);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".rune.");
|
setUnlocalizedName(Constants.Mod.MODID + ".rune.");
|
||||||
|
@ -20,7 +22,8 @@ public class BlockBloodRune extends BlockString {
|
||||||
setHarvestLevel("pickaxe", 2);
|
setHarvestLevel("pickaxe", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRuneEffect(int meta) {
|
public int getRuneEffect(int meta)
|
||||||
|
{
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,13 @@ import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.block.base.BlockString;
|
import WayofTime.bloodmagic.block.base.BlockString;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
|
||||||
public class BlockBloodStoneBrick extends BlockString {
|
public class BlockBloodStoneBrick extends BlockString
|
||||||
|
{
|
||||||
|
|
||||||
public static final String[] names = {"normal", "large"};
|
public static final String[] names = { "normal", "large" };
|
||||||
|
|
||||||
public BlockBloodStoneBrick() {
|
public BlockBloodStoneBrick()
|
||||||
|
{
|
||||||
super(Material.rock, names);
|
super(Material.rock, names);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".bloodstonebrick.");
|
setUnlocalizedName(Constants.Mod.MODID + ".bloodstonebrick.");
|
||||||
|
|
|
@ -5,10 +5,12 @@ import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.block.base.BlockString;
|
import WayofTime.bloodmagic.block.base.BlockString;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
|
||||||
public class BlockCrystal extends BlockString {
|
public class BlockCrystal extends BlockString
|
||||||
public static final String[] names = {"normal", "brick"};
|
{
|
||||||
|
public static final String[] names = { "normal", "brick" };
|
||||||
|
|
||||||
public BlockCrystal() {
|
public BlockCrystal()
|
||||||
|
{
|
||||||
super(Material.rock, names);
|
super(Material.rock, names);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".crystal.");
|
setUnlocalizedName(Constants.Mod.MODID + ".crystal.");
|
||||||
|
|
|
@ -15,12 +15,14 @@ import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
public class BlockLifeEssence extends BlockFluidClassic {
|
public class BlockLifeEssence extends BlockFluidClassic
|
||||||
|
{
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static Fluid lifeEssence = new FluidLifeEssence();
|
private static Fluid lifeEssence = new FluidLifeEssence();
|
||||||
|
|
||||||
public BlockLifeEssence() {
|
public BlockLifeEssence()
|
||||||
|
{
|
||||||
super(lifeEssence, Material.water);
|
super(lifeEssence, Material.water);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".fluid.lifeEssence");
|
setUnlocalizedName(Constants.Mod.MODID + ".fluid.lifeEssence");
|
||||||
|
@ -30,18 +32,22 @@ public class BlockLifeEssence extends BlockFluidClassic {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDisplace(IBlockAccess world, BlockPos blockPos) {
|
public boolean canDisplace(IBlockAccess world, BlockPos blockPos)
|
||||||
|
{
|
||||||
return !world.getBlockState(blockPos).getBlock().getMaterial().isLiquid() && super.canDisplace(world, blockPos);
|
return !world.getBlockState(blockPos).getBlock().getMaterial().isLiquid() && super.canDisplace(world, blockPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean displaceIfPossible(World world, BlockPos blockPos) {
|
public boolean displaceIfPossible(World world, BlockPos blockPos)
|
||||||
|
{
|
||||||
return !world.getBlockState(blockPos).getBlock().getMaterial().isLiquid() && super.displaceIfPossible(world, blockPos);
|
return !world.getBlockState(blockPos).getBlock().getMaterial().isLiquid() && super.displaceIfPossible(world, blockPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class FluidLifeEssence extends Fluid {
|
public static class FluidLifeEssence extends Fluid
|
||||||
|
{
|
||||||
|
|
||||||
public FluidLifeEssence() {
|
public FluidLifeEssence()
|
||||||
|
{
|
||||||
super("lifeEssence", new ResourceLocation(Constants.Mod.DOMAIN + "blocks/lifeEssenceStill"), new ResourceLocation(Constants.Mod.DOMAIN + "blocks/lifeEssenceFlowing"));
|
super("lifeEssence", new ResourceLocation(Constants.Mod.DOMAIN + "blocks/lifeEssenceStill"), new ResourceLocation(Constants.Mod.DOMAIN + "blocks/lifeEssenceFlowing"));
|
||||||
|
|
||||||
setDensity(2000);
|
setDensity(2000);
|
||||||
|
@ -49,12 +55,14 @@ public class BlockLifeEssence extends BlockFluidClassic {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColor() {
|
public int getColor()
|
||||||
|
{
|
||||||
return Color.WHITE.getRGB();
|
return Color.WHITE.getRGB();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLocalizedName(FluidStack fluidStack) {
|
public String getLocalizedName(FluidStack fluidStack)
|
||||||
|
{
|
||||||
return StatCollector.translateToLocal("tile.BloodMagic.fluid.lifeEssence.name");
|
return StatCollector.translateToLocal("tile.BloodMagic.fluid.lifeEssence.name");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,13 @@ import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockPedestal extends BlockStringContainer {
|
public class BlockPedestal extends BlockStringContainer
|
||||||
|
{
|
||||||
|
|
||||||
public static String[] names = {"pedestal", "plinth"};
|
public static String[] names = { "pedestal", "plinth" };
|
||||||
|
|
||||||
public BlockPedestal() {
|
public BlockPedestal()
|
||||||
|
{
|
||||||
super(Material.rock, names);
|
super(Material.rock, names);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".");
|
setUnlocalizedName(Constants.Mod.MODID + ".");
|
||||||
|
@ -28,35 +30,41 @@ public class BlockPedestal extends BlockStringContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
switch (getMetaFromState(state)) {
|
{
|
||||||
case 0: {
|
switch (getMetaFromState(state))
|
||||||
// TileEntity plinth = world.getTileEntity(pos);
|
{
|
||||||
//
|
case 0:
|
||||||
// if (plinth!= null && plinth instanceof TilePlinth) {
|
{
|
||||||
// Utils.insertItemToTile((TilePlinth) plinth, player);
|
// TileEntity plinth = world.getTileEntity(pos);
|
||||||
// }
|
//
|
||||||
}
|
// if (plinth!= null && plinth instanceof TilePlinth) {
|
||||||
|
// Utils.insertItemToTile((TilePlinth) plinth, player);
|
||||||
case 1: {
|
// }
|
||||||
TileEntity plinth = world.getTileEntity(pos);
|
}
|
||||||
|
|
||||||
if (plinth == null || player.isSneaking())
|
case 1:
|
||||||
return false;
|
{
|
||||||
|
TileEntity plinth = world.getTileEntity(pos);
|
||||||
if (plinth instanceof TilePlinth) {
|
|
||||||
Utils.insertItemToTile((TilePlinth) plinth, player);
|
if (plinth == null || player.isSneaking())
|
||||||
return true;
|
return false;
|
||||||
}
|
|
||||||
|
if (plinth instanceof TilePlinth)
|
||||||
|
{
|
||||||
|
Utils.insertItemToTile((TilePlinth) plinth, player);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
world.markBlockForUpdate(pos);
|
world.markBlockForUpdate(pos);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, BlockPos pos) {
|
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, BlockPos pos)
|
||||||
|
{
|
||||||
IBlockState state = blockAccess.getBlockState(pos);
|
IBlockState state = blockAccess.getBlockState(pos);
|
||||||
|
|
||||||
if (getMetaFromState(state) == 0)
|
if (getMetaFromState(state) == 0)
|
||||||
|
@ -67,17 +75,20 @@ public class BlockPedestal extends BlockStringContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube()
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube() {
|
public boolean isFullCube()
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta)
|
||||||
|
{
|
||||||
return meta == 0 ? null : new TilePlinth();
|
return meta == 0 ? null : new TilePlinth();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,21 +17,25 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockPhantom extends BlockContainer {
|
public class BlockPhantom extends BlockContainer
|
||||||
|
{
|
||||||
|
|
||||||
public BlockPhantom() {
|
public BlockPhantom()
|
||||||
|
{
|
||||||
super(Material.cloth);
|
super(Material.cloth);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".phantom");
|
setUnlocalizedName(Constants.Mod.MODID + ".phantom");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube()
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube() {
|
public boolean isFullCube()
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,17 +48,20 @@ public class BlockPhantom extends BlockContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public EnumWorldBlockLayer getBlockLayer() {
|
public EnumWorldBlockLayer getBlockLayer()
|
||||||
|
{
|
||||||
return EnumWorldBlockLayer.TRANSLUCENT;
|
return EnumWorldBlockLayer.TRANSLUCENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) {
|
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
|
||||||
|
{
|
||||||
IBlockState iblockstate = worldIn.getBlockState(pos);
|
IBlockState iblockstate = worldIn.getBlockState(pos);
|
||||||
Block block = iblockstate.getBlock();
|
Block block = iblockstate.getBlock();
|
||||||
|
|
||||||
if (worldIn.getBlockState(pos.offset(side.getOpposite())) != iblockstate) {
|
if (worldIn.getBlockState(pos.offset(side.getOpposite())) != iblockstate)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,12 +69,14 @@ public class BlockPhantom extends BlockContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(Random par1Random) {
|
public int quantityDropped(Random par1Random)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta)
|
||||||
|
{
|
||||||
return new TilePhantomBlock();
|
return new TilePhantomBlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,13 @@ import WayofTime.bloodmagic.registry.ModItems;
|
||||||
import WayofTime.bloodmagic.tile.TileImperfectRitualStone;
|
import WayofTime.bloodmagic.tile.TileImperfectRitualStone;
|
||||||
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
|
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
|
||||||
|
|
||||||
public class BlockRitualController extends BlockStringContainer {
|
public class BlockRitualController extends BlockStringContainer
|
||||||
|
{
|
||||||
|
|
||||||
public static final String[] names = {"master", "imperfect"};
|
public static final String[] names = { "master", "imperfect" };
|
||||||
|
|
||||||
public BlockRitualController() {
|
public BlockRitualController()
|
||||||
|
{
|
||||||
super(Material.rock, names);
|
super(Material.rock, names);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".stone.ritual.");
|
setUnlocalizedName(Constants.Mod.MODID + ".stone.ritual.");
|
||||||
|
@ -36,21 +38,28 @@ public class BlockRitualController extends BlockStringContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
|
{
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
|
||||||
if (getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone) {
|
if (getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone)
|
||||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.activationCrystal) {
|
{
|
||||||
String key = RitualHelper.getValidRitual(world, pos);
|
if (player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.activationCrystal)
|
||||||
EnumFacing direction = RitualHelper.getDirectionOfRitual(world, pos, key);
|
{
|
||||||
//TODO: Give a message stating that this ritual is not a valid ritual.
|
String key = RitualHelper.getValidRitual(world, pos);
|
||||||
if (!key.isEmpty() && direction != null && RitualHelper.checkValidRitual(world, pos, key, direction)) {
|
EnumFacing direction = RitualHelper.getDirectionOfRitual(world, pos, key);
|
||||||
if(((TileMasterRitualStone) tile).activateRitual(player.getHeldItem(), player, RitualRegistry.getRitualForId(key))) {
|
// TODO: Give a message stating that this ritual is not a valid
|
||||||
((TileMasterRitualStone) tile).setDirection(direction);
|
// ritual.
|
||||||
|
if (!key.isEmpty() && direction != null && RitualHelper.checkValidRitual(world, pos, key, direction))
|
||||||
|
{
|
||||||
|
if (((TileMasterRitualStone) tile).activateRitual(player.getHeldItem(), player, RitualRegistry.getRitualForId(key)))
|
||||||
|
{
|
||||||
|
((TileMasterRitualStone) tile).setDirection(direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (getMetaFromState(state) == 1 && tile instanceof TileImperfectRitualStone) {
|
} else if (getMetaFromState(state) == 1 && tile instanceof TileImperfectRitualStone)
|
||||||
|
{
|
||||||
|
|
||||||
IBlockState determinerState = world.getBlockState(pos.up());
|
IBlockState determinerState = world.getBlockState(pos.up());
|
||||||
BlockStack determiner = new BlockStack(determinerState.getBlock(), determinerState.getBlock().getMetaFromState(determinerState));
|
BlockStack determiner = new BlockStack(determinerState.getBlock(), determinerState.getBlock().getMetaFromState(determinerState));
|
||||||
|
@ -62,7 +71,8 @@ public class BlockRitualController extends BlockStringContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player)
|
||||||
|
{
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
|
||||||
if (getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone)
|
if (getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone)
|
||||||
|
@ -70,7 +80,8 @@ public class BlockRitualController extends BlockStringContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockDestroyedByExplosion(World world, BlockPos pos, Explosion explosion) {
|
public void onBlockDestroyedByExplosion(World world, BlockPos pos, Explosion explosion)
|
||||||
|
{
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
IBlockState state = world.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
|
|
||||||
|
@ -79,7 +90,8 @@ public class BlockRitualController extends BlockStringContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta)
|
||||||
|
{
|
||||||
return meta == 0 ? (new TileMasterRitualStone()) : (new TileImperfectRitualStone());
|
return meta == 0 ? (new TileMasterRitualStone()) : (new TileImperfectRitualStone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,13 @@ import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockRitualStone extends BlockString implements IRitualStone {
|
public class BlockRitualStone extends BlockString implements IRitualStone
|
||||||
|
{
|
||||||
|
|
||||||
public static final String[] names = {"blank", "water", "fire", "earth", "air", "dusk", "dawn"};
|
public static final String[] names = { "blank", "water", "fire", "earth", "air", "dusk", "dawn" };
|
||||||
|
|
||||||
public BlockRitualStone() {
|
public BlockRitualStone()
|
||||||
|
{
|
||||||
super(Material.iron, names);
|
super(Material.iron, names);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".ritualStone.");
|
setUnlocalizedName(Constants.Mod.MODID + ".ritualStone.");
|
||||||
|
@ -25,7 +27,8 @@ public class BlockRitualStone extends BlockString implements IRitualStone {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRuneType(World world, BlockPos pos, EnumRuneType runeType) {
|
public boolean isRuneType(World world, BlockPos pos, EnumRuneType runeType)
|
||||||
|
{
|
||||||
return runeType.toString().equals(names[getMetaFromState(world.getBlockState(pos))]);
|
return runeType.toString().equals(names[getMetaFromState(world.getBlockState(pos))]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,11 @@ import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockSoulForge extends Block {
|
public class BlockSoulForge extends Block
|
||||||
|
{
|
||||||
|
|
||||||
public BlockSoulForge() {
|
public BlockSoulForge()
|
||||||
|
{
|
||||||
super(Material.iron);
|
super(Material.iron);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".soulforge.");
|
setUnlocalizedName(Constants.Mod.MODID + ".soulforge.");
|
||||||
|
@ -24,11 +26,11 @@ public class BlockSoulForge extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
|
{
|
||||||
if (world.isRemote)
|
if (world.isRemote)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,11 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockSpectral extends BlockContainer {
|
public class BlockSpectral extends BlockContainer
|
||||||
|
{
|
||||||
|
|
||||||
public BlockSpectral() {
|
public BlockSpectral()
|
||||||
|
{
|
||||||
super(Material.cloth);
|
super(Material.cloth);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".spectral");
|
setUnlocalizedName(Constants.Mod.MODID + ".spectral");
|
||||||
|
@ -28,42 +30,50 @@ public class BlockSpectral extends BlockContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube()
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube() {
|
public boolean isFullCube()
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public EnumWorldBlockLayer getBlockLayer() {
|
public EnumWorldBlockLayer getBlockLayer()
|
||||||
|
{
|
||||||
return EnumWorldBlockLayer.CUTOUT;
|
return EnumWorldBlockLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) {
|
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(Random par1Random) {
|
public int quantityDropped(Random par1Random)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReplaceable(World world, BlockPos blockPos) {
|
public boolean isReplaceable(World world, BlockPos blockPos)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAir(IBlockAccess world, BlockPos blockPos) {
|
public boolean isAir(IBlockAccess world, BlockPos blockPos)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta)
|
||||||
|
{
|
||||||
return new TileSpectralBlock();
|
return new TileSpectralBlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,11 @@ import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockTeleposer extends BlockContainer {
|
public class BlockTeleposer extends BlockContainer
|
||||||
|
{
|
||||||
|
|
||||||
public BlockTeleposer() {
|
public BlockTeleposer()
|
||||||
|
{
|
||||||
super(Material.rock);
|
super(Material.rock);
|
||||||
|
|
||||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||||
|
@ -26,27 +28,32 @@ public class BlockTeleposer extends BlockContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType()
|
||||||
|
{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
|
{
|
||||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||||
|
|
||||||
if (playerItem != null && playerItem.getItem() instanceof ItemTelepositionFocus) {
|
if (playerItem != null && playerItem.getItem() instanceof ItemTelepositionFocus)
|
||||||
|
{
|
||||||
BindableHelper.checkAndSetItemOwner(playerItem, player);
|
BindableHelper.checkAndSetItemOwner(playerItem, player);
|
||||||
|
|
||||||
((ItemTelepositionFocus) playerItem.getItem()).setBlockPos(playerItem, world, pos);
|
((ItemTelepositionFocus) playerItem.getItem()).setBlockPos(playerItem, world, pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// player.openGui(AlchemicalWizardry.instance, 1, world, pos.getX(), pos.getY(), pos.getZ());
|
// player.openGui(AlchemicalWizardry.instance, 1, world, pos.getX(),
|
||||||
|
// pos.getY(), pos.getZ());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,57 +12,61 @@ import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
public class BlockTestSpellBlock extends Block {
|
public class BlockTestSpellBlock extends Block
|
||||||
public static final PropertyDirection INPUT = PropertyDirection
|
{
|
||||||
.create("input");
|
public static final PropertyDirection INPUT = PropertyDirection.create("input");
|
||||||
public static final PropertyDirection OUTPUT = PropertyDirection
|
public static final PropertyDirection OUTPUT = PropertyDirection.create("output");
|
||||||
.create("output");
|
|
||||||
|
|
||||||
public BlockTestSpellBlock() {
|
public BlockTestSpellBlock()
|
||||||
|
{
|
||||||
super(Material.rock);
|
super(Material.rock);
|
||||||
setHardness(2.0F);
|
setHardness(2.0F);
|
||||||
setResistance(5.0F);
|
setResistance(5.0F);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".testSpellBlock");
|
setUnlocalizedName(Constants.Mod.MODID + ".testSpellBlock");
|
||||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||||
this.setDefaultState(this.blockState.getBaseState()
|
this.setDefaultState(this.blockState.getBaseState().withProperty(INPUT, EnumFacing.DOWN).withProperty(OUTPUT, EnumFacing.UP));
|
||||||
.withProperty(INPUT, EnumFacing.DOWN)
|
|
||||||
.withProperty(OUTPUT, EnumFacing.UP));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public IBlockState getStateFromMeta(int meta)
|
||||||
|
{
|
||||||
return this.getDefaultState();
|
return this.getDefaultState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(IBlockState state)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
|
||||||
return state.withProperty(INPUT, EnumFacing.DOWN)
|
{
|
||||||
.withProperty(OUTPUT, EnumFacing.UP);
|
return state.withProperty(INPUT, EnumFacing.DOWN).withProperty(OUTPUT, EnumFacing.UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockState createBlockState() {
|
protected BlockState createBlockState()
|
||||||
return new BlockState(this, new IProperty[]{INPUT, OUTPUT});
|
{
|
||||||
|
return new BlockState(this, new IProperty[] { INPUT, OUTPUT });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube()
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube() {
|
public boolean isFullCube()
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPassable(IBlockAccess blockAccess, BlockPos pos) {
|
public boolean isPassable(IBlockAccess blockAccess, BlockPos pos)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,20 +26,23 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a block that has multiple meta-based states.
|
* Creates a block that has multiple meta-based states.
|
||||||
*
|
*
|
||||||
* These states will be numbered 0 through {@code maxMeta}.
|
* These states will be numbered 0 through {@code maxMeta}.
|
||||||
*
|
*
|
||||||
* For {@link net.minecraft.tileentity.TileEntity}'s, use {@link BlockIntegerContainer}.
|
* For {@link net.minecraft.tileentity.TileEntity}'s, use
|
||||||
|
* {@link BlockIntegerContainer}.
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public class BlockInteger extends Block {
|
public class BlockInteger extends Block
|
||||||
|
{
|
||||||
|
|
||||||
private final int maxMeta;
|
private final int maxMeta;
|
||||||
private final PropertyInteger metaProp;
|
private final PropertyInteger metaProp;
|
||||||
private final IUnlistedProperty unlistedMetaProp;
|
private final IUnlistedProperty unlistedMetaProp;
|
||||||
private final BlockState realBlockState;
|
private final BlockState realBlockState;
|
||||||
|
|
||||||
public BlockInteger(Material material, int maxMeta, String propName) {
|
public BlockInteger(Material material, int maxMeta, String propName)
|
||||||
|
{
|
||||||
super(material);
|
super(material);
|
||||||
|
|
||||||
this.maxMeta = maxMeta;
|
this.maxMeta = maxMeta;
|
||||||
|
@ -50,60 +53,72 @@ public class BlockInteger extends Block {
|
||||||
setupStates();
|
setupStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockInteger(Material material, int maxMeta) {
|
public BlockInteger(Material material, int maxMeta)
|
||||||
|
{
|
||||||
this(material, maxMeta, "meta");
|
this(material, maxMeta, "meta");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public IBlockState getStateFromMeta(int meta)
|
||||||
|
{
|
||||||
return getBlockState().getBaseState().withProperty(metaProp, meta);
|
return getBlockState().getBaseState().withProperty(metaProp, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(IBlockState state)
|
||||||
|
{
|
||||||
return (Integer) state.getValue(metaProp);
|
return (Integer) state.getValue(metaProp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state) {
|
public int damageDropped(IBlockState state)
|
||||||
|
{
|
||||||
return getMetaFromState(state);
|
return getMetaFromState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlockState() {
|
public BlockState getBlockState()
|
||||||
|
{
|
||||||
return this.realBlockState;
|
return this.realBlockState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState createBlockState() {
|
public BlockState createBlockState()
|
||||||
|
{
|
||||||
return Blocks.air.getBlockState();
|
return Blocks.air.getBlockState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player)
|
||||||
|
{
|
||||||
return new ItemStack(this, 1, this.getMetaFromState(world.getBlockState(pos)));
|
return new ItemStack(this, 1, this.getMetaFromState(world.getBlockState(pos)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List<ItemStack> list) {
|
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List<ItemStack> list)
|
||||||
|
{
|
||||||
for (int i = 0; i < maxMeta + 1; i++)
|
for (int i = 0; i < maxMeta + 1; i++)
|
||||||
list.add(new ItemStack(this, 1, i));
|
list.add(new ItemStack(this, 1, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupStates() {
|
private void setupStates()
|
||||||
|
{
|
||||||
this.setDefaultState(getExtendedBlockState().withProperty(unlistedMetaProp, 0).withProperty(metaProp, 0));
|
this.setDefaultState(getExtendedBlockState().withProperty(unlistedMetaProp, 0).withProperty(metaProp, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExtendedBlockState getBaseExtendedState() {
|
public ExtendedBlockState getBaseExtendedState()
|
||||||
|
{
|
||||||
return (ExtendedBlockState) this.getBlockState();
|
return (ExtendedBlockState) this.getBlockState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IExtendedBlockState getExtendedBlockState() {
|
public IExtendedBlockState getExtendedBlockState()
|
||||||
|
{
|
||||||
return (IExtendedBlockState) this.getBaseExtendedState().getBaseState();
|
return (IExtendedBlockState) this.getBaseExtendedState().getBaseState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockState createRealBlockState() {
|
private BlockState createRealBlockState()
|
||||||
return new ExtendedBlockState(this, new IProperty[]{metaProp}, new IUnlistedProperty[]{unlistedMetaProp});
|
{
|
||||||
|
return new ExtendedBlockState(this, new IProperty[] { metaProp }, new IUnlistedProperty[] { unlistedMetaProp });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,26 +7,31 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public abstract class BlockIntegerContainer extends BlockInteger implements ITileEntityProvider {
|
public abstract class BlockIntegerContainer extends BlockInteger implements ITileEntityProvider
|
||||||
|
{
|
||||||
|
|
||||||
public BlockIntegerContainer(Material material, int maxMeta, String propName) {
|
public BlockIntegerContainer(Material material, int maxMeta, String propName)
|
||||||
|
{
|
||||||
super(material, maxMeta, propName);
|
super(material, maxMeta, propName);
|
||||||
|
|
||||||
this.isBlockContainer = true;
|
this.isBlockContainer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockIntegerContainer(Material material, int maxMeta) {
|
public BlockIntegerContainer(Material material, int maxMeta)
|
||||||
|
{
|
||||||
this(material, maxMeta, "meta");
|
this(material, maxMeta, "meta");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
|
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||||
|
{
|
||||||
super.breakBlock(worldIn, pos, state);
|
super.breakBlock(worldIn, pos, state);
|
||||||
worldIn.removeTileEntity(pos);
|
worldIn.removeTileEntity(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) {
|
public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam)
|
||||||
|
{
|
||||||
super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam);
|
super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam);
|
||||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||||
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
||||||
|
|
|
@ -27,14 +27,17 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a block that has multiple meta-based states.
|
* Creates a block that has multiple meta-based states.
|
||||||
*
|
*
|
||||||
* These states will be named after the given string array. Somewhere along the way, each
|
* These states will be named after the given string array. Somewhere along the
|
||||||
* value is {@code toLowerCase()}'ed, so the blockstate JSON needs all values to be lowercase.
|
* way, each value is {@code toLowerCase()}'ed, so the blockstate JSON needs all
|
||||||
*
|
* values to be lowercase.
|
||||||
* For {@link net.minecraft.tileentity.TileEntity}'s, use {@link BlockStringContainer}.
|
*
|
||||||
|
* For {@link net.minecraft.tileentity.TileEntity}'s, use
|
||||||
|
* {@link BlockStringContainer}.
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public class BlockString extends Block {
|
public class BlockString extends Block
|
||||||
|
{
|
||||||
|
|
||||||
private final int maxMeta;
|
private final int maxMeta;
|
||||||
private final List<String> values;
|
private final List<String> values;
|
||||||
|
@ -42,7 +45,8 @@ public class BlockString extends Block {
|
||||||
private final IUnlistedProperty unlistedStringProp;
|
private final IUnlistedProperty unlistedStringProp;
|
||||||
private final BlockState realBlockState;
|
private final BlockState realBlockState;
|
||||||
|
|
||||||
public BlockString(Material material, String[] values, String propName) {
|
public BlockString(Material material, String[] values, String propName)
|
||||||
|
{
|
||||||
super(material);
|
super(material);
|
||||||
|
|
||||||
this.maxMeta = values.length - 1;
|
this.maxMeta = values.length - 1;
|
||||||
|
@ -54,60 +58,72 @@ public class BlockString extends Block {
|
||||||
setupStates();
|
setupStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockString(Material material, String[] values) {
|
public BlockString(Material material, String[] values)
|
||||||
|
{
|
||||||
this(material, values, "type");
|
this(material, values, "type");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public IBlockState getStateFromMeta(int meta)
|
||||||
|
{
|
||||||
return getBlockState().getBaseState().withProperty(stringProp, values.get(meta));
|
return getBlockState().getBaseState().withProperty(stringProp, values.get(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
public int getMetaFromState(IBlockState state)
|
||||||
|
{
|
||||||
return values.indexOf(String.valueOf(state.getValue(stringProp)));
|
return values.indexOf(String.valueOf(state.getValue(stringProp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state) {
|
public int damageDropped(IBlockState state)
|
||||||
|
{
|
||||||
return getMetaFromState(state);
|
return getMetaFromState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlockState() {
|
public BlockState getBlockState()
|
||||||
|
{
|
||||||
return this.realBlockState;
|
return this.realBlockState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState createBlockState() {
|
public BlockState createBlockState()
|
||||||
|
{
|
||||||
return Blocks.air.getBlockState();
|
return Blocks.air.getBlockState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player)
|
||||||
|
{
|
||||||
return new ItemStack(this, 1, this.getMetaFromState(world.getBlockState(pos)));
|
return new ItemStack(this, 1, this.getMetaFromState(world.getBlockState(pos)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List<ItemStack> list) {
|
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List<ItemStack> list)
|
||||||
|
{
|
||||||
for (int i = 0; i < maxMeta + 1; i++)
|
for (int i = 0; i < maxMeta + 1; i++)
|
||||||
list.add(new ItemStack(this, 1, i));
|
list.add(new ItemStack(this, 1, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupStates() {
|
private void setupStates()
|
||||||
|
{
|
||||||
this.setDefaultState(getExtendedBlockState().withProperty(unlistedStringProp, values.get(0)).withProperty(stringProp, values.get(0)));
|
this.setDefaultState(getExtendedBlockState().withProperty(unlistedStringProp, values.get(0)).withProperty(stringProp, values.get(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExtendedBlockState getBaseExtendedState() {
|
public ExtendedBlockState getBaseExtendedState()
|
||||||
|
{
|
||||||
return (ExtendedBlockState) this.getBlockState();
|
return (ExtendedBlockState) this.getBlockState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IExtendedBlockState getExtendedBlockState() {
|
public IExtendedBlockState getExtendedBlockState()
|
||||||
|
{
|
||||||
return (IExtendedBlockState) this.getBaseExtendedState().getBaseState();
|
return (IExtendedBlockState) this.getBaseExtendedState().getBaseState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockState createRealBlockState() {
|
private BlockState createRealBlockState()
|
||||||
return new ExtendedBlockState(this, new IProperty[]{stringProp}, new IUnlistedProperty[]{unlistedStringProp});
|
{
|
||||||
|
return new ExtendedBlockState(this, new IProperty[] { stringProp }, new IUnlistedProperty[] { unlistedStringProp });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,26 +7,31 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public abstract class BlockStringContainer extends BlockString implements ITileEntityProvider {
|
public abstract class BlockStringContainer extends BlockString implements ITileEntityProvider
|
||||||
|
{
|
||||||
|
|
||||||
public BlockStringContainer(Material material, String[] values, String propName) {
|
public BlockStringContainer(Material material, String[] values, String propName)
|
||||||
|
{
|
||||||
super(material, values, propName);
|
super(material, values, propName);
|
||||||
|
|
||||||
this.isBlockContainer = true;
|
this.isBlockContainer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockStringContainer(Material material, String[] values) {
|
public BlockStringContainer(Material material, String[] values)
|
||||||
|
{
|
||||||
this(material, values, "type");
|
this(material, values, "type");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
|
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||||
|
{
|
||||||
super.breakBlock(worldIn, pos, state);
|
super.breakBlock(worldIn, pos, state);
|
||||||
worldIn.removeTileEntity(pos);
|
worldIn.removeTileEntity(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) {
|
public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam)
|
||||||
|
{
|
||||||
super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam);
|
super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam);
|
||||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||||
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
||||||
|
|
|
@ -8,11 +8,13 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class PropertyString extends PropertyHelper {
|
public class PropertyString extends PropertyHelper
|
||||||
|
{
|
||||||
|
|
||||||
private final ImmutableSet allowedValues;
|
private final ImmutableSet allowedValues;
|
||||||
|
|
||||||
protected PropertyString(String name, String[] values) {
|
protected PropertyString(String name, String[] values)
|
||||||
|
{
|
||||||
super(name, String.class);
|
super(name, String.class);
|
||||||
|
|
||||||
HashSet<String> hashSet = Sets.newHashSet();
|
HashSet<String> hashSet = Sets.newHashSet();
|
||||||
|
@ -20,21 +22,25 @@ public class PropertyString extends PropertyHelper {
|
||||||
allowedValues = ImmutableSet.copyOf(hashSet);
|
allowedValues = ImmutableSet.copyOf(hashSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PropertyString create(String name, String[] values) {
|
public static PropertyString create(String name, String[] values)
|
||||||
|
{
|
||||||
return new PropertyString(name, values);
|
return new PropertyString(name, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection getAllowedValues() {
|
public Collection getAllowedValues()
|
||||||
|
{
|
||||||
return allowedValues;
|
return allowedValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName0(String value) {
|
public String getName0(String value)
|
||||||
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName(Comparable value) {
|
public String getName(Comparable value)
|
||||||
|
{
|
||||||
return this.getName0(value.toString());
|
return this.getName0(value.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,33 +2,39 @@ package WayofTime.bloodmagic.block.property;
|
||||||
|
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
|
||||||
public class UnlistedPropertyInteger implements IUnlistedProperty<Integer> {
|
public class UnlistedPropertyInteger implements IUnlistedProperty<Integer>
|
||||||
|
{
|
||||||
|
|
||||||
private int maxMeta;
|
private int maxMeta;
|
||||||
private String propName;
|
private String propName;
|
||||||
|
|
||||||
public UnlistedPropertyInteger(int maxMeta, String propName) {
|
public UnlistedPropertyInteger(int maxMeta, String propName)
|
||||||
|
{
|
||||||
this.maxMeta = maxMeta;
|
this.maxMeta = maxMeta;
|
||||||
this.propName = propName;
|
this.propName = propName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName()
|
||||||
|
{
|
||||||
return propName;
|
return propName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(Integer value) {
|
public boolean isValid(Integer value)
|
||||||
|
{
|
||||||
return value <= maxMeta;
|
return value <= maxMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Integer> getType() {
|
public Class<Integer> getType()
|
||||||
|
{
|
||||||
return Integer.class;
|
return Integer.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String valueToString(Integer value) {
|
public String valueToString(Integer value)
|
||||||
|
{
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,33 +5,39 @@ import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class UnlistedPropertyString implements IUnlistedProperty<String> {
|
public class UnlistedPropertyString implements IUnlistedProperty<String>
|
||||||
|
{
|
||||||
|
|
||||||
private List values;
|
private List values;
|
||||||
private String propName;
|
private String propName;
|
||||||
|
|
||||||
public UnlistedPropertyString(String[] values, String propName) {
|
public UnlistedPropertyString(String[] values, String propName)
|
||||||
|
{
|
||||||
this.values = Arrays.asList(values);
|
this.values = Arrays.asList(values);
|
||||||
this.propName = propName;
|
this.propName = propName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName()
|
||||||
|
{
|
||||||
return propName;
|
return propName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(String value) {
|
public boolean isValid(String value)
|
||||||
|
{
|
||||||
return values.contains(value);
|
return values.contains(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<String> getType() {
|
public Class<String> getType()
|
||||||
|
{
|
||||||
return String.class;
|
return String.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String valueToString(String value) {
|
public String valueToString(String value)
|
||||||
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,17 +10,21 @@ import net.minecraftforge.fml.client.config.IConfigElement;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ConfigGui extends GuiConfig {
|
public class ConfigGui extends GuiConfig
|
||||||
|
{
|
||||||
|
|
||||||
public ConfigGui(GuiScreen parentScreen) {
|
public ConfigGui(GuiScreen parentScreen)
|
||||||
|
{
|
||||||
super(parentScreen, getConfigElements(parentScreen), Constants.Mod.MODID, false, false, "BloodMagic Configuration");
|
super(parentScreen, getConfigElements(parentScreen), Constants.Mod.MODID, false, false, "BloodMagic Configuration");
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private static List<IConfigElement> getConfigElements(GuiScreen parent) {
|
private static List<IConfigElement> getConfigElements(GuiScreen parent)
|
||||||
|
{
|
||||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||||
|
|
||||||
// adds sections declared in ConfigHandler. toLowerCase() is used because the configuration class automatically does this, so must we.
|
// adds sections declared in ConfigHandler. toLowerCase() is used
|
||||||
|
// because the configuration class automatically does this, so must we.
|
||||||
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Potions".toLowerCase())));
|
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Potions".toLowerCase())));
|
||||||
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Teleposer Blacklist".toLowerCase())));
|
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Teleposer Blacklist".toLowerCase())));
|
||||||
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Item/Block Blacklisting".toLowerCase())));
|
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Item/Block Blacklisting".toLowerCase())));
|
||||||
|
|
|
@ -6,25 +6,30 @@ import net.minecraftforge.fml.client.IModGuiFactory;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class ConfigGuiFactory implements IModGuiFactory {
|
public class ConfigGuiFactory implements IModGuiFactory
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(Minecraft minecraftInstance) {
|
public void initialize(Minecraft minecraftInstance)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
public Class<? extends GuiScreen> mainConfigGuiClass()
|
||||||
|
{
|
||||||
return ConfigGui.class;
|
return ConfigGui.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RuntimeOptionGuiHandler getHandlerFor(IModGuiFactory.RuntimeOptionCategoryElement element) {
|
public RuntimeOptionGuiHandler getHandlerFor(IModGuiFactory.RuntimeOptionCategoryElement element)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,16 @@ import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyCircleRenderer;
|
||||||
import WayofTime.bloodmagic.api.registry.AlchemyArrayRecipeRegistry;
|
import WayofTime.bloodmagic.api.registry.AlchemyArrayRecipeRegistry;
|
||||||
import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
||||||
|
|
||||||
public class RenderAlchemyArray extends TileEntitySpecialRenderer<TileAlchemyArray> {
|
public class RenderAlchemyArray extends TileEntitySpecialRenderer<TileAlchemyArray>
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileAlchemyArray alchemyArray, double x, double y, double z, float partialTicks, int destroyStage) {
|
public void renderTileEntityAt(TileAlchemyArray alchemyArray, double x, double y, double z, float partialTicks, int destroyStage)
|
||||||
ItemStack inputStack = alchemyArray.getStackInSlot(0);
|
{
|
||||||
int craftTime = alchemyArray.activeCounter;
|
ItemStack inputStack = alchemyArray.getStackInSlot(0);
|
||||||
AlchemyCircleRenderer renderer = AlchemyArrayRecipeRegistry.getAlchemyCircleRenderer(inputStack);
|
int craftTime = alchemyArray.activeCounter;
|
||||||
|
AlchemyCircleRenderer renderer = AlchemyArrayRecipeRegistry.getAlchemyCircleRenderer(inputStack);
|
||||||
|
|
||||||
renderer.renderAt(alchemyArray, x, y, z, (craftTime > 0 ? craftTime + partialTicks : 0));
|
renderer.renderAt(alchemyArray, x, y, z, (craftTime > 0 ? craftTime + partialTicks : 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,234 +10,264 @@ import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyCircleRenderer;
|
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyCircleRenderer;
|
||||||
|
|
||||||
public class BindingAlchemyCircleRenderer extends AlchemyCircleRenderer {
|
public class BindingAlchemyCircleRenderer extends AlchemyCircleRenderer
|
||||||
|
{
|
||||||
|
|
||||||
public float offsetFromFace = -0.9f;
|
public float offsetFromFace = -0.9f;
|
||||||
public final ResourceLocation arrayResource;
|
public final ResourceLocation arrayResource;
|
||||||
public final ResourceLocation[] arraysResources;
|
public final ResourceLocation[] arraysResources;
|
||||||
|
|
||||||
public static final int numberOfSweeps = 5;
|
|
||||||
public static final int startTime = 50;
|
|
||||||
public static final int sweepTime = 40;
|
|
||||||
|
|
||||||
public static final int inwardRotationTime = 50;
|
|
||||||
|
|
||||||
public static final float arcLength = (float) Math.sqrt(2*(2*2) - 2*2*2*Math.cos(2*Math.PI*2/5));
|
|
||||||
public static final float theta2 = (float) (18f * Math.PI / 180f);
|
|
||||||
|
|
||||||
public static final int endTime = 300;
|
|
||||||
|
|
||||||
public BindingAlchemyCircleRenderer() {
|
public static final int numberOfSweeps = 5;
|
||||||
this.arrayResource = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BindingArray.png");
|
public static final int startTime = 50;
|
||||||
arraysResources = new ResourceLocation[5];
|
public static final int sweepTime = 40;
|
||||||
arraysResources[0] = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BindingLightningArray.png");
|
|
||||||
arraysResources[1] = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BindingLightningArray.png");
|
|
||||||
arraysResources[2] = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BindingLightningArray.png");
|
|
||||||
arraysResources[3] = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BindingLightningArray.png");
|
|
||||||
arraysResources[4] = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BindingLightningArray.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getAngleOfCircle(int circle, float craftTime) {
|
public static final int inwardRotationTime = 50;
|
||||||
if (circle >= 0 && circle <= 4) {
|
|
||||||
float originalAngle = (float) (circle * 2 * Math.PI / 5d);
|
|
||||||
|
|
||||||
double sweep = (craftTime - startTime)/sweepTime;
|
|
||||||
if(sweep >= 0 && sweep < numberOfSweeps) {
|
|
||||||
float offset = ((int)sweep)*sweepTime + startTime;
|
|
||||||
originalAngle += 2*Math.PI*2/5*(int)sweep + getAngle(craftTime - offset, (int)sweep);
|
|
||||||
}else if(sweep >= numberOfSweeps)
|
|
||||||
{
|
|
||||||
originalAngle += 2*Math.PI*2/5*numberOfSweeps + (craftTime - 5*sweepTime - startTime)*2*Math.PI*2/5/sweepTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
return originalAngle;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
public static final float arcLength = (float) Math.sqrt(2 * (2 * 2) - 2 * 2 * 2 * Math.cos(2 * Math.PI * 2 / 5));
|
||||||
}
|
public static final float theta2 = (float) (18f * Math.PI / 180f);
|
||||||
|
|
||||||
public static float getAngle(float craftTime, int sweep) {
|
|
||||||
float rDP = craftTime/sweepTime*arcLength;
|
|
||||||
float rEnd = (float) Math.sqrt(rDP*rDP + 2*2 - 2*rDP*2*Math.cos(theta2));
|
|
||||||
return (float) (Math.acos((2*2 + rEnd*rEnd - rDP*rDP)/(2*rEnd*2)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public static final int endTime = 300;
|
||||||
* Returns the center-to-center distance of this circle.
|
|
||||||
*/
|
|
||||||
public static float getDistanceOfCircle(int circle, float craftTime) { //TODO Change this so it doesn't use angle, since it is a constant speed.
|
|
||||||
double sweep = (craftTime - startTime)/sweepTime;
|
|
||||||
if(sweep >= 0 && sweep < numberOfSweeps) {
|
|
||||||
float offset = ((int)sweep)*sweepTime + startTime;
|
|
||||||
float angle = getAngle(craftTime - offset, (int) sweep);
|
|
||||||
float thetaPrime = (float) (Math.PI - theta2 - angle);
|
|
||||||
// if(thetaPrime > 0 && thetaPrime < Math.PI) {
|
|
||||||
return (float) (2 * Math.sin(theta2) / Math.sin(thetaPrime));
|
|
||||||
// }
|
|
||||||
} else if(sweep >= numberOfSweeps && craftTime < endTime) {
|
|
||||||
return 2 - 2 * (craftTime - startTime - numberOfSweeps * sweepTime) / (endTime - startTime - numberOfSweeps * sweepTime);
|
|
||||||
} else if(craftTime >= endTime) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getRotation(int circle, float craftTime) {
|
public BindingAlchemyCircleRenderer()
|
||||||
float offset = 2;
|
{
|
||||||
if(circle == -1) {
|
this.arrayResource = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BindingArray.png");
|
||||||
return (float) (craftTime * 360 * 2/5/sweepTime);
|
arraysResources = new ResourceLocation[5];
|
||||||
}
|
arraysResources[0] = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BindingLightningArray.png");
|
||||||
if (craftTime >= offset) {
|
arraysResources[1] = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BindingLightningArray.png");
|
||||||
float modifier = (float) Math.pow(craftTime - offset, 1.5);
|
arraysResources[2] = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BindingLightningArray.png");
|
||||||
return modifier * 0.5f;
|
arraysResources[3] = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BindingLightningArray.png");
|
||||||
}
|
arraysResources[4] = new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BindingLightningArray.png");
|
||||||
return 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public float getSecondaryRotation(int circle, float craftTime) {
|
public static float getAngleOfCircle(int circle, float craftTime)
|
||||||
float offset = 50;
|
{
|
||||||
if (craftTime >= offset) {
|
if (circle >= 0 && circle <= 4)
|
||||||
float modifier = (float) Math.pow(craftTime - offset, 1.7);
|
{
|
||||||
return modifier * 0.5f;
|
float originalAngle = (float) (circle * 2 * Math.PI / 5d);
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getVerticalOffset(int circle, float craftTime) {
|
double sweep = (craftTime - startTime) / sweepTime;
|
||||||
if (circle >= 0 && circle <= 4) {
|
if (sweep >= 0 && sweep < numberOfSweeps)
|
||||||
if (craftTime >= 5) {
|
{
|
||||||
if (craftTime <= 40) {
|
float offset = ((int) sweep) * sweepTime + startTime;
|
||||||
return (float) ((-0.4) * Math.pow((craftTime - 5) / 35f, 3));
|
originalAngle += 2 * Math.PI * 2 / 5 * (int) sweep + getAngle(craftTime - offset, (int) sweep);
|
||||||
} else {
|
} else if (sweep >= numberOfSweeps)
|
||||||
return -0.4f;
|
{
|
||||||
}
|
originalAngle += 2 * Math.PI * 2 / 5 * numberOfSweeps + (craftTime - 5 * sweepTime - startTime) * 2 * Math.PI * 2 / 5 / sweepTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return originalAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (craftTime >= 5) {
|
return 0;
|
||||||
if (craftTime <= 40) {
|
}
|
||||||
return (float) ((-0.4) * Math.pow((craftTime - 5) / 35f, 3));
|
|
||||||
} else {
|
|
||||||
return -0.4f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getInwardRotation(int circle, float craftTime) {
|
|
||||||
float offset = startTime + numberOfSweeps * sweepTime;
|
|
||||||
if(craftTime >= offset) {
|
|
||||||
if(craftTime <= offset + inwardRotationTime) {
|
|
||||||
return 90f / inwardRotationTime * (craftTime - offset);
|
|
||||||
} else {
|
|
||||||
return 90;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void renderAt(TileEntity tile, double x, double y, double z, float craftTime) {
|
public static float getAngle(float craftTime, int sweep)
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
{
|
||||||
WorldRenderer wr = tessellator.getWorldRenderer();
|
float rDP = craftTime / sweepTime * arcLength;
|
||||||
|
float rEnd = (float) Math.sqrt(rDP * rDP + 2 * 2 - 2 * rDP * 2 * Math.cos(theta2));
|
||||||
|
return (float) (Math.acos((2 * 2 + rEnd * rEnd - rDP * rDP) / (2 * rEnd * 2)));
|
||||||
|
}
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
/**
|
||||||
|
* Returns the center-to-center distance of this circle.
|
||||||
|
*/
|
||||||
|
public static float getDistanceOfCircle(int circle, float craftTime)
|
||||||
|
{ // TODO Change this so it doesn't use angle, since it is a constant speed.
|
||||||
|
double sweep = (craftTime - startTime) / sweepTime;
|
||||||
|
if (sweep >= 0 && sweep < numberOfSweeps)
|
||||||
|
{
|
||||||
|
float offset = ((int) sweep) * sweepTime + startTime;
|
||||||
|
float angle = getAngle(craftTime - offset, (int) sweep);
|
||||||
|
float thetaPrime = (float) (Math.PI - theta2 - angle);
|
||||||
|
// if(thetaPrime > 0 && thetaPrime < Math.PI) {
|
||||||
|
return (float) (2 * Math.sin(theta2) / Math.sin(thetaPrime));
|
||||||
|
// }
|
||||||
|
} else if (sweep >= numberOfSweeps && craftTime < endTime)
|
||||||
|
{
|
||||||
|
return 2 - 2 * (craftTime - startTime - numberOfSweeps * sweepTime) / (endTime - startTime - numberOfSweeps * sweepTime);
|
||||||
|
} else if (craftTime >= endTime)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
float rot = getRotation(-1, craftTime);
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
float size = 3.0F;
|
public float getRotation(int circle, float craftTime)
|
||||||
|
{
|
||||||
|
float offset = 2;
|
||||||
|
if (circle == -1)
|
||||||
|
{
|
||||||
|
return (float) (craftTime * 360 * 2 / 5 / sweepTime);
|
||||||
|
}
|
||||||
|
if (craftTime >= offset)
|
||||||
|
{
|
||||||
|
float modifier = (float) Math.pow(craftTime - offset, 1.5);
|
||||||
|
return modifier * 0.5f;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Bind the texture to the circle
|
public float getSecondaryRotation(int circle, float craftTime)
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(arrayResource);
|
{
|
||||||
|
float offset = 50;
|
||||||
|
if (craftTime >= offset)
|
||||||
|
{
|
||||||
|
float modifier = (float) Math.pow(craftTime - offset, 1.7);
|
||||||
|
return modifier * 0.5f;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
GlStateManager.disableCull();
|
public float getVerticalOffset(int circle, float craftTime)
|
||||||
GlStateManager.enableBlend();
|
{
|
||||||
GlStateManager.blendFunc(770, 1);
|
if (circle >= 0 && circle <= 4)
|
||||||
|
{
|
||||||
|
if (craftTime >= 5)
|
||||||
|
{
|
||||||
|
if (craftTime <= 40)
|
||||||
|
{
|
||||||
|
return (float) ((-0.4) * Math.pow((craftTime - 5) / 35f, 3));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return -0.4f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GlStateManager.translate(x, y, z);
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
EnumFacing sideHit = EnumFacing.UP; // Specify which face this "circle"
|
if (craftTime >= 5)
|
||||||
// is located on
|
{
|
||||||
GlStateManager.translate(sideHit.getFrontOffsetX() * offsetFromFace, sideHit.getFrontOffsetY() * offsetFromFace, sideHit.getFrontOffsetZ() * offsetFromFace);
|
if (craftTime <= 40)
|
||||||
|
{
|
||||||
|
return (float) ((-0.4) * Math.pow((craftTime - 5) / 35f, 3));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return -0.4f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
switch (sideHit) {
|
public float getInwardRotation(int circle, float craftTime)
|
||||||
case DOWN:
|
{
|
||||||
GlStateManager.translate(0, 0, 1);
|
float offset = startTime + numberOfSweeps * sweepTime;
|
||||||
GlStateManager.rotate(-90.0f, 1, 0, 0);
|
if (craftTime >= offset)
|
||||||
break;
|
{
|
||||||
case EAST:
|
if (craftTime <= offset + inwardRotationTime)
|
||||||
GlStateManager.rotate(-90.0f, 0, 1, 0);
|
{
|
||||||
GlStateManager.translate(0, 0, -1);
|
return 90f / inwardRotationTime * (craftTime - offset);
|
||||||
break;
|
} else
|
||||||
case NORTH:
|
{
|
||||||
break;
|
return 90;
|
||||||
case SOUTH:
|
}
|
||||||
GlStateManager.rotate(180.0f, 0, 1, 0);
|
}
|
||||||
GlStateManager.translate(-1, 0, -1);
|
|
||||||
break;
|
|
||||||
case UP:
|
|
||||||
GlStateManager.translate(0, 1, 0);
|
|
||||||
GlStateManager.rotate(90.0f, 1, 0, 0);
|
|
||||||
break;
|
|
||||||
case WEST:
|
|
||||||
GlStateManager.translate(0, 0, 1);
|
|
||||||
GlStateManager.rotate(90.0f, 0, 1, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
return 0;
|
||||||
GlStateManager.translate(0.5f, 0.5f, getVerticalOffset(craftTime));
|
}
|
||||||
|
|
||||||
double var31 = 0.0D;
|
public void renderAt(TileEntity tile, double x, double y, double z, float craftTime)
|
||||||
double var33 = 1.0D;
|
{
|
||||||
double var35 = 0;
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
double var37 = 1;
|
WorldRenderer wr = tessellator.getWorldRenderer();
|
||||||
|
|
||||||
// GlStateManager.color(0.5f, 1f, 1f, 1f);
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.pushMatrix();
|
|
||||||
GlStateManager.rotate(rot, 0, 0, 1);
|
|
||||||
|
|
||||||
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
|
float rot = getRotation(-1, craftTime);
|
||||||
// wr.setBrightness(200);
|
|
||||||
wr.pos(size / 2f, size / 2f, 0.0D).tex(var33, var37).endVertex();
|
|
||||||
wr.pos(size / 2f, -size / 2f, 0.0D).tex(var33, var35).endVertex();
|
|
||||||
wr.pos(-size / 2f, -size / 2f, 0.0D).tex(var31, var35).endVertex();
|
|
||||||
wr.pos(-size / 2f, size / 2f, 0.0D).tex(var31, var37).endVertex();
|
|
||||||
tessellator.draw();
|
|
||||||
GlStateManager.popMatrix();
|
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
float size = 3.0F;
|
||||||
GlStateManager.pushMatrix();
|
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(arraysResources[i]);
|
|
||||||
float newSize = 1;
|
|
||||||
float distance = this.getDistanceOfCircle(i, craftTime);
|
|
||||||
float angle = this.getAngleOfCircle(i, craftTime);
|
|
||||||
float rotation = this.getRotation(i, craftTime);
|
|
||||||
|
|
||||||
GlStateManager.translate(distance * Math.sin(angle), -distance * Math.cos(angle), this.getVerticalOffset(i, craftTime));
|
|
||||||
GlStateManager.rotate(i * 360/5, 0, 0, 1);
|
|
||||||
GlStateManager.rotate(getInwardRotation(i, craftTime), 1, 0, 0);
|
|
||||||
GlStateManager.rotate(rotation, 0, 0, 1);
|
|
||||||
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
|
|
||||||
wr.pos(newSize / 2f, newSize / 2f, 0.0D).tex(var33, var37).endVertex();
|
|
||||||
wr.pos(newSize / 2f, -newSize / 2f, 0.0D).tex(var33, var35).endVertex();
|
|
||||||
wr.pos(-newSize / 2f, -newSize / 2f, 0.0D).tex(var31, var35).endVertex();
|
|
||||||
wr.pos(-newSize / 2f, newSize / 2f, 0.0D).tex(var31, var37).endVertex();
|
|
||||||
tessellator.draw();
|
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
// Bind the texture to the circle
|
||||||
}
|
Minecraft.getMinecraft().renderEngine.bindTexture(arrayResource);
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.disableCull();
|
||||||
|
GlStateManager.enableBlend();
|
||||||
|
GlStateManager.blendFunc(770, 1);
|
||||||
|
|
||||||
// GlStateManager.depthMask(true);
|
GlStateManager.translate(x, y, z);
|
||||||
GlStateManager.disableBlend();
|
|
||||||
GlStateManager.enableCull();
|
|
||||||
// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
EnumFacing sideHit = EnumFacing.UP; // Specify which face this "circle"
|
||||||
}
|
// is located on
|
||||||
|
GlStateManager.translate(sideHit.getFrontOffsetX() * offsetFromFace, sideHit.getFrontOffsetY() * offsetFromFace, sideHit.getFrontOffsetZ() * offsetFromFace);
|
||||||
|
|
||||||
|
switch (sideHit)
|
||||||
|
{
|
||||||
|
case DOWN:
|
||||||
|
GlStateManager.translate(0, 0, 1);
|
||||||
|
GlStateManager.rotate(-90.0f, 1, 0, 0);
|
||||||
|
break;
|
||||||
|
case EAST:
|
||||||
|
GlStateManager.rotate(-90.0f, 0, 1, 0);
|
||||||
|
GlStateManager.translate(0, 0, -1);
|
||||||
|
break;
|
||||||
|
case NORTH:
|
||||||
|
break;
|
||||||
|
case SOUTH:
|
||||||
|
GlStateManager.rotate(180.0f, 0, 1, 0);
|
||||||
|
GlStateManager.translate(-1, 0, -1);
|
||||||
|
break;
|
||||||
|
case UP:
|
||||||
|
GlStateManager.translate(0, 1, 0);
|
||||||
|
GlStateManager.rotate(90.0f, 1, 0, 0);
|
||||||
|
break;
|
||||||
|
case WEST:
|
||||||
|
GlStateManager.translate(0, 0, 1);
|
||||||
|
GlStateManager.rotate(90.0f, 0, 1, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
GlStateManager.translate(0.5f, 0.5f, getVerticalOffset(craftTime));
|
||||||
|
|
||||||
|
double var31 = 0.0D;
|
||||||
|
double var33 = 1.0D;
|
||||||
|
double var35 = 0;
|
||||||
|
double var37 = 1;
|
||||||
|
|
||||||
|
// GlStateManager.color(0.5f, 1f, 1f, 1f);
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
GlStateManager.rotate(rot, 0, 0, 1);
|
||||||
|
|
||||||
|
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||||
|
// wr.setBrightness(200);
|
||||||
|
wr.pos(size / 2f, size / 2f, 0.0D).tex(var33, var37).endVertex();
|
||||||
|
wr.pos(size / 2f, -size / 2f, 0.0D).tex(var33, var35).endVertex();
|
||||||
|
wr.pos(-size / 2f, -size / 2f, 0.0D).tex(var31, var35).endVertex();
|
||||||
|
wr.pos(-size / 2f, size / 2f, 0.0D).tex(var31, var37).endVertex();
|
||||||
|
tessellator.draw();
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
Minecraft.getMinecraft().renderEngine.bindTexture(arraysResources[i]);
|
||||||
|
float newSize = 1;
|
||||||
|
float distance = this.getDistanceOfCircle(i, craftTime);
|
||||||
|
float angle = this.getAngleOfCircle(i, craftTime);
|
||||||
|
float rotation = this.getRotation(i, craftTime);
|
||||||
|
|
||||||
|
GlStateManager.translate(distance * Math.sin(angle), -distance * Math.cos(angle), this.getVerticalOffset(i, craftTime));
|
||||||
|
GlStateManager.rotate(i * 360 / 5, 0, 0, 1);
|
||||||
|
GlStateManager.rotate(getInwardRotation(i, craftTime), 1, 0, 0);
|
||||||
|
GlStateManager.rotate(rotation, 0, 0, 1);
|
||||||
|
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||||
|
wr.pos(newSize / 2f, newSize / 2f, 0.0D).tex(var33, var37).endVertex();
|
||||||
|
wr.pos(newSize / 2f, -newSize / 2f, 0.0D).tex(var33, var35).endVertex();
|
||||||
|
wr.pos(-newSize / 2f, -newSize / 2f, 0.0D).tex(var31, var35).endVertex();
|
||||||
|
wr.pos(-newSize / 2f, newSize / 2f, 0.0D).tex(var31, var37).endVertex();
|
||||||
|
tessellator.draw();
|
||||||
|
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
|
// GlStateManager.depthMask(true);
|
||||||
|
GlStateManager.disableBlend();
|
||||||
|
GlStateManager.enableCull();
|
||||||
|
// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,7 +3,8 @@ package WayofTime.bloodmagic.compat;
|
||||||
/**
|
/**
|
||||||
* Implement on all primary compatibility classes.
|
* Implement on all primary compatibility classes.
|
||||||
*/
|
*/
|
||||||
public interface ICompatibility {
|
public interface ICompatibility
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after the given {@code modid} has been verified as loaded.
|
* Called after the given {@code modid} has been verified as loaded.
|
||||||
|
@ -16,8 +17,9 @@ public interface ICompatibility {
|
||||||
String getModId();
|
String getModId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not compatibility should be loaded even if the mod were to be found.
|
* Whether or not compatibility should be loaded even if the mod were to be
|
||||||
*
|
* found.
|
||||||
|
*
|
||||||
* Generally a determined by a config option.
|
* Generally a determined by a config option.
|
||||||
*/
|
*/
|
||||||
boolean enableCompat();
|
boolean enableCompat();
|
||||||
|
|
|
@ -18,28 +18,23 @@ import net.minecraft.item.ItemStack;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
@JEIPlugin
|
@JEIPlugin
|
||||||
public class BloodMagicPlugin implements IModPlugin {
|
public class BloodMagicPlugin implements IModPlugin
|
||||||
|
{
|
||||||
|
|
||||||
public static IJeiHelpers jeiHelper;
|
public static IJeiHelpers jeiHelper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isModLoaded() {
|
public boolean isModLoaded()
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(IModRegistry registry) {
|
public void register(IModRegistry registry)
|
||||||
registry.addRecipeCategories(
|
{
|
||||||
new AltarRecipeCategory(),
|
registry.addRecipeCategories(new AltarRecipeCategory(), new BindingRecipeCategory(), new AlchemyArrayCraftingCategory());
|
||||||
new BindingRecipeCategory(),
|
|
||||||
new AlchemyArrayCraftingCategory()
|
|
||||||
);
|
|
||||||
|
|
||||||
registry.addRecipeHandlers(
|
registry.addRecipeHandlers(new AltarRecipeHandler(), new BindingRecipeHandler(), new AlchemyArrayCraftingRecipeHandler());
|
||||||
new AltarRecipeHandler(),
|
|
||||||
new BindingRecipeHandler(),
|
|
||||||
new AlchemyArrayCraftingRecipeHandler()
|
|
||||||
);
|
|
||||||
|
|
||||||
registry.addRecipes(AltarRecipeMaker.getRecipes());
|
registry.addRecipes(AltarRecipeMaker.getRecipes());
|
||||||
registry.addRecipes(BindingRecipeMaker.getRecipes());
|
registry.addRecipes(BindingRecipeMaker.getRecipes());
|
||||||
|
@ -49,19 +44,22 @@ public class BloodMagicPlugin implements IModPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onJeiHelpersAvailable(IJeiHelpers jeiHelpers) {
|
public void onJeiHelpersAvailable(IJeiHelpers jeiHelpers)
|
||||||
|
{
|
||||||
jeiHelper = jeiHelpers;
|
jeiHelper = jeiHelpers;
|
||||||
|
|
||||||
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.bloodLight));
|
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.bloodLight));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemRegistryAvailable(IItemRegistry itemRegistry) {
|
public void onItemRegistryAvailable(IItemRegistry itemRegistry)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRecipeRegistryAvailable(IRecipeRegistry recipeRegistry) {
|
public void onRecipeRegistryAvailable(IRecipeRegistry recipeRegistry)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,15 +6,18 @@ import net.minecraftforge.fluids.FluidStack;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class BloodMagicRecipeWrapper implements IRecipeWrapper {
|
public abstract class BloodMagicRecipeWrapper implements IRecipeWrapper
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FluidStack> getFluidInputs() {
|
public List<FluidStack> getFluidInputs()
|
||||||
|
{
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FluidStack> getFluidOutputs() {
|
public List<FluidStack> getFluidOutputs()
|
||||||
|
{
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,20 +2,24 @@ package WayofTime.bloodmagic.compat.jei;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.compat.ICompatibility;
|
import WayofTime.bloodmagic.compat.ICompatibility;
|
||||||
|
|
||||||
public class CompatibilityJustEnoughItems implements ICompatibility {
|
public class CompatibilityJustEnoughItems implements ICompatibility
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadCompatibility() {
|
public void loadCompatibility()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModId() {
|
public String getModId()
|
||||||
|
{
|
||||||
return "JEI";
|
return "JEI";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean enableCompat() {
|
public boolean enableCompat()
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class AlchemyArrayCraftingCategory implements IRecipeCategory {
|
public class AlchemyArrayCraftingCategory implements IRecipeCategory
|
||||||
|
{
|
||||||
|
|
||||||
private static final int INPUT_SLOT = 0;
|
private static final int INPUT_SLOT = 0;
|
||||||
private static final int CATALYST_SLOT = 1;
|
private static final int CATALYST_SLOT = 1;
|
||||||
|
@ -26,41 +27,48 @@ public class AlchemyArrayCraftingCategory implements IRecipeCategory {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getUid() {
|
public String getUid()
|
||||||
|
{
|
||||||
return Constants.Compat.JEI_CATEGORY_ALCHEMYARRAY;
|
return Constants.Compat.JEI_CATEGORY_ALCHEMYARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle()
|
||||||
|
{
|
||||||
return localizedName;
|
return localizedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IDrawable getBackground() {
|
public IDrawable getBackground()
|
||||||
|
{
|
||||||
return background;
|
return background;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawExtras(Minecraft minecraft) {
|
public void drawExtras(Minecraft minecraft)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawAnimations(Minecraft minecraft) {
|
public void drawAnimations(Minecraft minecraft)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper)
|
||||||
|
{
|
||||||
|
|
||||||
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 5);
|
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 5);
|
||||||
recipeLayout.getItemStacks().init(CATALYST_SLOT, true, 50, 5);
|
recipeLayout.getItemStacks().init(CATALYST_SLOT, true, 50, 5);
|
||||||
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 73, 5);
|
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 73, 5);
|
||||||
|
|
||||||
if (recipeWrapper instanceof AlchemyArrayCraftingRecipeJEI) {
|
if (recipeWrapper instanceof AlchemyArrayCraftingRecipeJEI)
|
||||||
|
{
|
||||||
AlchemyArrayCraftingRecipeJEI alchemyArrayWrapper = (AlchemyArrayCraftingRecipeJEI) recipeWrapper;
|
AlchemyArrayCraftingRecipeJEI alchemyArrayWrapper = (AlchemyArrayCraftingRecipeJEI) recipeWrapper;
|
||||||
recipeLayout.getItemStacks().set(INPUT_SLOT, (ItemStack) alchemyArrayWrapper.getInputs().get(0));
|
recipeLayout.getItemStacks().set(INPUT_SLOT, (ItemStack) alchemyArrayWrapper.getInputs().get(0));
|
||||||
recipeLayout.getItemStacks().set(CATALYST_SLOT, (ItemStack) alchemyArrayWrapper.getInputs().get(1));
|
recipeLayout.getItemStacks().set(CATALYST_SLOT, (ItemStack) alchemyArrayWrapper.getInputs().get(1));
|
||||||
|
@ -68,4 +76,3 @@ public class AlchemyArrayCraftingCategory implements IRecipeCategory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,28 +6,33 @@ import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class AlchemyArrayCraftingRecipeHandler implements IRecipeHandler<AlchemyArrayCraftingRecipeJEI> {
|
public class AlchemyArrayCraftingRecipeHandler implements IRecipeHandler<AlchemyArrayCraftingRecipeJEI>
|
||||||
|
{
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Class<AlchemyArrayCraftingRecipeJEI> getRecipeClass() {
|
public Class<AlchemyArrayCraftingRecipeJEI> getRecipeClass()
|
||||||
|
{
|
||||||
return AlchemyArrayCraftingRecipeJEI.class;
|
return AlchemyArrayCraftingRecipeJEI.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeCategoryUid() {
|
public String getRecipeCategoryUid()
|
||||||
|
{
|
||||||
return Constants.Compat.JEI_CATEGORY_ALCHEMYARRAY;
|
return Constants.Compat.JEI_CATEGORY_ALCHEMYARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IRecipeWrapper getRecipeWrapper(@Nonnull AlchemyArrayCraftingRecipeJEI recipe) {
|
public IRecipeWrapper getRecipeWrapper(@Nonnull AlchemyArrayCraftingRecipeJEI recipe)
|
||||||
|
{
|
||||||
return recipe;
|
return recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRecipeValid(@Nonnull AlchemyArrayCraftingRecipeJEI recipe) {
|
public boolean isRecipeValid(@Nonnull AlchemyArrayCraftingRecipeJEI recipe)
|
||||||
|
{
|
||||||
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0;
|
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ import javax.annotation.Nullable;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class AlchemyArrayCraftingRecipeJEI extends BloodMagicRecipeWrapper {
|
public class AlchemyArrayCraftingRecipeJEI extends BloodMagicRecipeWrapper
|
||||||
|
{
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private final List<ItemStack> inputs;
|
private final List<ItemStack> inputs;
|
||||||
|
@ -19,28 +20,33 @@ public class AlchemyArrayCraftingRecipeJEI extends BloodMagicRecipeWrapper {
|
||||||
private final ItemStack output;
|
private final ItemStack output;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public AlchemyArrayCraftingRecipeJEI(@Nonnull ItemStack input, @Nullable ItemStack catalyst, @Nonnull ItemStack output) {
|
public AlchemyArrayCraftingRecipeJEI(@Nonnull ItemStack input, @Nullable ItemStack catalyst, @Nonnull ItemStack output)
|
||||||
this.inputs = Arrays.asList(new ItemStack[] {input, catalyst});
|
{
|
||||||
|
this.inputs = Arrays.asList(new ItemStack[] { input, catalyst });
|
||||||
this.output = output;
|
this.output = output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List getInputs() {
|
public List getInputs()
|
||||||
|
{
|
||||||
return inputs;
|
return inputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List getOutputs() {
|
public List getOutputs()
|
||||||
|
{
|
||||||
return Collections.singletonList(output);
|
return Collections.singletonList(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,21 +12,26 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class AlchemyArrayCraftingRecipeMaker {
|
public class AlchemyArrayCraftingRecipeMaker
|
||||||
|
{
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static List<AlchemyArrayCraftingRecipeJEI> getRecipes() {
|
public static List<AlchemyArrayCraftingRecipeJEI> getRecipes()
|
||||||
|
{
|
||||||
Map<ItemStackWrapper, AlchemyArrayRecipeRegistry.AlchemyArrayRecipe> alchemyArrayRecipeMap = AlchemyArrayRecipeRegistry.getRecipes();
|
Map<ItemStackWrapper, AlchemyArrayRecipeRegistry.AlchemyArrayRecipe> alchemyArrayRecipeMap = AlchemyArrayRecipeRegistry.getRecipes();
|
||||||
|
|
||||||
ArrayList<AlchemyArrayCraftingRecipeJEI> recipes = new ArrayList<AlchemyArrayCraftingRecipeJEI>();
|
ArrayList<AlchemyArrayCraftingRecipeJEI> recipes = new ArrayList<AlchemyArrayCraftingRecipeJEI>();
|
||||||
|
|
||||||
for (Map.Entry<ItemStackWrapper, AlchemyArrayRecipeRegistry.AlchemyArrayRecipe> itemStackAlchemyArrayRecipeEntry : alchemyArrayRecipeMap.entrySet()) {
|
for (Map.Entry<ItemStackWrapper, AlchemyArrayRecipeRegistry.AlchemyArrayRecipe> itemStackAlchemyArrayRecipeEntry : alchemyArrayRecipeMap.entrySet())
|
||||||
|
{
|
||||||
ItemStack input = itemStackAlchemyArrayRecipeEntry.getValue().getInputStack();
|
ItemStack input = itemStackAlchemyArrayRecipeEntry.getValue().getInputStack();
|
||||||
BiMap<ItemStackWrapper, AlchemyArrayEffect> catalystMap = itemStackAlchemyArrayRecipeEntry.getValue().catalystMap;
|
BiMap<ItemStackWrapper, AlchemyArrayEffect> catalystMap = itemStackAlchemyArrayRecipeEntry.getValue().catalystMap;
|
||||||
|
|
||||||
for(Map.Entry<ItemStackWrapper, AlchemyArrayEffect> entry : catalystMap.entrySet()) {
|
for (Map.Entry<ItemStackWrapper, AlchemyArrayEffect> entry : catalystMap.entrySet())
|
||||||
|
{
|
||||||
ItemStack catalyst = entry.getKey().toStack();
|
ItemStack catalyst = entry.getKey().toStack();
|
||||||
if (AlchemyArrayRecipeRegistry.getAlchemyArrayEffect(input, catalyst) instanceof AlchemyArrayEffectCrafting) {
|
if (AlchemyArrayRecipeRegistry.getAlchemyArrayEffect(input, catalyst) instanceof AlchemyArrayEffectCrafting)
|
||||||
|
{
|
||||||
ItemStack output = ((AlchemyArrayEffectCrafting) itemStackAlchemyArrayRecipeEntry.getValue().getAlchemyArrayEffectForCatalyst(catalyst)).getOutputStack();
|
ItemStack output = ((AlchemyArrayEffectCrafting) itemStackAlchemyArrayRecipeEntry.getValue().getAlchemyArrayEffectForCatalyst(catalyst)).getOutputStack();
|
||||||
|
|
||||||
AlchemyArrayCraftingRecipeJEI recipe = new AlchemyArrayCraftingRecipeJEI(input, catalyst, output);
|
AlchemyArrayCraftingRecipeJEI recipe = new AlchemyArrayCraftingRecipeJEI(input, catalyst, output);
|
||||||
|
|
|
@ -13,7 +13,8 @@ import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class AltarRecipeCategory implements IRecipeCategory {
|
public class AltarRecipeCategory implements IRecipeCategory
|
||||||
|
{
|
||||||
|
|
||||||
private static final int INPUT_SLOT = 0;
|
private static final int INPUT_SLOT = 0;
|
||||||
private static final int OUTPUT_SLOT = 1;
|
private static final int OUTPUT_SLOT = 1;
|
||||||
|
@ -25,40 +26,47 @@ public class AltarRecipeCategory implements IRecipeCategory {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getUid() {
|
public String getUid()
|
||||||
|
{
|
||||||
return Constants.Compat.JEI_CATEGORY_ALTAR;
|
return Constants.Compat.JEI_CATEGORY_ALTAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle()
|
||||||
|
{
|
||||||
return localizedName;
|
return localizedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IDrawable getBackground() {
|
public IDrawable getBackground()
|
||||||
|
{
|
||||||
return background;
|
return background;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawExtras(Minecraft minecraft) {
|
public void drawExtras(Minecraft minecraft)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawAnimations(Minecraft minecraft) {
|
public void drawAnimations(Minecraft minecraft)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper)
|
||||||
|
{
|
||||||
|
|
||||||
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 31, 0);
|
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 31, 0);
|
||||||
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 125, 30);
|
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 125, 30);
|
||||||
|
|
||||||
if (recipeWrapper instanceof AltarRecipeJEI) {
|
if (recipeWrapper instanceof AltarRecipeJEI)
|
||||||
|
{
|
||||||
AltarRecipeJEI altarRecipeWrapper = (AltarRecipeJEI) recipeWrapper;
|
AltarRecipeJEI altarRecipeWrapper = (AltarRecipeJEI) recipeWrapper;
|
||||||
recipeLayout.getItemStacks().set(INPUT_SLOT, altarRecipeWrapper.getInputs());
|
recipeLayout.getItemStacks().set(INPUT_SLOT, altarRecipeWrapper.getInputs());
|
||||||
recipeLayout.getItemStacks().set(OUTPUT_SLOT, altarRecipeWrapper.getOutputs());
|
recipeLayout.getItemStacks().set(OUTPUT_SLOT, altarRecipeWrapper.getOutputs());
|
||||||
|
|
|
@ -6,28 +6,33 @@ import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class AltarRecipeHandler implements IRecipeHandler<AltarRecipeJEI> {
|
public class AltarRecipeHandler implements IRecipeHandler<AltarRecipeJEI>
|
||||||
|
{
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Class<AltarRecipeJEI> getRecipeClass() {
|
public Class<AltarRecipeJEI> getRecipeClass()
|
||||||
|
{
|
||||||
return AltarRecipeJEI.class;
|
return AltarRecipeJEI.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeCategoryUid() {
|
public String getRecipeCategoryUid()
|
||||||
|
{
|
||||||
return Constants.Compat.JEI_CATEGORY_ALTAR;
|
return Constants.Compat.JEI_CATEGORY_ALTAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IRecipeWrapper getRecipeWrapper(@Nonnull AltarRecipeJEI recipe) {
|
public IRecipeWrapper getRecipeWrapper(@Nonnull AltarRecipeJEI recipe)
|
||||||
|
{
|
||||||
return recipe;
|
return recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRecipeValid(@Nonnull AltarRecipeJEI recipe) {
|
public boolean isRecipeValid(@Nonnull AltarRecipeJEI recipe)
|
||||||
|
{
|
||||||
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0;
|
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ import java.awt.*;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class AltarRecipeJEI extends BloodMagicRecipeWrapper {
|
public class AltarRecipeJEI extends BloodMagicRecipeWrapper
|
||||||
|
{
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private final ItemStack input;
|
private final ItemStack input;
|
||||||
|
@ -20,31 +21,36 @@ public class AltarRecipeJEI extends BloodMagicRecipeWrapper {
|
||||||
|
|
||||||
private final String[] infoString;
|
private final String[] infoString;
|
||||||
|
|
||||||
public AltarRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack output, int tier, int requiredLP) {
|
public AltarRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack output, int tier, int requiredLP)
|
||||||
|
{
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
|
|
||||||
this.infoString = new String[]{TextHelper.localize("jei.BloodMagic.recipe.requiredTier", tier), TextHelper.localize("jei.BloodMagic.recipe.requiredLP", requiredLP)};
|
this.infoString = new String[] { TextHelper.localize("jei.BloodMagic.recipe.requiredTier", tier), TextHelper.localize("jei.BloodMagic.recipe.requiredLP", requiredLP) };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List getInputs() {
|
public List getInputs()
|
||||||
|
{
|
||||||
return Collections.singletonList(input);
|
return Collections.singletonList(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List getOutputs() {
|
public List getOutputs()
|
||||||
|
{
|
||||||
return Collections.singletonList(output);
|
return Collections.singletonList(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
|
||||||
|
{
|
||||||
minecraft.fontRendererObj.drawString(infoString[0], 90 - minecraft.fontRendererObj.getStringWidth(infoString[0]) / 2, 0, Color.gray.getRGB());
|
minecraft.fontRendererObj.drawString(infoString[0], 90 - minecraft.fontRendererObj.getStringWidth(infoString[0]) / 2, 0, Color.gray.getRGB());
|
||||||
minecraft.fontRendererObj.drawString(infoString[1], 90 - minecraft.fontRendererObj.getStringWidth(infoString[1]) / 2, 10, Color.gray.getRGB());
|
minecraft.fontRendererObj.drawString(infoString[1], 90 - minecraft.fontRendererObj.getStringWidth(infoString[1]) / 2, 10, Color.gray.getRGB());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,16 +8,21 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class AltarRecipeMaker {
|
public class AltarRecipeMaker
|
||||||
|
{
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static List<AltarRecipeJEI> getRecipes() {
|
public static List<AltarRecipeJEI> getRecipes()
|
||||||
|
{
|
||||||
Map<ItemStack, AltarRecipeRegistry.AltarRecipe> altarMap = AltarRecipeRegistry.getRecipes();
|
Map<ItemStack, AltarRecipeRegistry.AltarRecipe> altarMap = AltarRecipeRegistry.getRecipes();
|
||||||
|
|
||||||
ArrayList<AltarRecipeJEI> recipes = new ArrayList<AltarRecipeJEI>();
|
ArrayList<AltarRecipeJEI> recipes = new ArrayList<AltarRecipeJEI>();
|
||||||
|
|
||||||
for (Map.Entry<ItemStack, AltarRecipeRegistry.AltarRecipe> itemStackAltarRecipeEntry : altarMap.entrySet()) {
|
for (Map.Entry<ItemStack, AltarRecipeRegistry.AltarRecipe> itemStackAltarRecipeEntry : altarMap.entrySet())
|
||||||
if (itemStackAltarRecipeEntry.getValue().getOutput() != null) { // Make sure output is not null. If it is, the recipe is for a filling orb, and we don't want that.
|
{
|
||||||
|
if (itemStackAltarRecipeEntry.getValue().getOutput() != null)
|
||||||
|
{ // Make sure output is not null. If it is, the recipe is for a
|
||||||
|
// filling orb, and we don't want that.
|
||||||
ItemStack input = itemStackAltarRecipeEntry.getKey();
|
ItemStack input = itemStackAltarRecipeEntry.getKey();
|
||||||
ItemStack output = itemStackAltarRecipeEntry.getValue().getOutput();
|
ItemStack output = itemStackAltarRecipeEntry.getValue().getOutput();
|
||||||
int requiredTier = itemStackAltarRecipeEntry.getValue().getMinTier().toInt();
|
int requiredTier = itemStackAltarRecipeEntry.getValue().getMinTier().toInt();
|
||||||
|
|
|
@ -13,7 +13,8 @@ import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class BindingRecipeCategory implements IRecipeCategory {
|
public class BindingRecipeCategory implements IRecipeCategory
|
||||||
|
{
|
||||||
|
|
||||||
private static final int INPUT_SLOT = 0;
|
private static final int INPUT_SLOT = 0;
|
||||||
private static final int CATALYST_SLOT = 1;
|
private static final int CATALYST_SLOT = 1;
|
||||||
|
@ -26,41 +27,48 @@ public class BindingRecipeCategory implements IRecipeCategory {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getUid() {
|
public String getUid()
|
||||||
|
{
|
||||||
return Constants.Compat.JEI_CATEGORY_BINDING;
|
return Constants.Compat.JEI_CATEGORY_BINDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle()
|
||||||
|
{
|
||||||
return localizedName;
|
return localizedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IDrawable getBackground() {
|
public IDrawable getBackground()
|
||||||
|
{
|
||||||
return background;
|
return background;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawExtras(Minecraft minecraft) {
|
public void drawExtras(Minecraft minecraft)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawAnimations(Minecraft minecraft) {
|
public void drawAnimations(Minecraft minecraft)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper)
|
||||||
|
{
|
||||||
|
|
||||||
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 5);
|
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 5);
|
||||||
recipeLayout.getItemStacks().init(CATALYST_SLOT, true, 50, 5);
|
recipeLayout.getItemStacks().init(CATALYST_SLOT, true, 50, 5);
|
||||||
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 73, 5);
|
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 73, 5);
|
||||||
|
|
||||||
if (recipeWrapper instanceof BindingRecipeJEI) {
|
if (recipeWrapper instanceof BindingRecipeJEI)
|
||||||
|
{
|
||||||
BindingRecipeJEI bindingRecipe = (BindingRecipeJEI) recipeWrapper;
|
BindingRecipeJEI bindingRecipe = (BindingRecipeJEI) recipeWrapper;
|
||||||
recipeLayout.getItemStacks().set(INPUT_SLOT, (ItemStack) bindingRecipe.getInputs().get(0));
|
recipeLayout.getItemStacks().set(INPUT_SLOT, (ItemStack) bindingRecipe.getInputs().get(0));
|
||||||
recipeLayout.getItemStacks().set(CATALYST_SLOT, (ItemStack) bindingRecipe.getInputs().get(1));
|
recipeLayout.getItemStacks().set(CATALYST_SLOT, (ItemStack) bindingRecipe.getInputs().get(1));
|
||||||
|
|
|
@ -6,28 +6,33 @@ import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class BindingRecipeHandler implements IRecipeHandler<BindingRecipeJEI> {
|
public class BindingRecipeHandler implements IRecipeHandler<BindingRecipeJEI>
|
||||||
|
{
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Class<BindingRecipeJEI> getRecipeClass() {
|
public Class<BindingRecipeJEI> getRecipeClass()
|
||||||
|
{
|
||||||
return BindingRecipeJEI.class;
|
return BindingRecipeJEI.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeCategoryUid() {
|
public String getRecipeCategoryUid()
|
||||||
|
{
|
||||||
return Constants.Compat.JEI_CATEGORY_BINDING;
|
return Constants.Compat.JEI_CATEGORY_BINDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IRecipeWrapper getRecipeWrapper(@Nonnull BindingRecipeJEI recipe) {
|
public IRecipeWrapper getRecipeWrapper(@Nonnull BindingRecipeJEI recipe)
|
||||||
|
{
|
||||||
return recipe;
|
return recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRecipeValid(@Nonnull BindingRecipeJEI recipe) {
|
public boolean isRecipeValid(@Nonnull BindingRecipeJEI recipe)
|
||||||
|
{
|
||||||
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0;
|
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue