mirror of
https://github.com/Ilya3point999K/ThaumicConcilium.git
synced 2026-11-14 00:14:06 +00:00
1.1.0 pre-release
This commit is contained in:
1 parent
91b0fccd5a
commit
b22ff8d17c
392 files changed
+6110
-13488
No files matched your search
Binary file not shown.
Binary file not shown.
+10
-9
@@ -33,16 +33,10 @@ minecraft {
|
||||
replace "@VERSION@", project.version
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
compile name: 'Baubles-1.7.10-1.0.1.10-dev'
|
||||
compile name: 'Thaumcraft-deobf-1.7.10-4.2.3.5'
|
||||
compile name: 'Forbidden+Magic-1.7.10-0.575'
|
||||
compile name: 'ThaumicTinkerer-2.5-1.7.10-164'
|
||||
compile name: 'CraftTweaker-1.7.10-3.0.13-deobf'
|
||||
compile name: 'witchery-1.7.10-0.24.1'
|
||||
compile name: '1.7.10_AM2-1.4.0.009'
|
||||
compile name: 'Botania r1.8-249'
|
||||
compile fileTree(dir: 'deps', include: '*.jar')
|
||||
compileOnly files('alfheim/Alfheim-63.jar')
|
||||
compileOnly files('alfheim/1.7.10-ASJCore-1.5.2.2.jar')
|
||||
}
|
||||
|
||||
processResources {
|
||||
@@ -74,6 +68,7 @@ task sourcesJar(type: Jar) {
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
|
||||
artifacts {
|
||||
archives devJar
|
||||
archives sourcesJar
|
||||
@@ -85,3 +80,9 @@ jar {
|
||||
attributes 'FMLCorePlugin': 'com.ilya3point999k.thaumicconcilium.core.ThaumicConciliumCore'
|
||||
}
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady { graph ->
|
||||
if (graph.hasTask(":runClient")) {
|
||||
runClient.args "--username", "Ilya3000"
|
||||
}
|
||||
}
|
||||
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -1,38 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
@Cancelable
|
||||
public class AddToNetworkEvent extends Event
|
||||
{
|
||||
public String ownerNetwork;
|
||||
public int addedAmount;
|
||||
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,
|
||||
* 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 maximum Ceiling that the network can add to
|
||||
*/
|
||||
public AddToNetworkEvent(String ownerNetwork, int addedAmount, int maximum)
|
||||
{
|
||||
super();
|
||||
this.ownerNetwork = ownerNetwork;
|
||||
this.addedAmount = addedAmount;
|
||||
this.maximum = maximum;
|
||||
}
|
||||
|
||||
public String getOwnerNetwork()
|
||||
{
|
||||
return this.ownerNetwork;
|
||||
}
|
||||
|
||||
public int getAddedAmount()
|
||||
{
|
||||
return this.addedAmount;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
@Cancelable
|
||||
public class ItemBindEvent extends Event
|
||||
{
|
||||
public final EntityPlayer player;
|
||||
public String key;
|
||||
public ItemStack itemStack;
|
||||
|
||||
public ItemBindEvent(EntityPlayer player, String key, ItemStack itemStack)
|
||||
{
|
||||
super();
|
||||
this.player = player;
|
||||
this.key = key;
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class ItemDrainInContainerEvent extends SoulNetworkEvent
|
||||
{
|
||||
public ItemStack stack;
|
||||
public ItemDrainInContainerEvent(ItemStack stack, String ownerNetwork, int drainAmount)
|
||||
{
|
||||
super(ownerNetwork, drainAmount);
|
||||
this.stack = stack;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class ItemDrainNetworkEvent extends PlayerDrainNetworkEvent
|
||||
{
|
||||
public final ItemStack itemStack;
|
||||
public boolean shouldDamage; //If true, will damage regardless of if the network had enough inside it
|
||||
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
|
||||
*
|
||||
* @param player Player using the item
|
||||
* @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)
|
||||
{
|
||||
super(player, ownerNetwork, drainAmount);
|
||||
this.itemStack = itemStack;
|
||||
this.shouldDamage = false;
|
||||
this.damageAmount = (float)(drainAmount) / 100.0f;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class PlayerAddToNetworkEvent extends AddToNetworkEvent
|
||||
{
|
||||
public final EntityPlayer player;
|
||||
public ItemStack itemStack;
|
||||
public PlayerAddToNetworkEvent(EntityPlayer player, ItemStack itemStack, String ownerNetwork, int addedAmount, int maximum)
|
||||
{
|
||||
super(ownerNetwork, addedAmount, maximum);
|
||||
this.player = player;
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class PlayerDrainNetworkEvent extends SoulNetworkEvent
|
||||
{
|
||||
public final EntityPlayer player; //Player that activated the event
|
||||
public PlayerDrainNetworkEvent(EntityPlayer player, String ownerNetwork, int drainAmount)
|
||||
{
|
||||
super(ownerNetwork, drainAmount);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public EntityPlayer getPlayer()
|
||||
{
|
||||
return player;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
@Cancelable
|
||||
public class SacrificeKnifeUsedEvent extends Event
|
||||
{
|
||||
public final EntityPlayer player;
|
||||
public boolean shouldDrainHealth;
|
||||
public boolean shouldFillAltar;
|
||||
public final int healthDrained;
|
||||
|
||||
public SacrificeKnifeUsedEvent(EntityPlayer player, boolean shouldDrainHealth, boolean shouldFillAltar, int hp)
|
||||
{
|
||||
this.player = player;
|
||||
this.shouldDrainHealth = shouldDrainHealth;
|
||||
this.shouldFillAltar = shouldFillAltar;
|
||||
this.healthDrained = hp;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class SoulNetworkEvent extends Event
|
||||
{
|
||||
public String ownerNetwork;
|
||||
public int drainAmount;
|
||||
|
||||
public SoulNetworkEvent(String ownerNetwork, int drainAmount)
|
||||
{
|
||||
super();
|
||||
this.ownerNetwork = ownerNetwork;
|
||||
this.drainAmount = drainAmount;
|
||||
}
|
||||
|
||||
public String getOwnerNetwork()
|
||||
{
|
||||
return this.ownerNetwork;
|
||||
}
|
||||
|
||||
public int getDrainAmount()
|
||||
{
|
||||
return this.drainAmount;
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.api.event;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
/** Fired when a teleposer attempts to transpose two blocks. Use this to perform special cleanup or compensation,
|
||||
or cancel it entirely to prevent the transposition. */
|
||||
@Cancelable
|
||||
public class TeleposeEvent extends Event {
|
||||
|
||||
public final World initialWorld;
|
||||
public final int initialX;
|
||||
public final int initialY;
|
||||
public final int initialZ;
|
||||
|
||||
public final Block initialBlock;
|
||||
public final int initialMetadata;
|
||||
|
||||
public final World finalWorld;
|
||||
public final int finalX;
|
||||
public final int finalY;
|
||||
public final int finalZ;
|
||||
|
||||
public final Block finalBlock;
|
||||
public final int finalMetadata;
|
||||
|
||||
public TeleposeEvent(World wi, int xi, int yi, int zi, Block bi, int mi, World wf, int xf, int yf, int zf, Block bf, int mf) {
|
||||
initialWorld = wi;
|
||||
initialX = xi;
|
||||
initialY = yi;
|
||||
initialZ = zi;
|
||||
|
||||
initialBlock = bi;
|
||||
initialMetadata = mi;
|
||||
|
||||
finalWorld = wf;
|
||||
finalX = xf;
|
||||
finalY = yf;
|
||||
finalZ = zf;
|
||||
|
||||
finalBlock = bf;
|
||||
finalMetadata = mf;
|
||||
}
|
||||
|
||||
public TileEntity getInitialTile() {
|
||||
return initialWorld.getTileEntity(initialX, initialY, initialZ);
|
||||
}
|
||||
|
||||
public TileEntity getFinalTile() {
|
||||
return finalWorld.getTileEntity(finalX, finalY, finalZ);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.api.soulNetwork;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
|
||||
/**
|
||||
* Temporary class to hash-out how to create a network not completely tied to the player.
|
||||
*/
|
||||
public class ComplexNetworkHandler
|
||||
{
|
||||
public static String fileName = "config/BloodMagic/soulnetworkKeys";
|
||||
static HashMap<UUID, String> keyMap = new HashMap();
|
||||
public static UUID getUUIDFromPlayer(EntityPlayer player)
|
||||
{
|
||||
return player.getPersistentID();
|
||||
}
|
||||
|
||||
public static EntityPlayer getPlayerFromUUID(UUID uuid)
|
||||
{
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
GameProfile gameProfile;
|
||||
gameProfile = server.func_152358_ax().func_152652_a(uuid);
|
||||
String str = uuid.toString();
|
||||
//TODO ServerConfigurationManager d.createPlayerForUser
|
||||
UUID.fromString(str);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getKeyForPlayer(EntityPlayer player)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public static UUID getUUIDForKey(String key)
|
||||
{
|
||||
// if (MinecraftServer.getServer() == null)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// World world = MinecraftServer.getServer().worldServers[0];
|
||||
// UUIDKeyMap data = (UUIDKeyMap) world.loadItemData(UUIDKeyMap.class, key);
|
||||
//
|
||||
// if (data == null)
|
||||
// {
|
||||
// data = new UUIDKeyMap(key);
|
||||
// world.setItemData(key, data);
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String assignKeyToPlayer(EntityPlayer player)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void save()
|
||||
{
|
||||
keyMap.put(new UUID(0, 0), "test");
|
||||
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String json = gson.toJson(keyMap);
|
||||
Writer writer;
|
||||
try
|
||||
{
|
||||
writer = new FileWriter(fileName + ".json");
|
||||
writer.write(json);
|
||||
writer.close();
|
||||
} catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void load()
|
||||
{
|
||||
File save = new File(fileName + ".json");
|
||||
|
||||
if(save.canRead())
|
||||
{
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
||||
BufferedReader br;
|
||||
|
||||
try
|
||||
{
|
||||
br = new BufferedReader(new FileReader(save));
|
||||
HashMap schema = gson.fromJson(br, keyMap.getClass());
|
||||
|
||||
keyMap = schema;
|
||||
|
||||
if(keyMap != null)
|
||||
{
|
||||
for(Entry<UUID, String> entry : keyMap.entrySet())
|
||||
{
|
||||
System.out.println("" + entry.getValue() + " gave: "+ entry.getKey());
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
keyMap = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.api.soulNetwork;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class LifeEssenceNetwork extends net.minecraft.world.WorldSavedData
|
||||
{
|
||||
public int currentEssence;
|
||||
public int maxOrb;
|
||||
|
||||
public LifeEssenceNetwork(String par1Str)
|
||||
{
|
||||
super(par1Str);
|
||||
currentEssence = 0;
|
||||
maxOrb = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
currentEssence = nbttagcompound.getInteger("currentEssence");
|
||||
maxOrb = nbttagcompound.getInteger("maxOrb");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
nbttagcompound.setInteger("currentEssence", currentEssence);
|
||||
nbttagcompound.setInteger("maxOrb", maxOrb);
|
||||
}
|
||||
}
|
||||
@@ -1,442 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.api.soulNetwork;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import WayofTime.alchemicalWizardry.api.event.AddToNetworkEvent;
|
||||
import WayofTime.alchemicalWizardry.api.event.ItemBindEvent;
|
||||
import WayofTime.alchemicalWizardry.api.event.ItemDrainInContainerEvent;
|
||||
import WayofTime.alchemicalWizardry.api.event.ItemDrainNetworkEvent;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
|
||||
public class SoulNetworkHandler
|
||||
{
|
||||
public static boolean syphonFromNetworkWhileInContainer(ItemStack ist, int damageToBeDone)
|
||||
{
|
||||
String ownerName = "";
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
|
||||
{
|
||||
ownerName = ist.getTagCompound().getString("ownerName");
|
||||
}
|
||||
|
||||
ItemDrainInContainerEvent event = new ItemDrainInContainerEvent(ist, ownerName, damageToBeDone);
|
||||
|
||||
if(MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Result.DENY)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return syphonFromNetwork(event.ownerNetwork, event.drainAmount) >= damageToBeDone;
|
||||
}
|
||||
|
||||
public static int getCurrentMaxOrb(String ownerName)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
World world = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(ownerName);
|
||||
world.setItemData(ownerName, data);
|
||||
}
|
||||
|
||||
return data.maxOrb;
|
||||
}
|
||||
|
||||
public static void setMaxOrbToMax(String ownerName, int maxOrb)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
World world = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(ownerName);
|
||||
world.setItemData(ownerName, data);
|
||||
}
|
||||
|
||||
data.maxOrb = Math.max(maxOrb, data.maxOrb);
|
||||
data.markDirty();
|
||||
}
|
||||
|
||||
public static int getMaximumForOrbTier(int maxOrb)
|
||||
{
|
||||
switch(maxOrb)
|
||||
{
|
||||
case 1:
|
||||
return 5000;
|
||||
case 2:
|
||||
return 25000;
|
||||
case 3:
|
||||
return 150000;
|
||||
case 4:
|
||||
return 1000000;
|
||||
case 5:
|
||||
return 10000000;
|
||||
case 6:
|
||||
return 30000000;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static int syphonFromNetwork(ItemStack ist, int damageToBeDone)
|
||||
{
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
|
||||
{
|
||||
String ownerName = ist.getTagCompound().getString("ownerName");
|
||||
|
||||
return syphonFromNetwork(ownerName, damageToBeDone);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int syphonFromNetwork(String ownerName, int damageToBeDone)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
World world = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(ownerName);
|
||||
world.setItemData(ownerName, data);
|
||||
}
|
||||
|
||||
if (data.currentEssence >= damageToBeDone)
|
||||
{
|
||||
data.currentEssence -= damageToBeDone;
|
||||
data.markDirty();
|
||||
return damageToBeDone;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Master method used to syphon from the player's network, and will damage them accordingly if they do not have enough LP.
|
||||
* Does not drain on the client side.
|
||||
*
|
||||
* @param ist Owned itemStack
|
||||
* @param player Player using the item
|
||||
* @param drain
|
||||
* @return True if the action should be executed and false if it should not. Always returns false if client-sided.
|
||||
*/
|
||||
public static boolean syphonAndDamageFromNetwork(ItemStack ist, EntityPlayer player, int drain)
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
|
||||
{
|
||||
String ownerName = ist.getTagCompound().getString("ownerName");
|
||||
|
||||
ItemDrainNetworkEvent event = new ItemDrainNetworkEvent(player, ownerName, ist, drain);
|
||||
|
||||
if(MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int drainAmount = syphonFromNetwork(event.ownerNetwork, event.drainAmount);
|
||||
if(drainAmount == 0 || event.shouldDamage)
|
||||
{
|
||||
hurtPlayer(player, event.damageAmount);
|
||||
}
|
||||
|
||||
return (event.getResult() != Event.Result.DENY); //The event has been told to prevent the action but allow all repercussions of using the item.
|
||||
}
|
||||
|
||||
int amount = SoulNetworkHandler.syphonFromNetwork(ist, drain);
|
||||
|
||||
hurtPlayer(player, drain - amount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean syphonAndDamageFromNetwork(String ownerName, EntityPlayer player, int damageToBeDone)
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
World world = player.worldObj;
|
||||
if (world != null)
|
||||
{
|
||||
world.playSoundEffect((double) ((float) player.posX + 0.5F), (double) ((float) player.posY + 0.5F), (double) ((float) player.posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||
}
|
||||
|
||||
int amount = SoulNetworkHandler.syphonFromNetwork(ownerName, damageToBeDone);
|
||||
|
||||
hurtPlayer(player, damageToBeDone - amount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean canSyphonFromOnlyNetwork(ItemStack ist, int damageToBeDone)
|
||||
{
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
|
||||
{
|
||||
String ownerName = ist.getTagCompound().getString("ownerName");
|
||||
|
||||
return canSyphonFromOnlyNetwork(ownerName, damageToBeDone);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean canSyphonFromOnlyNetwork(String ownerName, int damageToBeDone)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
World world = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(ownerName);
|
||||
world.setItemData(ownerName, data);
|
||||
}
|
||||
|
||||
return data.currentEssence >= damageToBeDone;
|
||||
}
|
||||
|
||||
public static int getCurrentEssence(String ownerName)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
World world = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(ownerName);
|
||||
world.setItemData(ownerName, data);
|
||||
}
|
||||
|
||||
return data.currentEssence;
|
||||
}
|
||||
|
||||
public static void setCurrentEssence(String ownerName, int essence)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
World world = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(ownerName);
|
||||
world.setItemData(ownerName, data);
|
||||
}
|
||||
|
||||
data.currentEssence = essence;
|
||||
data.markDirty();
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to add to an owner's network up to a maximum value.
|
||||
*
|
||||
* @param ownerName
|
||||
* @param addedEssence
|
||||
* @param maximum
|
||||
* @return amount added to the network
|
||||
*/
|
||||
public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence, int maximum)
|
||||
{
|
||||
AddToNetworkEvent event = new AddToNetworkEvent(ownerName, addedEssence, maximum);
|
||||
|
||||
if(MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
World world = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, event.ownerNetwork);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(event.ownerNetwork);
|
||||
world.setItemData(event.ownerNetwork, data);
|
||||
}
|
||||
|
||||
int currEss = data.currentEssence;
|
||||
|
||||
if (currEss >= event.maximum)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int newEss = Math.min(event.maximum, currEss + event.addedAmount);
|
||||
if(event.getResult() != Event.Result.DENY)
|
||||
{
|
||||
data.currentEssence = newEss;
|
||||
}
|
||||
|
||||
return newEss - currEss;
|
||||
}
|
||||
|
||||
public static void hurtPlayer(EntityPlayer user, int energySyphoned)
|
||||
{
|
||||
if (energySyphoned < 100 && energySyphoned > 0)
|
||||
{
|
||||
if (!user.capabilities.isCreativeMode)
|
||||
{
|
||||
user.setHealth((user.getHealth() - 1));
|
||||
|
||||
if (user.getHealth() <= 0.0005f)
|
||||
{
|
||||
user.onDeath(DamageSource.generic);
|
||||
}
|
||||
}
|
||||
} else if (energySyphoned >= 100)
|
||||
{
|
||||
if (!user.capabilities.isCreativeMode)
|
||||
{
|
||||
for (int i = 0; i < ((energySyphoned + 99) / 100); i++)
|
||||
{
|
||||
user.setHealth((user.getHealth() - 1));
|
||||
|
||||
if (user.getHealth() <= 0.0005f)
|
||||
{
|
||||
user.onDeath(DamageSource.generic);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void hurtPlayer(EntityPlayer user, float damage)
|
||||
{
|
||||
if (!user.capabilities.isCreativeMode)
|
||||
{
|
||||
user.setHealth((user.getHealth() - damage));
|
||||
|
||||
if (user.getHealth() <= 0.0005f)
|
||||
{
|
||||
user.onDeath(DamageSource.generic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player)
|
||||
{
|
||||
checkAndSetItemPlayer(item, player);
|
||||
}
|
||||
|
||||
public static boolean checkAndSetItemPlayer(ItemStack item, EntityPlayer player)
|
||||
{
|
||||
if (item.hasTagCompound() && !item.getTagCompound().getString("ownerName").equals("")) return true;
|
||||
|
||||
ItemBindEvent event = new ItemBindEvent(player, SoulNetworkHandler.getUsername(player), item);
|
||||
|
||||
if(!MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
if (!item.hasTagCompound())
|
||||
{
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
item.getTagCompound().setString("ownerName", event.key);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void checkAndSetItemOwner(ItemStack item, String ownerName)
|
||||
{
|
||||
if (item.getTagCompound() == null)
|
||||
{
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (item.getTagCompound().getString("ownerName").equals(""))
|
||||
{
|
||||
item.getTagCompound().setString("ownerName", ownerName);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getUsername(EntityPlayer player)
|
||||
{
|
||||
return player.getCommandSenderName();
|
||||
}
|
||||
|
||||
public static EntityPlayer getPlayerForUsername(String str)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return MinecraftServer.getServer().getConfigurationManager().func_152612_a(str);
|
||||
}
|
||||
|
||||
public static void causeNauseaToPlayer(ItemStack stack)
|
||||
{
|
||||
if (stack.getTagCompound() != null && !(stack.getTagCompound().getString("ownerName").equals("")))
|
||||
{
|
||||
String ownerName = stack.getTagCompound().getString("ownerName");
|
||||
|
||||
SoulNetworkHandler.causeNauseaToPlayer(ownerName);
|
||||
}
|
||||
}
|
||||
|
||||
public static void causeNauseaToPlayer(String ownerName)
|
||||
{
|
||||
EntityPlayer entityOwner = SoulNetworkHandler.getPlayerForUsername(ownerName);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
|
||||
public static String getOwnerName(ItemStack item)
|
||||
{
|
||||
if (item.getTagCompound() == null)
|
||||
{
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
return item.getTagCompound().getString("ownerName");
|
||||
}
|
||||
}
|
||||
@@ -1,324 +0,0 @@
|
||||
package am2.api;
|
||||
|
||||
import am2.api.enchantment.IAMEnchantmentHelper;
|
||||
import am2.api.entities.IEntityManager;
|
||||
import am2.api.flickers.IFlickerRegistry;
|
||||
import am2.api.items.IKeystoneHelper;
|
||||
import am2.api.items.armor.IImbuementRegistry;
|
||||
import am2.api.potion.IBuffHelper;
|
||||
import am2.api.power.IObeliskFuelHelper;
|
||||
import am2.api.spell.ISkillTreeManager;
|
||||
import am2.api.spell.ISpellIconManager;
|
||||
import am2.api.spell.ISpellPartManager;
|
||||
import am2.api.spell.ISpellUtils;
|
||||
import am2.api.spell.component.interfaces.ISkillTreeEntry;
|
||||
import am2.api.spell.enums.SkillPointTypes;
|
||||
import am2.api.spell.enums.SkillTrees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.attributes.IAttribute;
|
||||
import net.minecraft.entity.ai.attributes.RangedAttribute;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ArsMagicaApi{
|
||||
public static final ArsMagicaApi instance = new ArsMagicaApi();
|
||||
|
||||
/**
|
||||
* Easy access to this mod's ID
|
||||
*/
|
||||
public static final String AM2ModID = "arsmagica2";
|
||||
|
||||
private static String extendedPropertiesIdentifier;
|
||||
private static String affinityDataIdentifier;
|
||||
private static String skillDataIdentifier;
|
||||
private static String riftStorageIdentifier;
|
||||
|
||||
/**
|
||||
* Attributes for AM2's properties
|
||||
*/
|
||||
//Bonus to max mana. Applied additively.
|
||||
public static final IAttribute maxManaBonus = new RangedAttribute("am2.maxManaBonus", 0.0f, 0.0f, Double.MAX_VALUE).setDescription("Mana Bonus").setShouldWatch(true);
|
||||
//Bonus to max burnout. Applied additively.
|
||||
public static final IAttribute maxBurnoutBonus = new RangedAttribute("am2.maxBurnoutBonus", 0.0f, 0.0f, Double.MAX_VALUE).setDescription("Burnout Bonus").setShouldWatch(true);
|
||||
//Bonus to XP gained. Applied multiplicatively.
|
||||
public static final IAttribute xpGainModifier = new RangedAttribute("am2.xpMultiplier", 1.0f, 0.0f, Double.MAX_VALUE).setDescription("XP Mutiplier").setShouldWatch(true);
|
||||
//Bonus to mana regen rate. Applied multiplicatively.
|
||||
public static final IAttribute manaRegenTimeModifier = new RangedAttribute("am2.manaRegenModifier", 1.0f, 0.5f, 2.0f).setDescription("Mana Regen Rate Multiplier").setShouldWatch(true);
|
||||
//Bonus to burnout reduction rate. Applied multiplicatively.
|
||||
public static final IAttribute burnoutReductionRate = new RangedAttribute("am2.burnoutReduction", 1.0f, 0.1f, 2.0f).setDescription("Burnout Reduction Rate").setShouldWatch(true);
|
||||
|
||||
private static final float manaBurnoutRatio = 0.38f;
|
||||
|
||||
private ArsMagicaApi(){
|
||||
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
// Getters
|
||||
//================================================================================
|
||||
|
||||
/**
|
||||
* Gets the spell part manager. Used to register new shapes/components/modifiers/talents
|
||||
*/
|
||||
public final ISpellPartManager getSpellPartManager(){
|
||||
return spellPartManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the enchantment helper. Used to resolve current enchantment IDs.
|
||||
*/
|
||||
public final IAMEnchantmentHelper getEnchantHelper(){
|
||||
return enchantmentHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the skill tree manager. Used to register spell parts into the skill trees (accessible via occulus)
|
||||
*/
|
||||
public final ISkillTreeManager getSkillTreeManager(){
|
||||
return this.skillTreeManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to calculate the burnout for a spell based on mana cost.
|
||||
*/
|
||||
public static final float getBurnoutFromMana(float manaCost){
|
||||
return manaCost * manaBurnoutRatio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the keystone helper instance. Used to check inventories for keys and check access to blocks lockable by keystone.
|
||||
*/
|
||||
public final IKeystoneHelper getKeystoneHelper(){
|
||||
return this.keystoneHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entity manager. Used to blacklist things from the progeny and butchery flicker operators
|
||||
*/
|
||||
public final IEntityManager getEntityManager(){
|
||||
return this.entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fuel helper instance. Used to register new fuels for the Obelisk.
|
||||
*/
|
||||
public final IObeliskFuelHelper getFuelHelper(){
|
||||
return this.obeliskFuelHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the flicker registry. Used to register new flicker operators into the habitat.
|
||||
*/
|
||||
public final IFlickerRegistry getFlickerOperatorRegistry(){
|
||||
return flickerOperatorRegistry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the armor imbuement registry. Used to register new imbuements and check if imbuements are present on a given item stack.
|
||||
*/
|
||||
public final IImbuementRegistry getArmorInfusionRegistry(){
|
||||
return this.armorInfusionRegistry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the AM recipe manager. Used to register new essence refiner recipes.
|
||||
*/
|
||||
public final IAMRecipeManager getEssenceRecipeManager(){
|
||||
return this.essenceRecipes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is AM2 running in colourblind mode?
|
||||
*/
|
||||
public final boolean getColourblindMode(){
|
||||
return this.colourblindMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the extended properties for the passed in entity living
|
||||
*/
|
||||
public final IExtendedProperties getExtendedProperties(EntityLivingBase entity){
|
||||
return (IExtendedProperties)entity.getExtendedProperties(extendedPropertiesIdentifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the skill data instance (known shapes/modifiers/components/talents)
|
||||
*/
|
||||
public final ISkillData getSkillData(EntityPlayer entity){
|
||||
return (ISkillData)entity.getExtendedProperties(skillDataIdentifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the affinity data for the passed in entity
|
||||
*/
|
||||
public final IAffinityData getAffinityData(EntityLivingBase entity){
|
||||
return (IAffinityData)entity.getExtendedProperties(affinityDataIdentifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rift storage for the passed in player.
|
||||
*/
|
||||
public final IInventory getRiftStorage(EntityPlayer entity){
|
||||
return (IInventory)entity.getExtendedProperties(riftStorageIdentifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a skill tree entry (Shape, Component, Modifier, or Talent) into the mod
|
||||
*
|
||||
* @param entry The skill tree entry to register
|
||||
* @param name The unlocalized name that is used to identify this entry
|
||||
* @param tree Which skill tree the entry should be located in
|
||||
* @param x The x coordinate that the entry should be located at in the tree. Typical increments are of 45 to space the items.
|
||||
* @param y The y coordinate that the entry should be located at in the tree. Typical increments are of 45 to space the items.
|
||||
* @param point The type of skill point needed to unlock this entry
|
||||
* @param prerequs Any skill tree entries that are required as prerequisites for this one. All prerequisites must be registered before the current entry.
|
||||
*/
|
||||
public final void registerSkillTreeEntry(ISkillTreeEntry entry, String name, SkillTrees tree, int x, int y, SkillPointTypes point, ISkillTreeEntry... prereqs){
|
||||
spellPartManager.registerSkillTreeEntry(entry, name);
|
||||
skillTreeManager.RegisterPart(entry, x, y, tree, point, prereqs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the IIcon to use for the specified skill. This should be called during the API's registerSkillTreeIcons event for each entry that you registered. You get a reference to the ISpellIconManager which has the same method, so this is only here for convenience.
|
||||
*
|
||||
* @param name The unlocalized name that was used to register the spell. See {@link #registerSkillTreeEntry(ISkillTreeEntry, String, SkillTrees, int, int, SkillPointTypes, ISkillTreeEntry...) registerSkillTreeEntry} method for more info on the name.
|
||||
* @param IIcon The IIcon to use. You need to register these IIcons with the game beforehand during your mod's load phase - AM won't do it for you.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final void registerSkillIcon(String name, IIcon IIcon){
|
||||
spellIconManager.registerIcon(name, IIcon);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the IIcon manager. This is used to register spell IIcons.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final ISpellIconManager getSpellIconManager(){
|
||||
return spellIconManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the buff helper which can be used to query AM for potion IDs, and add dispel blacklists
|
||||
*/
|
||||
public final IBuffHelper getBuffHelper(){
|
||||
return this.buffHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the spell utils class
|
||||
*/
|
||||
public final ISpellUtils getSpellUtils(){
|
||||
return this.spellUtils;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
// Setters - for AM use only, do not call these.
|
||||
//================================================================================
|
||||
public final void setSpellPartManager(ISpellPartManager manager){
|
||||
if (this.spellPartManager == null){
|
||||
this.spellPartManager = manager;
|
||||
}
|
||||
}
|
||||
|
||||
public final void setEnchantmentHelper(IAMEnchantmentHelper helper){
|
||||
if (this.enchantmentHelper == null){
|
||||
this.enchantmentHelper = helper;
|
||||
}
|
||||
}
|
||||
|
||||
public final void setSkillTreeManager(ISkillTreeManager manager){
|
||||
if (this.skillTreeManager == null)
|
||||
this.skillTreeManager = manager;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final void setSpellIconManager(ISpellIconManager manager){
|
||||
if (this.spellIconManager == null)
|
||||
this.spellIconManager = manager;
|
||||
}
|
||||
|
||||
public final void setKeystoneHelper(IKeystoneHelper helper){
|
||||
if (this.keystoneHelper == null){
|
||||
this.keystoneHelper = helper;
|
||||
}
|
||||
}
|
||||
|
||||
public final void setExtendedPropertiesID(String identifier){
|
||||
if (extendedPropertiesIdentifier == null)
|
||||
extendedPropertiesIdentifier = identifier;
|
||||
}
|
||||
|
||||
public final void setAffinityDataID(String identifier){
|
||||
if (affinityDataIdentifier == null)
|
||||
affinityDataIdentifier = identifier;
|
||||
}
|
||||
|
||||
public final void setSkillDataID(String identifier){
|
||||
if (skillDataIdentifier == null)
|
||||
skillDataIdentifier = identifier;
|
||||
}
|
||||
|
||||
public final void setRiftStorageID(String identifier){
|
||||
if (riftStorageIdentifier == null)
|
||||
riftStorageIdentifier = identifier;
|
||||
}
|
||||
|
||||
public final void setEntityManager(IEntityManager manager){
|
||||
if (entityManager == null)
|
||||
entityManager = manager;
|
||||
}
|
||||
|
||||
public final void setObeliskFuelHelper(IObeliskFuelHelper manager){
|
||||
if (obeliskFuelHelper == null)
|
||||
obeliskFuelHelper = manager;
|
||||
}
|
||||
|
||||
public final void setFlickerOperatorRegistry(IFlickerRegistry registry){
|
||||
if (flickerOperatorRegistry == null)
|
||||
flickerOperatorRegistry = registry;
|
||||
}
|
||||
|
||||
public final void setInfusionRegistry(IImbuementRegistry registry){
|
||||
if (this.armorInfusionRegistry == null)
|
||||
this.armorInfusionRegistry = registry;
|
||||
}
|
||||
|
||||
public final void setEssenceRecipeHandler(IAMRecipeManager manager){
|
||||
if (this.essenceRecipes != null)
|
||||
this.essenceRecipes = manager;
|
||||
}
|
||||
|
||||
public final void setColourblindMode(boolean colourblindMode){
|
||||
this.colourblindMode = colourblindMode;
|
||||
}
|
||||
|
||||
public final void setBuffHelper(IBuffHelper helper){
|
||||
if (this.buffHelper == null)
|
||||
this.buffHelper = helper;
|
||||
}
|
||||
|
||||
public final void setSpellUtils(ISpellUtils utilsHelper){
|
||||
if (this.spellUtils == null){
|
||||
this.spellUtils = utilsHelper;
|
||||
}
|
||||
}
|
||||
|
||||
private ISpellPartManager spellPartManager;
|
||||
private ISpellUtils spellUtils;
|
||||
private ISkillTreeManager skillTreeManager;
|
||||
private IAMEnchantmentHelper enchantmentHelper;
|
||||
private IEntityManager entityManager;
|
||||
private IKeystoneHelper keystoneHelper;
|
||||
private IObeliskFuelHelper obeliskFuelHelper;
|
||||
private IFlickerRegistry flickerOperatorRegistry;
|
||||
private IImbuementRegistry armorInfusionRegistry;
|
||||
private IAMRecipeManager essenceRecipes;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private ISpellIconManager spellIconManager;
|
||||
private IBuffHelper buffHelper;
|
||||
private boolean colourblindMode;
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package am2.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IAMRecipeManager{
|
||||
/**
|
||||
* Adds a recipe to the essence refiner.
|
||||
*
|
||||
* @param output The output created
|
||||
* @param components The components required. Must be a length of 5.
|
||||
*/
|
||||
public void addRefinerRecipe(ItemStack output, ItemStack[] components);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package am2.api;
|
||||
|
||||
import am2.api.spell.enums.Affinity;
|
||||
|
||||
public interface IAffinityData{
|
||||
|
||||
/**
|
||||
* Gets the depth of the specified affinity as a percentage.
|
||||
*/
|
||||
float getAffinityDepth(Affinity affinity);
|
||||
|
||||
/**
|
||||
* Gets the factor at which affinity gains are currently reduced.
|
||||
*/
|
||||
float getDiminishingReturnsFactor();
|
||||
|
||||
/**
|
||||
* Directly sets an affinity. Does not take into account oppositions. Use sparingly.
|
||||
*
|
||||
* @param affinity The affinity to set
|
||||
* @param depth The depth to set
|
||||
*/
|
||||
void setAffinityAndDepth(Affinity affinity, float depth);
|
||||
|
||||
/**
|
||||
* Increments the affinity by the specified amount, and decrements other affinities by an amount related to
|
||||
* how much in opposition they are to the specified affinity.
|
||||
*
|
||||
* @param affinity The affinity to increase
|
||||
* @param amt The amount to increase the affinity by
|
||||
*/
|
||||
void incrementAffinity(Affinity affinity, float amt);
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package am2.api;
|
||||
|
||||
import am2.api.math.AMVector3;
|
||||
|
||||
/**
|
||||
* Extended properties on EntityLiving used in Ars Magica.
|
||||
*
|
||||
* @author Mithion
|
||||
*/
|
||||
public interface IExtendedProperties{
|
||||
public float getCurrentMana();
|
||||
|
||||
public float getMaxMana();
|
||||
|
||||
public int getMarkDimension();
|
||||
|
||||
public int getMagicLevel();
|
||||
|
||||
public int getNumSummons();
|
||||
|
||||
public AMVector3 getMarkLocation();
|
||||
|
||||
public boolean getHasUnlockedAugmented();
|
||||
|
||||
public boolean getMarkSet();
|
||||
|
||||
public boolean setMagicLevelWithMana(int magicLevel);
|
||||
|
||||
public void setCurrentMana(float currentMana);
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package am2.api;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface ILoreHelper{
|
||||
|
||||
/**
|
||||
* Adds an entry to the compendium.
|
||||
*
|
||||
* @param entryItem The item that the compendium entry describes. Can be an item, a block, an entity, or a spell part (incl shape/component/or modifier).
|
||||
* @param entryKey The key of the entry in the compendium. Must be unique. This depends on what you are describing, and can have conditions. See the following: <pre>
|
||||
* For meta specific entries, you can add metadata using the format "key@meta".
|
||||
* For non-AM items/blocks, must be prefixed with mod ID, "am2apidemo:forceRing" for example.
|
||||
* For non-AM mobs, must be prefixed with mod ID dot mobID, for example "arsmagica2.EntityDryad".
|
||||
* For Shapes/Components/Modifiers, they must be registered. Just give their registered name, no prefix is necessary. For example, "Explosion" (from am2apidemo).
|
||||
* <p/>
|
||||
* If you get this wrong, the entry will be blank.
|
||||
* </pre>
|
||||
* @param entryName The human-readable name of the entry.
|
||||
* @param entryDesc The entry's text. You can use Minecraft color codes by prefixing the color number with the '#' key (for example, #9This text would be blue #0 and now back to black)
|
||||
* @param parent The entry's parent entry. You can set this to the key of the parent entry to make this a sub item. Set to null for none.
|
||||
* @param allowReplace If an entry already exists with the specified key, can it be replaced?
|
||||
* @param relatedKeys Related entries are shown at the bottom, and are clickable.
|
||||
*/
|
||||
public void AddCompenidumEntry(Object entryItem, String entryKey, String entryName, String entryDesc, String parent, boolean allowReplace, String... relatedKeys);
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package am2.api;
|
||||
|
||||
import am2.api.spell.component.interfaces.ISkillTreeEntry;
|
||||
import am2.api.spell.enums.LearnStates;
|
||||
import am2.api.spell.enums.SkillPointTypes;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public interface ISkillData{
|
||||
/**
|
||||
* Checks if the specified skill tree entry is known
|
||||
*/
|
||||
boolean isEntryKnown(SkillTreeEntry entry);
|
||||
|
||||
/**
|
||||
* Returns the number of skill points of the given type that this skill data has
|
||||
*/
|
||||
int getSpellPoints(SkillPointTypes type);
|
||||
|
||||
/**
|
||||
* Sets the number of skill points of the given type that this skill data has
|
||||
*/
|
||||
void setSpellPoints(int spellPoints, SkillPointTypes type);
|
||||
|
||||
/**
|
||||
* Sets the number of skill points for all types that this skill data has
|
||||
*/
|
||||
void setSpellPoints(int spellPoints_blue, int spellPoints_green, int spellPoints_red);
|
||||
|
||||
/**
|
||||
* Increments the skill points of the specified type.
|
||||
*/
|
||||
void incrementSpellPoints(SkillPointTypes type);
|
||||
|
||||
/**
|
||||
* Decrements the skill points of the specified type. Cannot go below 0.
|
||||
*/
|
||||
void decrementSpellPoints(SkillPointTypes type);
|
||||
|
||||
/**
|
||||
* Learns the specified entry. This will attempt to decrement skill points but is not bounded by it - make sure you check {@link #getLearnState(SkillTreeEntry, EntityPlayer)} first!
|
||||
*
|
||||
* @param entry
|
||||
*/
|
||||
void learn(ISkillTreeEntry entry);
|
||||
|
||||
/**
|
||||
* Returns an array of shifted IDs representing the known shapes.
|
||||
*/
|
||||
Integer[] getKnownShapes();
|
||||
|
||||
/**
|
||||
* Returns an array of shifted IDs representing the known components.
|
||||
*/
|
||||
Integer[] getKnownComponents();
|
||||
|
||||
/**
|
||||
* Returns an array of shifted IDs representing the known modifiers.
|
||||
*/
|
||||
Integer[] getKnownModifiers();
|
||||
|
||||
/**
|
||||
* Returns an array of shifted IDs representing the known talents.
|
||||
*/
|
||||
Integer[] getKnownTalents();
|
||||
|
||||
/**
|
||||
* Forces changes to sync to appropriate clients. Chances are you won't have to call this, as the sync will happen at regular intervals if there are actually changes to sync. This is for when you need the changes clientside immediately.
|
||||
*/
|
||||
void forceSync();
|
||||
|
||||
/**
|
||||
* Clears all spell knowledge and skill points. Does not do any refunding -- this is NOT a respec!
|
||||
*/
|
||||
void clearAllKnowledge();
|
||||
|
||||
/**
|
||||
* Gets the learn state for the specified skill.
|
||||
*/
|
||||
LearnStates getLearnState(SkillTreeEntry entry, EntityPlayer player);
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package am2.api;
|
||||
|
||||
import am2.api.spell.component.interfaces.ISkillTreeEntry;
|
||||
import am2.api.spell.enums.SkillTrees;
|
||||
|
||||
public class SkillTreeEntry{
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final SkillTrees tree;
|
||||
public final SkillTreeEntry[] prerequisites;
|
||||
public final ISkillTreeEntry registeredItem;
|
||||
public final int tier;
|
||||
public boolean enabled;
|
||||
|
||||
public SkillTreeEntry(int x, int y, SkillTrees tree, SkillTreeEntry[] prerequisites, ISkillTreeEntry registeredItem, boolean enabled){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.tree = tree;
|
||||
this.prerequisites = prerequisites;
|
||||
this.registeredItem = registeredItem;
|
||||
this.enabled = enabled;
|
||||
|
||||
int highestTier = 0;
|
||||
for (SkillTreeEntry entry : prerequisites){
|
||||
if (entry.tier >= highestTier){
|
||||
highestTier = entry.tier + 1;
|
||||
}
|
||||
}
|
||||
|
||||
this.tier = highestTier;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package am2.api.blocks;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface IKeystoneLockable<T extends TileEntity, IInventory>{
|
||||
/**
|
||||
* Return a three element array of the three runes in the inventory that make up the current keystone combination.
|
||||
* Elements can be NULL if there is no rune present.
|
||||
*/
|
||||
public ItemStack[] getRunesInKey();
|
||||
|
||||
/**
|
||||
* Does the keystone need to be the currently held item? Trumps {@link #keystoneMustBeInActionBar()}.
|
||||
*/
|
||||
public boolean keystoneMustBeHeld();
|
||||
|
||||
/**
|
||||
* Does the keystone need to be in the action bar? Or can it be anywhere in the inventory?
|
||||
*/
|
||||
public boolean keystoneMustBeInActionBar();
|
||||
}
|
||||
@@ -1,404 +0,0 @@
|
||||
package am2.api.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class MultiblockStructureDefinition{
|
||||
public class BlockDec{
|
||||
Block block;
|
||||
int meta;
|
||||
|
||||
public BlockDec(Block block, int meta){
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public Block getBlock(){
|
||||
return block;
|
||||
}
|
||||
|
||||
public int getMeta(){
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
String blockName = "";
|
||||
if (block != null){
|
||||
blockName = block.getLocalizedName();
|
||||
}else{
|
||||
blockName = "Unknown";
|
||||
}
|
||||
return String.format("Block: %s, meta: %d", blockName, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj){
|
||||
if (obj instanceof BlockDec){
|
||||
return this.block == ((BlockDec)obj).block && (this.meta == -1 || ((BlockDec)obj).meta == -1 || this.meta == ((BlockDec)obj).meta);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode(){
|
||||
return Block.getIdFromBlock(block);
|
||||
}
|
||||
}
|
||||
|
||||
public class BlockCoord implements Comparable<BlockCoord>{
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
public BlockCoord(int offsetX, int offsetY, int offsetZ){
|
||||
this.x = offsetX;
|
||||
this.y = offsetY;
|
||||
this.z = offsetZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj){
|
||||
if (obj instanceof BlockCoord){
|
||||
return this.x == ((BlockCoord)obj).x && this.y == ((BlockCoord)obj).y && this.z == ((BlockCoord)obj).z;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode(){
|
||||
return this.x + this.y + this.z;
|
||||
}
|
||||
|
||||
|
||||
public int getX(){
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public int getY(){
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public int getZ(){
|
||||
return this.z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return String.format("BlockCoord: %d, %d, %d", x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(BlockCoord o){
|
||||
return this.z > o.z ? 1 : this.z < o.z ? -1 : this.x > o.x ? 1 : this.x < o.x ? -1 : this.y > o.y ? 1 : this.y < o.y ? -1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class StructureGroup{
|
||||
String name;
|
||||
int mutex;
|
||||
HashMap<BlockCoord, ArrayList<BlockDec>> allowedBlocks;
|
||||
|
||||
public StructureGroup(String name, int mutex){
|
||||
this.name = name;
|
||||
this.mutex = mutex;
|
||||
allowedBlocks = new HashMap<BlockCoord, ArrayList<BlockDec>>();
|
||||
}
|
||||
|
||||
void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block, int meta){
|
||||
BlockCoord originOffset = new BlockCoord(offsetX, offsetY, offsetZ);
|
||||
if (!allowedBlocks.containsKey(originOffset)){
|
||||
allowedBlocks.put(originOffset, new ArrayList<BlockDec>());
|
||||
}
|
||||
ArrayList<BlockDec> positionReplacements = allowedBlocks.get(originOffset);
|
||||
positionReplacements.add(new BlockDec(block, meta));
|
||||
}
|
||||
|
||||
ArrayList<BlockDec> getAllowedBlocksAt(BlockCoord coord){
|
||||
return allowedBlocks.get(coord);
|
||||
}
|
||||
|
||||
boolean matchGroup(World world, int originX, int originY, int originZ){
|
||||
for (BlockCoord offset : allowedBlocks.keySet()){
|
||||
Block block = world.getBlock(originX + offset.x, originY + offset.y, originZ + offset.z);
|
||||
int meta = world.getBlockMetadata(originX + offset.x, originY + offset.y, originZ + offset.z);
|
||||
ArrayList<BlockDec> positionReplacements = allowedBlocks.get(offset);
|
||||
boolean valid = false;
|
||||
for (BlockDec bd : positionReplacements){
|
||||
if (bd.block == block && (bd.meta == -1 || bd.meta == meta)){
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
if (!valid) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
HashMap<BlockCoord, ArrayList<BlockDec>> getStructureLayer(int layer){
|
||||
HashMap<BlockCoord, ArrayList<BlockDec>> toReturn = new HashMap<MultiblockStructureDefinition.BlockCoord, ArrayList<BlockDec>>();
|
||||
|
||||
if (layer > getMaxLayer() || layer < getMinLayer()){
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
for (BlockCoord bc : allowedBlocks.keySet()){
|
||||
if (bc.y == layer){
|
||||
toReturn.put(bc, allowedBlocks.get(bc));
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public void replaceAllBlocksOfType(Block originalBlock, Block newBlock){
|
||||
replaceAllBlocksOfType(originalBlock, -1, newBlock, -1);
|
||||
}
|
||||
|
||||
public void replaceAllBlocksOfType(Block originalBlock, int originalMeta, Block newBlock, int newMeta){
|
||||
for (BlockCoord bc : allowedBlocks.keySet()){
|
||||
for (BlockDec bd : allowedBlocks.get(bc)){
|
||||
if (bd.block == originalBlock){
|
||||
if (bd.meta == originalMeta || originalMeta == -1){
|
||||
bd.block = newBlock;
|
||||
if (newMeta != -1){
|
||||
bd.meta = newMeta;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HashMap<BlockCoord, ArrayList<BlockDec>> getAllowedBlocks(){
|
||||
return (HashMap<BlockCoord, ArrayList<BlockDec>>)allowedBlocks.clone();
|
||||
}
|
||||
|
||||
public void deleteBlocksFromWorld(World world, int x, int y, int z){
|
||||
for (BlockCoord offset : allowedBlocks.keySet()){
|
||||
world.setBlockToAir(x + offset.x, y + offset.y, z + offset.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private StructureGroup mainGroup;
|
||||
private ArrayList<StructureGroup> blockGroups;
|
||||
private ArrayList<Integer> mutexCache;
|
||||
|
||||
public static final int MAINGROUP_MUTEX = 1;
|
||||
|
||||
private String id;
|
||||
|
||||
private int maxX = 0;
|
||||
private int minX = 0;
|
||||
private int maxY = 0;
|
||||
private int minY = 0;
|
||||
private int maxZ = 0;
|
||||
private int minZ = 0;
|
||||
|
||||
public MultiblockStructureDefinition(String id){
|
||||
blockGroups = new ArrayList<StructureGroup>();
|
||||
mutexCache = new ArrayList<Integer>();
|
||||
this.id = id;
|
||||
|
||||
//default group
|
||||
mainGroup = createGroup("main", MAINGROUP_MUTEX);
|
||||
}
|
||||
|
||||
public String getID(){
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getMutexList(){
|
||||
return mutexCache;
|
||||
}
|
||||
|
||||
public ArrayList<StructureGroup> getGroupsForMutex(int mutex){
|
||||
ArrayList<StructureGroup> toReturn = new ArrayList<StructureGroup>();
|
||||
|
||||
for (StructureGroup group : blockGroups){
|
||||
if (group.mutex == mutex){
|
||||
toReturn.add(group);
|
||||
}
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public ArrayList<BlockDec> getAllowedBlocksAt(StructureGroup group, BlockCoord coord){
|
||||
return group.getAllowedBlocksAt(coord);
|
||||
}
|
||||
|
||||
public ArrayList<BlockDec> getAllowedBlocksAt(BlockCoord coord){
|
||||
return mainGroup.getAllowedBlocksAt(coord);
|
||||
}
|
||||
|
||||
public void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block, int meta){
|
||||
|
||||
if (offsetY > maxY){
|
||||
maxY = offsetY;
|
||||
}else if (offsetY < minY){
|
||||
minY = offsetY;
|
||||
}
|
||||
|
||||
if (offsetX > maxX){
|
||||
maxX = offsetX;
|
||||
}else if (offsetX < minX){
|
||||
minX = offsetX;
|
||||
}
|
||||
|
||||
if (offsetZ > maxZ){
|
||||
maxZ = offsetZ;
|
||||
}else if (offsetZ < minZ){
|
||||
minZ = offsetZ;
|
||||
}
|
||||
|
||||
mainGroup.addAllowedBlock(offsetX, offsetY, offsetZ, block, meta);
|
||||
}
|
||||
|
||||
public void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block){
|
||||
addAllowedBlock(offsetX, offsetY, offsetZ, block, -1);
|
||||
}
|
||||
|
||||
public void addAllowedBlock(StructureGroup group, int offsetX, int offsetY, int offsetZ, Block block, int meta){
|
||||
if (!blockGroups.contains(group)){
|
||||
blockGroups.add(group);
|
||||
}
|
||||
|
||||
if (offsetY > maxY){
|
||||
maxY = offsetY;
|
||||
}else if (offsetY < minY){
|
||||
minY = offsetY;
|
||||
}
|
||||
|
||||
if (offsetX > maxX){
|
||||
maxX = offsetX;
|
||||
}else if (offsetX < minX){
|
||||
minX = offsetX;
|
||||
}
|
||||
|
||||
if (offsetZ > maxZ){
|
||||
maxZ = offsetZ;
|
||||
}else if (offsetZ < minZ){
|
||||
minZ = offsetZ;
|
||||
}
|
||||
|
||||
group.addAllowedBlock(offsetX, offsetY, offsetZ, block, meta);
|
||||
}
|
||||
|
||||
public void addAllowedBlock(StructureGroup group, int offsetX, int offsetY, int offsetZ, Block block){
|
||||
addAllowedBlock(group, offsetX, offsetY, offsetZ, block, -1);
|
||||
}
|
||||
|
||||
public StructureGroup createGroup(String name, int mutex){
|
||||
if (!mutexCache.contains(mutex)){
|
||||
mutexCache.add(mutex);
|
||||
}
|
||||
StructureGroup group = new StructureGroup(name, mutex);
|
||||
blockGroups.add(group);
|
||||
return group;
|
||||
}
|
||||
|
||||
public StructureGroup copyGroup(String originalName, String destinationName, int newMutex){
|
||||
StructureGroup copyGroup = null;
|
||||
for (StructureGroup group : blockGroups){
|
||||
if (group.name.equals(originalName)){
|
||||
copyGroup = group;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (copyGroup == null) return null;
|
||||
|
||||
StructureGroup newGroup;
|
||||
|
||||
if (newMutex > -1){
|
||||
newGroup = new StructureGroup(destinationName, newMutex);
|
||||
}else{
|
||||
newGroup = new StructureGroup(destinationName, copyGroup.mutex);
|
||||
}
|
||||
|
||||
for (BlockCoord bc : copyGroup.allowedBlocks.keySet()){
|
||||
for (BlockDec bd : copyGroup.allowedBlocks.get(bc)){
|
||||
newGroup.addAllowedBlock(bc.x, bc.y, bc.z, bd.block, bd.meta);
|
||||
}
|
||||
}
|
||||
|
||||
blockGroups.add(newGroup);
|
||||
|
||||
return newGroup;
|
||||
}
|
||||
|
||||
public StructureGroup copyGroup(String originalName, String destinationName){
|
||||
return copyGroup(originalName, destinationName, -1);
|
||||
}
|
||||
|
||||
public ArrayList<StructureGroup> getMatchedGroups(int mutex, World world, int originX, int originY, int originZ){
|
||||
ArrayList<StructureGroup> toReturn = new ArrayList<StructureGroup>();
|
||||
for (StructureGroup group : blockGroups){
|
||||
if ((group.mutex & mutex) == group.mutex){
|
||||
if (group.matchGroup(world, originX, originY, originZ)){
|
||||
toReturn.add(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
private boolean matchMutex(int mutex, World world, int originX, int originY, int originZ){
|
||||
for (StructureGroup group : blockGroups){
|
||||
if ((group.mutex & mutex) == group.mutex){
|
||||
if (group.matchGroup(world, originX, originY, originZ)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkStructure(World world, int originX, int originY, int originZ){
|
||||
boolean valid = true;
|
||||
for (int i : mutexCache){
|
||||
valid &= matchMutex(i, world, originX, originY, originZ);
|
||||
if (!valid) break;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
public int getMinLayer(){
|
||||
return this.minY;
|
||||
}
|
||||
|
||||
public int getMaxLayer(){
|
||||
return this.maxY;
|
||||
}
|
||||
|
||||
public int getHeight(){
|
||||
return this.maxY - this.minY;
|
||||
}
|
||||
|
||||
public int getWidth(){
|
||||
return this.maxX - this.minX;
|
||||
}
|
||||
|
||||
public int getLength(){
|
||||
return this.maxZ - this.minZ;
|
||||
}
|
||||
|
||||
public HashMap<BlockCoord, ArrayList<BlockDec>> getStructureLayer(int layer){
|
||||
return mainGroup.getStructureLayer(layer);
|
||||
}
|
||||
|
||||
public HashMap<BlockCoord, ArrayList<BlockDec>> getStructureLayer(StructureGroup group, int layer){
|
||||
return group.getStructureLayer(layer);
|
||||
}
|
||||
|
||||
public void removeMutex(int mutex, World world, int x, int y, int z){
|
||||
for (StructureGroup group : blockGroups){
|
||||
if (group.mutex == mutex){
|
||||
group.deleteBlocksFromWorld(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package am2.api.enchantment;
|
||||
|
||||
public interface IAMEnchantmentHelper{
|
||||
/**
|
||||
* Gets the current ID for soulbound enchantment
|
||||
*/
|
||||
public int getSoulboundID();
|
||||
|
||||
/**
|
||||
* Gets the current ID for magic resist enchantment
|
||||
*/
|
||||
public int getMagicResistID();
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package am2.api.entities;
|
||||
|
||||
public interface IEntityManager{
|
||||
/**
|
||||
* Adds the specified entities to the butchery blacklist (won't be affected by sigil of butchery)
|
||||
*/
|
||||
public void addButcheryBlacklist(Class... clazz);
|
||||
|
||||
/**
|
||||
* Adds the specified entities to the progeny blacklist (won't be affected by sigil of progeny)
|
||||
*/
|
||||
public void addProgenyBlacklist(Class... clazz);
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package am2.api.events;
|
||||
|
||||
import am2.api.spell.enums.Affinity;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@Cancelable
|
||||
public class AffinityChangingEvent extends Event{
|
||||
public final EntityPlayer player;
|
||||
public float amount;
|
||||
public final Affinity affinity;
|
||||
|
||||
public AffinityChangingEvent(EntityPlayer player, Affinity affinity, float amt){
|
||||
this.player = player;
|
||||
this.amount = amt;
|
||||
this.affinity = affinity;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package am2.api.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Fired whenever mana cost of a spell is calculated, after all predefined calculations.
|
||||
*
|
||||
* @author Mithion
|
||||
*/
|
||||
public class ManaCostEvent extends Event{
|
||||
public final ItemStack spell;
|
||||
public final EntityLivingBase caster;
|
||||
public float manaCost;
|
||||
public float burnout;
|
||||
|
||||
public ManaCostEvent(ItemStack spell, EntityLivingBase caster, float manaCost, float burnout){
|
||||
this.spell = spell;
|
||||
this.caster = caster;
|
||||
this.manaCost = manaCost;
|
||||
this.burnout = burnout;
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package am2.api.events;
|
||||
|
||||
import am2.api.spell.enums.SpellModifiers;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Called whenever a spell's modified variable is calculated
|
||||
*
|
||||
* @author Mithion
|
||||
*/
|
||||
public class ModifierCalculatedEvent extends Event{
|
||||
//The attribute being modified
|
||||
public final SpellModifiers attribute;
|
||||
//The caster of the spell
|
||||
public final EntityLivingBase caster;
|
||||
//The spell being cast. This is a copy of the ItemStack.
|
||||
public final ItemStack spell;
|
||||
//the initial value of the variable
|
||||
public final double initialValue;
|
||||
//the type of operation being used to modify the value
|
||||
public final OperationType operation;
|
||||
|
||||
//the final modified value of the variable
|
||||
public double modifiedValue;
|
||||
|
||||
public enum OperationType{
|
||||
ADD,
|
||||
MULTIPLY
|
||||
}
|
||||
|
||||
public ModifierCalculatedEvent(ItemStack spell, EntityLivingBase caster, SpellModifiers attribute, double initialValue, double modifiedValue, OperationType operation){
|
||||
this.spell = spell;
|
||||
this.caster = caster;
|
||||
this.attribute = attribute;
|
||||
this.initialValue = initialValue;
|
||||
this.modifiedValue = modifiedValue;
|
||||
this.operation = operation;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package am2.api.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
/**
|
||||
* Raised when a player's magic level changes.
|
||||
*
|
||||
* @author Mithion
|
||||
*/
|
||||
public class PlayerMagicLevelChangeEvent extends Event{
|
||||
public final int level;
|
||||
public final EntityLivingBase entity;
|
||||
|
||||
public PlayerMagicLevelChangeEvent(EntityLivingBase entity, int level){
|
||||
this.entity = entity;
|
||||
this.level = level;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package am2.api.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Cancelable
|
||||
public class ReconstructorRepairEvent extends Event{
|
||||
|
||||
/**
|
||||
* The item being repaired.
|
||||
*/
|
||||
public ItemStack item;
|
||||
|
||||
/**
|
||||
* Called when the arcane reconstructor ticks on repairing an item.
|
||||
*
|
||||
* @param item
|
||||
*/
|
||||
public ReconstructorRepairEvent(ItemStack item){
|
||||
this.item = item;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package am2.api.events;
|
||||
|
||||
import am2.api.ILoreHelper;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class RegisterCompendiumEntries extends Event{
|
||||
public final ILoreHelper loreHelper;
|
||||
|
||||
public RegisterCompendiumEntries(ILoreHelper helper){
|
||||
this.loreHelper = helper;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package am2.api.events;
|
||||
|
||||
import am2.api.spell.ISpellIconManager;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class RegisterSkillTreeIcons extends Event{
|
||||
public final ISpellIconManager manager;
|
||||
|
||||
public RegisterSkillTreeIcons(ISpellIconManager manager){
|
||||
this.manager = manager;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package am2.api.events;
|
||||
|
||||
import am2.api.spell.component.interfaces.ISkillTreeEntry;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
/**
|
||||
* Raised when a player learns a skill at the Occulus
|
||||
*
|
||||
* @author Mithion
|
||||
*/
|
||||
public class SkillLearnedEvent extends Event{
|
||||
public final EntityPlayer player;
|
||||
public final ISkillTreeEntry skill;
|
||||
|
||||
public SkillLearnedEvent(EntityPlayer player, ISkillTreeEntry entry){
|
||||
this.player = player;
|
||||
this.skill = entry;
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package am2.api.events;
|
||||
|
||||
import am2.api.spell.ItemSpellBase;
|
||||
import am2.api.spell.enums.SpellCastResult;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SpellCastingEvent{
|
||||
@Cancelable
|
||||
public class Pre extends Event{
|
||||
/**
|
||||
* The spell being cast
|
||||
*/
|
||||
public final ItemSpellBase spell;
|
||||
/**
|
||||
* The caster of the spell
|
||||
*/
|
||||
public final EntityLivingBase caster;
|
||||
/**
|
||||
* The calculated mana cost of the spell
|
||||
*/
|
||||
public final float manaCost;
|
||||
/**
|
||||
* The calculated burnout of the spell
|
||||
*/
|
||||
public final float burnout;
|
||||
/**
|
||||
* The itemstack representing the spell
|
||||
*/
|
||||
public final ItemStack stack;
|
||||
/**
|
||||
* The result to be returned after casting the spell
|
||||
*/
|
||||
public SpellCastResult castResult;
|
||||
/**
|
||||
* Is the spell channeled (maintained in any way, not the shape, so beam counts too)
|
||||
*/
|
||||
public final boolean isChanneled;
|
||||
|
||||
public Pre(ItemStack stack, ItemSpellBase spell, EntityLivingBase caster, float manaCost, float burnout, boolean isChanneled){
|
||||
this.caster = caster;
|
||||
this.spell = spell;
|
||||
this.manaCost = manaCost;
|
||||
this.burnout = burnout;
|
||||
this.stack = stack;
|
||||
this.isChanneled = isChanneled;
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public class Post extends Event{
|
||||
/**
|
||||
* The spell being cast
|
||||
*/
|
||||
public final ItemSpellBase spell;
|
||||
/**
|
||||
* The caster of the spell
|
||||
*/
|
||||
public final EntityLivingBase caster;
|
||||
/**
|
||||
* The calculated mana cost of the spell
|
||||
*/
|
||||
public final float manaCost;
|
||||
/**
|
||||
* The calculated burnout of the spell
|
||||
*/
|
||||
public final float burnout;
|
||||
/**
|
||||
* The itemstack representing the spell
|
||||
*/
|
||||
public final ItemStack stack;
|
||||
/**
|
||||
* The result to be returned after casting the spell
|
||||
*/
|
||||
public final SpellCastResult castResult;
|
||||
/**
|
||||
* Is the spell channeled (maintained in any way, not the shape, so beam counts too)
|
||||
*/
|
||||
public final boolean isChanneled;
|
||||
|
||||
public Post(ItemStack stack, ItemSpellBase spell, EntityLivingBase caster, float manaCost, float burnout, boolean isChanneled, SpellCastResult castResult){
|
||||
this.caster = caster;
|
||||
this.spell = spell;
|
||||
this.manaCost = manaCost;
|
||||
this.burnout = burnout;
|
||||
this.stack = stack;
|
||||
this.isChanneled = isChanneled;
|
||||
this.castResult = castResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package am2.api.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class SpellRecipeItemsEvent extends Event{
|
||||
public final String registeredName; //The registered name of the spell part. Used to identify what spell shape/component/modifier we are working with
|
||||
public final int ID; //The ID of the spell part. Also can be used to identify what we are working with, if you don't like strings.
|
||||
|
||||
/**
|
||||
* recipe items, in order, that need to be thrown into the crafting altar in order to create the item.
|
||||
* <br/>
|
||||
* Use Items for items, Blocks for blocks, Strings for OreDictionary items, and E:[type flag] followed by an integer for essence amounts.
|
||||
* <br/>
|
||||
* Use itemstacks for items/blocks/oredict when meta is required. By default it is meta 0. Quantity (stack size) is ignored.
|
||||
* <br/>
|
||||
* Integer pairs represent the type (*=any, 1=neutral, 2=light, 4=dark, etc.), and the quantity of essence required. The type can be used as flags,
|
||||
* <br/>
|
||||
* For example:
|
||||
* <pre>
|
||||
* new Object[]{ "E:1|2", 1500 } //require 1500 of neutral or 1500 of light power.
|
||||
* new Object[]{ "E:*", 1500 } //require 1500 of any kind of power
|
||||
* etc.
|
||||
* </pre>
|
||||
*/
|
||||
public Object[] recipeItems; //The actual recipe items. Change or verify them here.
|
||||
|
||||
public SpellRecipeItemsEvent(String name, int ID, Object[] recipeItems){
|
||||
registeredName = name;
|
||||
this.ID = ID;
|
||||
this.recipeItems = recipeItems;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package am2.api.flickers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface IFlickerController<T extends TileEntity>{
|
||||
public byte[] getMetadata(IFlickerFunctionality operator);
|
||||
|
||||
public void setMetadata(IFlickerFunctionality operator, byte[] meta);
|
||||
|
||||
public void removeMetadata(IFlickerFunctionality operator);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package am2.api.flickers;
|
||||
|
||||
import am2.api.spell.enums.Affinity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IFlickerFunctionality{
|
||||
boolean RequiresPower();
|
||||
|
||||
int PowerPerOperation();
|
||||
|
||||
boolean DoOperation(World worldObj, IFlickerController controller, boolean powered);
|
||||
|
||||
boolean DoOperation(World worldObj, IFlickerController controller, boolean powered, Affinity[] flickers);
|
||||
|
||||
void RemoveOperator(World worldObj, IFlickerController controller, boolean powered);
|
||||
|
||||
int TimeBetweenOperation(boolean powered, Affinity[] flickers);
|
||||
|
||||
void RemoveOperator(World worldObj, IFlickerController controller, boolean powered, Affinity[] flickers);
|
||||
|
||||
Object[] getRecipe();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package am2.api.flickers;
|
||||
|
||||
public interface IFlickerRegistry{
|
||||
/**
|
||||
* Attempts to register a flicker operator into the flicker network
|
||||
*
|
||||
* @param singleton The instance of the class that should be called upon to perform the operations when loaded into a flicker block
|
||||
* @param mask The bit mask representing the flicker combination. These are ORed affinity masks. @see am2.api.spell.enums.Affinity.getMask for specific mask flags (flickers represent an affinity)
|
||||
* @return True if registered, false if the mask is already in use.
|
||||
*/
|
||||
public boolean registerFlickerOperator(IFlickerFunctionality singleton, int mask);
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package am2.api.illeffect;
|
||||
|
||||
public enum BadThingTypes{
|
||||
ALL,
|
||||
DARKNEXUS
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package am2.api.illeffect;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Base interface for an ill effect during spell creation. <br/>
|
||||
* Included for compatibility; do not directly inherit. <br/>
|
||||
* Use IllEffectBase instead.
|
||||
*
|
||||
* @author Mithion
|
||||
*/
|
||||
public interface IIllEffect extends Comparable{
|
||||
/**
|
||||
* The severity level of the effect. Controls at what instability level the effect could be applied.
|
||||
*
|
||||
* @return One of the values in the IllEffectSeverity enum.
|
||||
*/
|
||||
public IllEffectSeverity GetSeverity();
|
||||
|
||||
/**
|
||||
* Callback to actually apply the ill effect.
|
||||
*
|
||||
* @param world The world the effect is happening in
|
||||
* @param x The x coordinate of the vinteum crystal
|
||||
* @param y The y coordinate of the vinteum crystal
|
||||
* @param z The z coordinate of the vinteum crystal
|
||||
* @return A map of entity players affected, as well as any metadata relevant to the effect applied on that player.
|
||||
*/
|
||||
public Map<EntityPlayer, Object> ApplyIllEffect(World world, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Gets the localized description of this ill effect as pertains to the affected entity player.
|
||||
* This will only be called based on your own class, so you can assume the metadata matches your metadata output from ApplyIllEffect.
|
||||
*/
|
||||
public String getDescription(EntityPlayer player, Object metadata);
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package am2.api.illeffect;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Base class for all ill effects.
|
||||
*
|
||||
* @author Mithion
|
||||
*/
|
||||
public abstract class IllEffectBase implements IIllEffect{
|
||||
|
||||
@Override
|
||||
public final int compareTo(Object o){
|
||||
if (!(o instanceof IIllEffect)) return 0;
|
||||
IIllEffect right = (IIllEffect)o;
|
||||
int myOrdinal = this.GetSeverity().ordinal();
|
||||
int theirOrdinal = right.GetSeverity().ordinal();
|
||||
|
||||
if (myOrdinal == theirOrdinal){
|
||||
return 0;
|
||||
}else if (myOrdinal < theirOrdinal){
|
||||
return -1;
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract IllEffectSeverity GetSeverity();
|
||||
|
||||
@Override
|
||||
public abstract String getDescription(EntityPlayer player, Object metadata);
|
||||
|
||||
@Override
|
||||
public abstract Map<EntityPlayer, Object> ApplyIllEffect(World world, int x, int y, int z);
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package am2.api.illeffect;
|
||||
|
||||
/**
|
||||
* Varying severities for ill effects during spell creation.
|
||||
*
|
||||
* @author Mithion
|
||||
*/
|
||||
public enum IllEffectSeverity{
|
||||
MINOR,
|
||||
MODERATE,
|
||||
MAJOR,
|
||||
SEVERE,
|
||||
FATAL
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package am2.api.items;
|
||||
|
||||
import am2.api.blocks.IKeystoneLockable;
|
||||
import am2.api.items.KeystoneAccessType;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface IKeystoneHelper{
|
||||
/**
|
||||
* Gets all the keys from all keystones in the entity's inventory
|
||||
*/
|
||||
public ArrayList<Long> GetKeysInInvenory(EntityLivingBase ent);
|
||||
|
||||
/**
|
||||
* Returns the key combination made by the specified runes
|
||||
*
|
||||
* @param runes An array of runes no larger than three elements (anything above will be ignored)
|
||||
* @return
|
||||
*/
|
||||
public long getKeyFromRunes(ItemStack[] runes);
|
||||
|
||||
/**
|
||||
* Returns true or false based on whether the passed in player meets the keystone requirements needed to access the specified container
|
||||
*
|
||||
* @param inventory The inventory the player is trying to access
|
||||
* @param player The player attempting the access check
|
||||
* @param accessMode The operation which you're trying to carry out - this determines the error message if you lack the requisite keystone.
|
||||
* @return True if the conditions are met, otherwise false
|
||||
*/
|
||||
public boolean canPlayerAccess(IKeystoneLockable inventory, EntityPlayer player, KeystoneAccessType accessMode);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package am2.api.items;
|
||||
|
||||
public enum KeystoneAccessType{
|
||||
NONE,
|
||||
USE,
|
||||
BREAK
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package am2.api.items.armor;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
|
||||
public class ArmorTextureEvent extends Event{
|
||||
public final int slot;
|
||||
public final int renderIndex;
|
||||
|
||||
public String texture;
|
||||
|
||||
public ArmorTextureEvent(int slot, int renderIndex){
|
||||
this.slot = slot;
|
||||
this.renderIndex = renderIndex;
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package am2.api.items.armor;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
public interface IArmorImbuement{
|
||||
/**
|
||||
* Gets the ID of the infusion effect. Must be unique.
|
||||
*/
|
||||
String getID();
|
||||
|
||||
/**
|
||||
* Gets the IIcon index for the texture in the GUI
|
||||
*/
|
||||
int getIconIndex();
|
||||
|
||||
/**
|
||||
* Gets the tier for this infusion
|
||||
*/
|
||||
ImbuementTiers getTier();
|
||||
|
||||
/**
|
||||
* Gets all situations under which this infusion applies
|
||||
*/
|
||||
EnumSet<ImbuementApplicationTypes> getApplicationTypes();
|
||||
|
||||
/**
|
||||
* Applies the effect. This will be called when any of the application types is matched in an event.
|
||||
*
|
||||
* @param player The player wearing the armor
|
||||
* @param world The world the player is in
|
||||
* @param stack The itemstack that was matched
|
||||
* @param matchedType The application type that was matched.
|
||||
* @param params Depends on the application type.
|
||||
* <br/>
|
||||
* In the case of ON_TICK, it will be a 1-length array with the first element being the LivingEvent event <br/>
|
||||
* In the case of ON_JUMP, it will be a 1-length array with the first element being the LivingJumpEvent event<br/>
|
||||
* In the case of ON_HIT, it will be a 1-length array with the first element being the LivingHurtEvent event<br/>
|
||||
* In the case of ON_MINING_SPEED, it will be a 1-length array with the first element being the BreakSpeed event <br/>
|
||||
*/
|
||||
boolean applyEffect(EntityPlayer player, World world, ItemStack stack, ImbuementApplicationTypes matchedType, Object... params);
|
||||
|
||||
/**
|
||||
* Gets all armor slots that this effect can be applied to
|
||||
*/
|
||||
int[] getValidSlots();
|
||||
|
||||
/**
|
||||
* If the slot is on cooldown, can the effect still apply?
|
||||
*/
|
||||
boolean canApplyOnCooldown();
|
||||
|
||||
/**
|
||||
* Get the amount of cooldown to add to the slot once the effect applies
|
||||
*/
|
||||
int getCooldown();
|
||||
|
||||
/**
|
||||
* How much does the infusion damage the armor?
|
||||
*/
|
||||
int getArmorDamage();
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package am2.api.items.armor;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
public interface IImbuementRegistry{
|
||||
/**
|
||||
* Registers a new imbuement instance into the system
|
||||
*/
|
||||
void registerImbuement(IArmorImbuement imbuementInstance);
|
||||
|
||||
/**
|
||||
* Locates the specified imbuement registered to the passed-in ID.
|
||||
* Returns null if not found.
|
||||
*/
|
||||
IArmorImbuement getImbuementByID(String ID);
|
||||
|
||||
/**
|
||||
* Returns all imbuements registered into the specified tier for the given armor type (slot).
|
||||
*/
|
||||
IArmorImbuement[] getImbuementsForTier(ImbuementTiers tier, int armorType);
|
||||
|
||||
/**
|
||||
* Is the given imbuement instance present on the passed-in item stack?
|
||||
*/
|
||||
boolean isImbuementPresent(ItemStack stack, IArmorImbuement imbuement);
|
||||
|
||||
/**
|
||||
* Is the given imbuement ID present on the passed-in item stack?
|
||||
*/
|
||||
boolean isImbuementPresent(ItemStack stack, String id);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package am2.api.items.armor;
|
||||
|
||||
public enum ImbuementApplicationTypes{
|
||||
NONE,
|
||||
ON_TICK,
|
||||
ON_HIT,
|
||||
ON_JUMP,
|
||||
ON_MINING_SPEED,
|
||||
ON_DEATH
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package am2.api.items.armor;
|
||||
|
||||
public enum ImbuementTiers{
|
||||
FIRST,
|
||||
SECOND,
|
||||
THIRD,
|
||||
FOURTH
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package am2.api.math;
|
||||
|
||||
public class AMLineSegment{
|
||||
private AMVector3 a, b;
|
||||
|
||||
public AMLineSegment(AMVector3 a, AMVector3 b){
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
public AMVector3 closestPointOnLine(AMVector3 vPoint){
|
||||
|
||||
// Create the vector from end point vA to our point vPoint.
|
||||
AMVector3 vVector1 = vPoint.copy().sub(a);
|
||||
|
||||
// Create a normalized direction vector from end point vA to end point vB
|
||||
AMVector3 vVector2 = b.copy().sub(a).normalize();
|
||||
|
||||
// Use the distance formula to find the distance of the line segment (or magnitude)
|
||||
float d = (float)a.distanceTo(b);
|
||||
|
||||
// Using the dot product, we project the vVector1 onto the vector vVector2.
|
||||
// This essentially gives us the distance from our projected vector from vA.
|
||||
float t = AMVector3.dotProduct(vVector2, vVector1);
|
||||
|
||||
// If our projected distance from vA, "t", is less than or equal to 0, it must
|
||||
// be closest to the end point vA. We want to return this end point.
|
||||
if (t <= 0)
|
||||
return a.copy();
|
||||
|
||||
// If our projected distance from vA, "t", is greater than or equal to the magnitude
|
||||
// or distance of the line segment, it must be closest to the end point vB. So, return vB.
|
||||
if (t >= d)
|
||||
return b.copy();
|
||||
|
||||
AMVector3 vVector3 = vVector2.copy().scale(t);
|
||||
AMVector3 vClosestPoint = a.copy().add(vVector3);
|
||||
|
||||
return vClosestPoint;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package am2.api.math;
|
||||
|
||||
|
||||
public class AMMatrix4{
|
||||
float[] mat;
|
||||
|
||||
public AMMatrix4(){
|
||||
loadIdentity();
|
||||
}
|
||||
|
||||
public AMMatrix4 loadIdentity(){
|
||||
this.mat = new float[16];
|
||||
float tmp35_34 = (this.mat[10] = this.mat[15] = 1.0F);
|
||||
this.mat[5] = tmp35_34;
|
||||
this.mat[0] = tmp35_34;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AMVector3 translate(AMVector3 vec){
|
||||
float x = vec.x * this.mat[0] + vec.y * this.mat[1] + vec.z * this.mat[2] + this.mat[3];
|
||||
float y = vec.x * this.mat[4] + vec.y * this.mat[5] + vec.z * this.mat[6] + this.mat[7];
|
||||
float z = vec.x * this.mat[8] + vec.y * this.mat[9] + vec.z * this.mat[10] + this.mat[11];
|
||||
vec.x = x;
|
||||
vec.y = y;
|
||||
vec.z = z;
|
||||
return vec;
|
||||
}
|
||||
|
||||
public static AMMatrix4 rotationMat(double angle, AMVector3 axis){
|
||||
axis = axis.copy().normalize();
|
||||
float x = axis.x;
|
||||
float y = axis.y;
|
||||
float z = axis.z;
|
||||
angle *= 0.0174532925D;
|
||||
float cos = (float)Math.cos(angle);
|
||||
float ocos = 1.0F - cos;
|
||||
float sin = (float)Math.sin(angle);
|
||||
AMMatrix4 rotmat = new AMMatrix4();
|
||||
rotmat.mat[0] = (x * x * ocos + cos);
|
||||
rotmat.mat[1] = (y * x * ocos + z * sin);
|
||||
rotmat.mat[2] = (x * z * ocos - y * sin);
|
||||
rotmat.mat[4] = (x * y * ocos - z * sin);
|
||||
rotmat.mat[5] = (y * y * ocos + cos);
|
||||
rotmat.mat[6] = (y * z * ocos + x * sin);
|
||||
rotmat.mat[8] = (x * z * ocos + y * sin);
|
||||
rotmat.mat[9] = (y * z * ocos - x * sin);
|
||||
rotmat.mat[10] = (z * z * ocos + cos);
|
||||
rotmat.mat[15] = 1.0F;
|
||||
return rotmat;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package am2.api.math;
|
||||
|
||||
public class AMPlane{
|
||||
AMVector3 planeDef[];
|
||||
|
||||
public AMPlane(AMVector3... plane){
|
||||
planeDef = plane;
|
||||
}
|
||||
|
||||
private AMVector3 planeNormal(){
|
||||
AMVector3 vVector1 = new AMVector3(planeDef[2], planeDef[0]);
|
||||
AMVector3 vVector2 = new AMVector3(planeDef[1], planeDef[0]);
|
||||
|
||||
AMVector3 vNormal = AMVector3.crossProduct(vVector1, vVector2);
|
||||
|
||||
vNormal.normalize();
|
||||
return vNormal;
|
||||
}
|
||||
|
||||
private float planeDistance(AMVector3 normal, AMVector3 point){
|
||||
float distance = 0;
|
||||
distance = -((normal.x * point.x) + (normal.y * point.y) + (normal.z * point.z));
|
||||
|
||||
return distance;
|
||||
}
|
||||
|
||||
public boolean lineSegmentCrosses(AMVector3 p1, AMVector3 p2){
|
||||
float distance1 = 0, distance2 = 0;
|
||||
|
||||
AMVector3 vNormal = planeNormal();
|
||||
|
||||
float originDistance = planeDistance(vNormal, planeDef[0]);
|
||||
|
||||
distance1 = ((vNormal.x * p1.x) + // Ax +
|
||||
(vNormal.y * p1.y) + // Bx +
|
||||
(vNormal.z * p1.z)) + originDistance; // Cz + D
|
||||
|
||||
distance2 = ((vNormal.x * p2.x) + // Ax +
|
||||
(vNormal.y * p2.y) + // Bx +
|
||||
(vNormal.z * p2.z)) + originDistance; // Cz + D
|
||||
|
||||
if (distance1 * distance2 >= 0) // Check to see if both point's distances are both negative or both positive
|
||||
return false; // Return false if each point has the same sign. -1 and 1 would mean each point is on either side of the plane. -1 -2 or 3 4 wouldn't...
|
||||
|
||||
return true; // The line intersected the plane, Return TRUE
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package am2.api.math;
|
||||
|
||||
public class AMVector2{
|
||||
public double x;
|
||||
public double y;
|
||||
|
||||
public int iX;
|
||||
public int iY;
|
||||
|
||||
public AMVector2(double x, double y){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.iX = (int)x;
|
||||
this.iY = (int)y;
|
||||
}
|
||||
|
||||
public AMVector2 subtract(AMVector2 vec){
|
||||
return new AMVector2(this.x - vec.x, this.y - vec.y);
|
||||
}
|
||||
|
||||
public AMVector2 add(AMVector2 vec){
|
||||
return new AMVector2(this.x + vec.x, this.y + vec.y);
|
||||
}
|
||||
|
||||
public AMVector2 multiply(AMVector2 vec){
|
||||
return new AMVector2(this.x * vec.x, this.y * vec.y);
|
||||
}
|
||||
|
||||
public AMVector2 divide(AMVector2 vec){
|
||||
return new AMVector2(this.x / vec.x, this.y / vec.y);
|
||||
}
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
package am2.api.math;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class AMVector3{
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
|
||||
public AMVector3(double x, double y, double z){
|
||||
this.x = (float)x;
|
||||
this.y = (float)y;
|
||||
this.z = (float)z;
|
||||
}
|
||||
|
||||
public AMVector3(TileEntity tile){
|
||||
this.x = (tile.xCoord);
|
||||
this.y = (tile.yCoord);
|
||||
this.z = (tile.zCoord);
|
||||
}
|
||||
|
||||
public AMVector3(Vec3 vec){
|
||||
this.x = (float)vec.xCoord;
|
||||
this.y = (float)vec.yCoord;
|
||||
this.z = (float)vec.zCoord;
|
||||
}
|
||||
|
||||
public AMVector3(AMVector3 a, AMVector3 b){
|
||||
this.x = a.x - b.x; // Get the X value of our new vector
|
||||
this.y = a.y - b.y; // Get the Y value of our new vector
|
||||
this.z = a.z - b.z; // Get the Z value of our new vector
|
||||
}
|
||||
|
||||
public AMVector3(Entity entity){
|
||||
this(entity.posX, entity.posY, entity.posZ);
|
||||
}
|
||||
|
||||
public AMVector3 add(AMVector3 vec){
|
||||
this.x += vec.x;
|
||||
this.y += vec.y;
|
||||
this.z += vec.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AMVector3 sub(AMVector3 vec){
|
||||
this.x -= vec.x;
|
||||
this.y -= vec.y;
|
||||
this.z -= vec.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AMVector3 scale(float scale){
|
||||
this.x *= scale;
|
||||
this.y *= scale;
|
||||
this.z *= scale;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AMVector3 scale(float scalex, float scaley, float scalez){
|
||||
this.x *= scalex;
|
||||
this.y *= scaley;
|
||||
this.z *= scalez;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AMVector3 modulo(float divisor){
|
||||
this.x %= divisor;
|
||||
this.y %= divisor;
|
||||
this.z %= divisor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AMVector3 normalize(){
|
||||
float length = length();
|
||||
this.x /= length;
|
||||
this.y /= length;
|
||||
this.z /= length;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float length(){
|
||||
return (float)Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
||||
}
|
||||
|
||||
public float lengthPow2(){
|
||||
return this.x * this.x + this.y * this.y + this.z * this.z;
|
||||
}
|
||||
|
||||
public AMVector3 copy(){
|
||||
return new AMVector3(this.x, this.y, this.z);
|
||||
}
|
||||
|
||||
public static AMVector3 crossProduct(AMVector3 vec1, AMVector3 vec2){
|
||||
return new AMVector3(vec1.y * vec2.z - vec1.z * vec2.y, vec1.z * vec2.x - vec1.x * vec2.z, vec1.x * vec2.y - vec1.y * vec2.x);
|
||||
}
|
||||
|
||||
public static AMVector3 xCrossProduct(AMVector3 vec){
|
||||
return new AMVector3(0.0D, vec.z, -vec.y);
|
||||
}
|
||||
|
||||
public static AMVector3 zCrossProduct(AMVector3 vec){
|
||||
return new AMVector3(-vec.y, vec.x, 0.0D);
|
||||
}
|
||||
|
||||
public static float dotProduct(AMVector3 vec1, AMVector3 vec2){
|
||||
return (vec1.x * vec2.x) + (vec1.y * vec2.y) + (vec1.z * vec2.z);
|
||||
}
|
||||
|
||||
public static float angle(AMVector3 vec1, AMVector3 vec2){
|
||||
return anglePreNorm(vec1.copy().normalize(), vec2.copy().normalize());
|
||||
}
|
||||
|
||||
public static float anglePreNorm(AMVector3 vec1, AMVector3 vec2){
|
||||
return (float)Math.acos(dotProduct(vec1, vec2));
|
||||
}
|
||||
|
||||
public static AMVector3 zero(){
|
||||
return new AMVector3(0, 0, 0);
|
||||
}
|
||||
|
||||
public AMVector3 rotate(float angle, AMVector3 axis){
|
||||
return AMMatrix4.rotationMat(angle, axis).translate(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return "[" + this.x + "," + this.y + "," + this.z + "]";
|
||||
}
|
||||
|
||||
public Vec3 toVec3D(){
|
||||
return Vec3.createVectorHelper(this.x, this.y, this.z);
|
||||
}
|
||||
|
||||
public static AMVector3 getPerpendicular(AMVector3 vec){
|
||||
if (vec.z == 0.0F){
|
||||
return zCrossProduct(vec);
|
||||
}
|
||||
return xCrossProduct(vec);
|
||||
}
|
||||
|
||||
public boolean isZero(){
|
||||
return (this.x == 0.0F) && (this.y == 0.0F) && (this.z == 0.0F);
|
||||
}
|
||||
|
||||
public boolean isWithinRange(float min, float max){
|
||||
return (this.x >= min && x <= max) && (this.y >= min && this.y <= max) && (this.z >= min && this.z <= max);
|
||||
}
|
||||
|
||||
public double distanceTo(AMVector3 target){
|
||||
double var2 = target.x - this.x;
|
||||
double var4 = target.y - this.y;
|
||||
double var6 = target.z - this.z;
|
||||
return MathHelper.sqrt_double(var2 * var2 + var4 * var4 + var6 * var6);
|
||||
}
|
||||
|
||||
public double distanceSqTo(AMVector3 target){
|
||||
double var2 = target.x - this.x;
|
||||
double var4 = target.y - this.y;
|
||||
double var6 = target.z - this.z;
|
||||
return var2 * var2 + var4 * var4 + var6 * var6;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Rounds all values in this Vector to their integral floors
|
||||
*/
|
||||
public void floorToI(){
|
||||
this.x = (float)Math.floor(this.x);
|
||||
this.y = (float)Math.floor(this.y);
|
||||
this.z = (float)Math.floor(this.z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rounds all values in this Vector to their integral logical roundings
|
||||
*/
|
||||
public void roundToI(){
|
||||
this.x = Math.round(this.x);
|
||||
this.y = Math.round(this.y);
|
||||
this.z = Math.round(this.z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rounds all values in this Vector to their integral ceilings
|
||||
*/
|
||||
public void ceilToI(){
|
||||
this.x = (float)Math.ceil(this.x);
|
||||
this.y = (float)Math.ceil(this.y);
|
||||
this.z = (float)Math.ceil(this.z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the vector3 to the specified compound - note that the way this function works, only one vector3 can be written to a compound at a time.
|
||||
* Use sub-compounds if you need more!
|
||||
*/
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
compound.setFloat("Vec3_x", x);
|
||||
compound.setFloat("Vec3_y", y);
|
||||
compound.setFloat("Vec3_z", z);
|
||||
}
|
||||
|
||||
public static AMVector3 readFromNBT(NBTTagCompound compound){
|
||||
return new AMVector3(compound.getFloat("Vec3_x"), compound.getFloat("Vec3_y"), compound.getFloat("Vec3_z"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj){
|
||||
if (obj instanceof AMVector3){
|
||||
AMVector3 comp = (AMVector3)obj;
|
||||
return (comp.x == this.x && comp.y == this.y && comp.z == this.z);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode(){
|
||||
return (int)(x + y + z);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package am2.api.particles;
|
||||
|
||||
public interface IBeamParticle{
|
||||
/**
|
||||
* Sets the beam type. Determines the texture of the beam. Valid types are 0-2.
|
||||
*/
|
||||
public void setType(int type);
|
||||
|
||||
/**
|
||||
* Sets the color from a single integer. Good for hex colors.
|
||||
*/
|
||||
public void setRGBColor(int color);
|
||||
|
||||
/**
|
||||
* Sets the beam color from 3 int values (0-255).
|
||||
*/
|
||||
public void setRGBColorI(int r, int g, int b);
|
||||
|
||||
/**
|
||||
* Sets the beam color from 3 floating point values (0.0f - 1.0f)
|
||||
*/
|
||||
public void setRGBColorF(float r, float g, float b);
|
||||
|
||||
/**
|
||||
* Indicates that this beam is being cast by a player that is in first person. Should only be called when creating a beam from the local player, if the player is in first person.
|
||||
* <br />
|
||||
* This will offset the beam to make it look like it is coming from the player's active item and not their face.
|
||||
*/
|
||||
public void setFirstPersonPlayerCast();
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package am2.api.potion;
|
||||
|
||||
public interface IBuffHelper{
|
||||
/*
|
||||
* Potion Names:
|
||||
|
||||
waterBreathing
|
||||
flight
|
||||
slowfall
|
||||
haste
|
||||
trueSight
|
||||
regeneration
|
||||
magicShield
|
||||
charmed
|
||||
frostSlowed
|
||||
temporalAnchor
|
||||
manaRegen
|
||||
entangled
|
||||
wateryGrave
|
||||
spellReflect
|
||||
silence
|
||||
swiftSwim
|
||||
agility
|
||||
leap
|
||||
gravityWell
|
||||
astralDistortion
|
||||
levitation
|
||||
clarity
|
||||
illumination
|
||||
manaBoost
|
||||
manaShield
|
||||
fury
|
||||
scrambleSynapses
|
||||
shrink
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns the ID of an AM buff, or -1 if not found.
|
||||
*
|
||||
* @param name The name of the potion to find. Case sensitive.
|
||||
*/
|
||||
public int getPotionID(String name);
|
||||
|
||||
/**
|
||||
* Adds a potion to the dispel blacklist, essentially making it un-dispellable.
|
||||
*
|
||||
* @param id The id to cause dispel to ignore.
|
||||
* @return True on success, otherwise false.
|
||||
*/
|
||||
public void addDispelExclusion(int id);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package am2.api.power;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IObeliskFuelHelper{
|
||||
/**
|
||||
* Registers a new fuel type for the obelisk to burn
|
||||
*
|
||||
* @param stack The stack to use as a comparator (stackSize is ignored, just use 1)
|
||||
* @param burnTime How long the obelisk should burn for when given one of these items
|
||||
*/
|
||||
public void registerFuelType(ItemStack stack, int burnTime);
|
||||
|
||||
/**
|
||||
* Retrieves the burn time for the specified stack. Returns 0 if it is not a valid fuel.
|
||||
*/
|
||||
public int getFuelBurnTime(ItemStack stack);
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package am2.api.power;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* @author Mithion
|
||||
* This will eventually allow you to interface with the AM power network - currently it is not fully working.
|
||||
*/
|
||||
public interface IPowerNode<T extends TileEntity>{
|
||||
|
||||
/**
|
||||
* Gets the current capacity in the power block
|
||||
*/
|
||||
public float getCapacity();
|
||||
|
||||
/**
|
||||
* Can this block provide power?
|
||||
*
|
||||
* @param type The power type we are checking for
|
||||
*/
|
||||
public boolean canProvidePower(PowerTypes type);
|
||||
|
||||
/**
|
||||
* Can this block relay power?
|
||||
*
|
||||
* @param type The type of power we are looking for
|
||||
*/
|
||||
public boolean canRelayPower(PowerTypes type);
|
||||
|
||||
/**
|
||||
* Can this block request power?
|
||||
*/
|
||||
public boolean canRequestPower();
|
||||
|
||||
/**
|
||||
* Is this block a nexus?
|
||||
*/
|
||||
public boolean isSource();
|
||||
|
||||
/**
|
||||
* How fast does this block charge?
|
||||
*/
|
||||
public int getChargeRate();
|
||||
|
||||
/**
|
||||
* Gets the current power type of the block.
|
||||
*/
|
||||
public PowerTypes[] getValidPowerTypes();
|
||||
|
||||
/**
|
||||
* Offset of any particle effects to the origin of the block
|
||||
*
|
||||
* @param axis The axis in question. 0=x, 1=y, 2=z
|
||||
*/
|
||||
public float particleOffset(int axis);
|
||||
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package am2.api.power;
|
||||
|
||||
import am2.LogHelper;
|
||||
import am2.api.ArsMagicaApi;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public final class PowerTypes{
|
||||
|
||||
public static final PowerTypes NONE = new PowerTypes(0, "None", "\u00A7f");
|
||||
public static final PowerTypes LIGHT = new PowerTypes(1, "Light", "\u00A7b");
|
||||
public static final PowerTypes NEUTRAL = new PowerTypes(2, "Neutral", "\u00A71");
|
||||
public static final PowerTypes DARK = new PowerTypes(4, "Dark", "\u00A74");
|
||||
|
||||
private static final ArrayList<PowerTypes> allPowerTypes = new ArrayList<PowerTypes>(){{
|
||||
add(LIGHT);
|
||||
add(NEUTRAL);
|
||||
add(DARK);
|
||||
}};
|
||||
|
||||
private int _id;
|
||||
private String _name;
|
||||
private String _chatColor;
|
||||
|
||||
private PowerTypes(int ID, String name, String chatColor){
|
||||
if ((ID & -ID) != ID){
|
||||
throw new InvalidParameterException(String.format("ID must be a bitflag that is a power of 2! (You used %d)", ID));
|
||||
}
|
||||
_id = ID;
|
||||
_name = name;
|
||||
_chatColor = chatColor;
|
||||
}
|
||||
|
||||
public static void RegisterPowerType(int id, String name, String chatColor){
|
||||
if (getByID(id) == NONE){
|
||||
LogHelper.info("Attempted to register power type %s with ID of %d, but that ID is already taken! The type was NOT registered!", name, id);
|
||||
}else{
|
||||
allPowerTypes.add(new PowerTypes(id, name, chatColor));
|
||||
LogHelper.info("Registered new power type %s with ID %d", name, id);
|
||||
}
|
||||
}
|
||||
|
||||
public int ID(){
|
||||
return _id;
|
||||
}
|
||||
|
||||
public String name(){
|
||||
return _name;
|
||||
}
|
||||
|
||||
public String chatColor(){
|
||||
if (ArsMagicaApi.instance.getColourblindMode()){
|
||||
return "";
|
||||
}
|
||||
return _chatColor;
|
||||
}
|
||||
|
||||
public static PowerTypes[] all(){
|
||||
return allPowerTypes.toArray(new PowerTypes[allPowerTypes.size()]);
|
||||
}
|
||||
|
||||
public static PowerTypes getByID(int id){
|
||||
for (PowerTypes type : all())
|
||||
if (type.ID() == id)
|
||||
return type;
|
||||
return NONE;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package am2.api.spell;
|
||||
|
||||
import am2.api.spell.component.interfaces.ISkillTreeEntry;
|
||||
import am2.api.spell.enums.SkillPointTypes;
|
||||
import am2.api.spell.enums.SkillTrees;
|
||||
|
||||
public interface ISkillTreeManager{
|
||||
/**
|
||||
* Registers a spell part into the skill tree (where it can be unlocked).
|
||||
* Pass a null prerequisite for no prerequisite.
|
||||
* Throws an exception if the prerequisite passed in is not a registered entry in the skill tree, or if it is in a different tree.
|
||||
*
|
||||
* @param shape The shape to register
|
||||
* @param x The x-coordinate in the skill tree to display the shape IIcon
|
||||
* @param y The y-coordinate in the skill tree to display the shape IIcon
|
||||
* @param tree The skill tree to register the shape into
|
||||
* @param prerequisites The prerequisite skills needed for the shape.
|
||||
*/
|
||||
public void RegisterPart(ISkillTreeEntry part, int x, int y, SkillTrees tree, SkillPointTypes requiredPoint, ISkillTreeEntry... prerequisites);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package am2.api.spell;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface ISpellIconManager{
|
||||
/**
|
||||
* Returns the IIcon registered to the specified spell name. Returns the missing IIcon if one doesn't exist.
|
||||
*/
|
||||
public IIcon getIcon(String spellName);
|
||||
|
||||
/**
|
||||
* Registers an IIcon to be associated with a spell component
|
||||
*
|
||||
* @param spellName The unlocalized name of the spell used when it was registered
|
||||
* @param IIcon The IIcon of the spell
|
||||
*/
|
||||
public void registerIcon(String spellName, IIcon IIcon);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package am2.api.spell;
|
||||
|
||||
import am2.api.spell.component.interfaces.ISkillTreeEntry;
|
||||
|
||||
public interface ISpellPartManager{
|
||||
/**
|
||||
* Registers the skill tree entry into the skill manager.
|
||||
*
|
||||
* @param component The skill tree entry to register
|
||||
* @param name The unlocalized name you want to register it to. Local translations are am2.spell.unlocalized_name, so register this into the language registry for localization.
|
||||
* @return The shifted numeric ID that is used, this should be stored somewhere
|
||||
*/
|
||||
public int registerSkillTreeEntry(ISkillTreeEntry component, String name);
|
||||
|
||||
/**
|
||||
* @param ID The shifted ID of the skill.
|
||||
* @return The skill tree entry or null if not found.
|
||||
*/
|
||||
public ISkillTreeEntry getSkill(int ID);
|
||||
|
||||
/**
|
||||
* @param name The unlocalized name of the skill
|
||||
* @return The skill tree entry or null if not found.
|
||||
*/
|
||||
public ISkillTreeEntry getSkill(String name);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package am2.api.spell;
|
||||
|
||||
import am2.api.spell.enums.SpellModifiers;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ISpellUtils{
|
||||
|
||||
public double getModifiedDouble_Mul(double defaultValue, ItemStack stack, EntityLivingBase caster, Entity target, World world, SpellModifiers check);
|
||||
|
||||
public int getModifiedInt_Mul(int defaultValue, ItemStack stack, EntityLivingBase caster, Entity target, World world, SpellModifiers check);
|
||||
|
||||
public double getModifiedDouble_Mul(SpellModifiers check, ItemStack stack, EntityLivingBase caster, Entity target, World world);
|
||||
|
||||
public int getModifiedInt_Mul(SpellModifiers check, ItemStack stack, EntityLivingBase caster, Entity target, World world);
|
||||
|
||||
public double getModifiedDouble_Add(double defaultValue, ItemStack stack, EntityLivingBase caster, Entity target, World world, SpellModifiers check);
|
||||
|
||||
public int getModifiedInt_Add(int defaultValue, ItemStack stack, EntityLivingBase caster, Entity target, World world, SpellModifiers check);
|
||||
|
||||
public double getModifiedDouble_Add(SpellModifiers check, ItemStack stack, EntityLivingBase caster, Entity target, World world);
|
||||
|
||||
public int getModifiedInt_Add(SpellModifiers check, ItemStack stack, EntityLivingBase caster, Entity target, World world);
|
||||
|
||||
public boolean modifierIsPresent(SpellModifiers check, ItemStack stack);
|
||||
|
||||
public int countModifiers(SpellModifiers check, ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package am2.api.spell;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* This is just here for reference - you shouldn't have any need to inherit from this item. To add new parts to spells, inherit from ISpellShape, ISpellModifier, or ISpellComponent.
|
||||
*
|
||||
* @author Mithion
|
||||
*/
|
||||
public abstract class ItemSpellBase extends Item{
|
||||
public ItemSpellBase(){
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specific version of getMovingObjectPosition that takes into account the targeting types that I need
|
||||
*
|
||||
* @param caster The caster of the spell
|
||||
* @param world The world the spell is being cast in
|
||||
* @param range The range to raycast
|
||||
* @param targetEntities Stop at collision with entities
|
||||
* @param targetWater Stop at collision with any non-solid block
|
||||
* @return A MovingObjectPosition instance if a collision was found, null otherwise
|
||||
*/
|
||||
public abstract MovingObjectPosition getMovingObjectPosition(EntityLivingBase caster, World world, double range, boolean targetEntities, boolean targetWater);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package am2.api.spell.component.interfaces;
|
||||
|
||||
import am2.api.blocks.MultiblockStructureDefinition;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IRitualInteraction<T extends ISkillTreeEntry>{
|
||||
/**
|
||||
* Gets a MultiblockStructureDefinition outlining the ritual blocks needed and where they should be relative to a given location.
|
||||
* This should be instantiated on mod load and cached somewhere, and NOT instantiated upon request.
|
||||
*/
|
||||
public MultiblockStructureDefinition getRitualShape();
|
||||
|
||||
/**
|
||||
* Gets a list of items that need to be present in {@link #getReagentSearchRadius() getReagentSearchRadius()} for the ritual to match.
|
||||
* Items on the ground as well as items attached to Wizard's Chalk are included.
|
||||
*/
|
||||
public ItemStack[] getReagents();
|
||||
|
||||
/**
|
||||
* Gets the radius to search for reagents when checking the ritual.
|
||||
*/
|
||||
public int getReagentSearchRadius();
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package am2.api.spell.component.interfaces;
|
||||
|
||||
public interface ISkillTreeEntry{
|
||||
/**
|
||||
* Gets the ID of the skill. Must be unique among all other skills.
|
||||
*
|
||||
* @return The ID of the part.
|
||||
*/
|
||||
public int getID();
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package am2.api.spell.component.interfaces;
|
||||
|
||||
import am2.api.spell.enums.Affinity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
public interface ISpellComponent extends ISpellPart{
|
||||
/**
|
||||
* Apply the effect to a single block
|
||||
*
|
||||
* @param stack The item stack that contains the effect data
|
||||
* @param world The world the effect is in
|
||||
* @param blockx The x coordinate of the block
|
||||
* @param blocky The y coordinate of the block
|
||||
* @param blockz The z coordinate of the block
|
||||
* @param blockFace The face of the block that was targeted
|
||||
* @param impactX The x coordinate of the impact
|
||||
* @param impactY The y coordinate of the impact
|
||||
* @param impactZ The z coordinate of the impact
|
||||
* @param caster The caster of the spell
|
||||
* @return True if the effect was successfully applied to the block
|
||||
*/
|
||||
public boolean applyEffectBlock(ItemStack stack, World world, int blockx, int blocky, int blockz, int blockFace, double impactX, double impactY, double impactZ, EntityLivingBase caster);
|
||||
|
||||
/**
|
||||
* Apply the effect to a single entity
|
||||
*
|
||||
* @param stack The stack representing the spell
|
||||
* @param world The world the spell was cast in
|
||||
* @param caster The caster of the spell
|
||||
* @param target The current target of the spell
|
||||
* @return True if the effect was applied successfully to the entity
|
||||
*/
|
||||
public boolean applyEffectEntity(ItemStack stack, World world, EntityLivingBase caster, Entity target);
|
||||
|
||||
/**
|
||||
* Gets the mana cost of the spell
|
||||
*/
|
||||
public float manaCost(EntityLivingBase caster);
|
||||
|
||||
/**
|
||||
* Gets the burnout of the spell
|
||||
*/
|
||||
public float burnout(EntityLivingBase caster);
|
||||
|
||||
/**
|
||||
* Gets any reagents that must be present in the caster's inventory in order
|
||||
* to cast the spell.
|
||||
*/
|
||||
public ItemStack[] reagents(EntityLivingBase caster);
|
||||
|
||||
/**
|
||||
* Spawn visual effects for the component
|
||||
*
|
||||
* @param colorModifier The color from the color modifier. -1 if missing.
|
||||
*/
|
||||
public void spawnParticles(World world, double x, double y, double z, EntityLivingBase caster, Entity target, Random rand, int colorModifier);
|
||||
|
||||
/**
|
||||
* Gets the affinity of the spell
|
||||
*/
|
||||
public EnumSet<Affinity> getAffinity();
|
||||
|
||||
/**
|
||||
* Gets the amount (before diminishing returns) that this component, when successfully applied,
|
||||
* shifts the caster's affinity
|
||||
*
|
||||
* @param affinity The affinity being shifted
|
||||
*/
|
||||
public float getAffinityShift(Affinity affinity);
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package am2.api.spell.component.interfaces;
|
||||
|
||||
import am2.api.spell.enums.SpellModifiers;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
public interface ISpellModifier extends ISpellPart{
|
||||
/**
|
||||
* Returns a list of the aspects of a spell that this modifier can change.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public EnumSet<SpellModifiers> getAspectsModified();
|
||||
|
||||
/**
|
||||
* Returns the modified value for the specified type.
|
||||
*
|
||||
* @param type The type of value we are modifying
|
||||
* @param caster The caster
|
||||
* @param target The target (can be the same as the caster)
|
||||
* @param world The world in which the spell is being cast.
|
||||
* @param metadata Any metadata written to the spell for this modifier (obtained from getModifierMetadata)
|
||||
* @return A factor to multiply the default value by (or add, depending on the component's programming)
|
||||
*/
|
||||
public float getModifier(SpellModifiers type, EntityLivingBase caster, Entity target, World world, byte[] metadata);
|
||||
|
||||
/**
|
||||
* Gets the amount that adding this modifier to the spell alters the mana cost.
|
||||
*
|
||||
* @param spellStack The itemstack comprising the spell (in case you want to base it on other modifiers added)
|
||||
* @param stage The stage in which this modifier has been added (if the modifier is added to multiple stages, this will be called multiple times, once per stage)
|
||||
* @param quantity The quantity of this multiplier in the specified stage.
|
||||
*/
|
||||
public float getManaCostMultiplier(ItemStack spellStack, int stage, int quantity);
|
||||
|
||||
/**
|
||||
* Gets any metadata needed by this modifier for the current spell. Used, for example, in the color modifier to determine what color was specified.
|
||||
*
|
||||
* @param stage The stage this modifier is at
|
||||
* @param matchedRecipe The items that were added to the crafting altar which resulted in the matching of the recipe.
|
||||
*/
|
||||
public byte[] getModifierMetadata(ItemStack[] matchedRecipe);
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package am2.api.spell.component.interfaces;
|
||||
|
||||
/**
|
||||
* Identifies that this object is either a spell component, a spell modifier, or a spell shape.
|
||||
* Do not inherit this directly unless you are adding talents and such, rather inherit ISpellComponent, ISpellModifier, or ISpellShape for spell parts.
|
||||
*
|
||||
* @author Mithion
|
||||
*/
|
||||
public interface ISpellPart extends ISkillTreeEntry{
|
||||
|
||||
/**
|
||||
* recipe items, in order, that need to be thrown into the crafting altar in order to create the item.
|
||||
* <br/>
|
||||
* Use Items for items, Blocks for blocks, Strings for OreDictionary items, and E:[type flag] followed by an integer for essence amounts.
|
||||
* <br/>
|
||||
* Use itemstacks for items/blocks/oredict when meta is required. By default it is meta 0. Quantity (stack size) is ignored.
|
||||
* <br/>
|
||||
* Integer pairs represent the type (*=any, 1=neutral, 2=light, 4=dark, etc.), and the quantity of essence required. The type can be used as flags,
|
||||
* <br/>
|
||||
* For example:
|
||||
* <pre>
|
||||
* new Object[]{ "E:1|2", 1500 } //require 1500 of neutral or 1500 of light power.
|
||||
* new Object[]{ "E:*", 1500 } //require 1500 of any kind of power
|
||||
* etc.
|
||||
* </pre>
|
||||
*/
|
||||
public Object[] getRecipeItems();
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package am2.api.spell.component.interfaces;
|
||||
|
||||
import am2.api.spell.ItemSpellBase;
|
||||
import am2.api.spell.enums.Affinity;
|
||||
import am2.api.spell.enums.SpellCastResult;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ISpellShape extends ISpellPart{
|
||||
/**
|
||||
* Creates the target area/entity list and applies the effects to ground/mobs
|
||||
*
|
||||
* @param item The spell being cast
|
||||
* @param stack The itemstack representing the spell
|
||||
* @param caster The caster of the spell
|
||||
* @param target The specified target of the spell. If this is not NULL, this is a forced target, and should be included with any other targets of the shape. Otherwise the default spell shape logic should apply.
|
||||
* @param world The world the spell is being cast in
|
||||
* @param x The x-coordinate of the spell's effect
|
||||
* @param y The y-coordinate of the spell's effect
|
||||
* @param z The z-coordinate of the spell's effect
|
||||
* @param side The side the spell is applied on
|
||||
* @param giveXP This is passed along to be given back to the SpellHelper where needed.
|
||||
* @param useCount The number of ticks the spell item has been in use for
|
||||
* @return The result of the spell cast.
|
||||
*/
|
||||
public SpellCastResult beginStackStage(ItemSpellBase item, ItemStack stack, EntityLivingBase caster, EntityLivingBase target, World world, double x, double y, double z, int side, boolean giveXP, int useCount);
|
||||
|
||||
/**
|
||||
* Is this shape a valid shape for a channeled/maintained spell?
|
||||
*/
|
||||
public boolean isChanneled();
|
||||
|
||||
/**
|
||||
* Allows different shapes to vary the mana cost of a spell
|
||||
*
|
||||
* @param spellStack the itemstack representing the spell (useful if you want to vary based on added modifiers as well, for example)
|
||||
* @return
|
||||
*/
|
||||
public float manaCostMultiplier(ItemStack spellStack);
|
||||
|
||||
/**
|
||||
* Is the spell a terminus shape? Return true if this component does not continue the spell chain when proccing.
|
||||
*/
|
||||
public boolean isTerminusShape();
|
||||
|
||||
/**
|
||||
* Is the shape a principal shape? Return true if this spell requires another shape to proc (like runes and zones)
|
||||
*/
|
||||
public boolean isPrincipumShape();
|
||||
|
||||
/**
|
||||
* Play the sound for the specified affinity
|
||||
*/
|
||||
public String getSoundForAffinity(Affinity affinity, ItemStack stack, World world);
|
||||
}
|
||||
@@ -1,193 +0,0 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public enum Affinity{
|
||||
NONE(0,
|
||||
0xFFFFFF,
|
||||
-1, //no direct opposite
|
||||
new int[]{}, //no major opposites
|
||||
new int[]{}, //no minor opposites
|
||||
new int[]{}),
|
||||
|
||||
ARCANE(1,
|
||||
0xb935cd,
|
||||
9, //nature is direct opposite
|
||||
new int[]{9, 4, 2, 7}, //Major Opposites: life, earth, water, ice
|
||||
new int[]{5, 10}, //Minor Opposites: Air, Ender
|
||||
new int[]{6, 3}), //Adjacent Affinities: Lightning, Fire
|
||||
|
||||
WATER(2,
|
||||
0x0b5cef,
|
||||
3, //fire is direct opposite
|
||||
new int[]{7, 4, 1, 10}, //Major Opposites: lightning, earth, arcane, ender
|
||||
new int[]{5, 7}, //Minor Opposites: Air, Ice
|
||||
new int[]{9, 8}), //Adjacent Affinities: Life, Nature
|
||||
|
||||
FIRE(3,
|
||||
0xef260b,
|
||||
2, //water is direct opposite
|
||||
new int[]{5, 7, 8, 9}, //Major Opposites: air, ice, nature, life
|
||||
new int[]{4, 6}, //Minor Opposites: Earth, Lightning
|
||||
new int[]{10, 1}), //Adjacent Affinities: Ender, Arcane
|
||||
|
||||
EARTH(4,
|
||||
0x61330b,
|
||||
5, //air is direct opposite
|
||||
new int[]{2, 1, 9, 6}, //Major Opposites: water, arcane, life, lightning
|
||||
new int[]{8, 3}, //Minor Opposites: Nature, Fire
|
||||
new int[]{7, 10}), //Adjacent Affinities: Ice, Ender
|
||||
|
||||
AIR(5,
|
||||
0x777777,
|
||||
4, //earth is direct opposite
|
||||
new int[]{8, 3, 7, 10}, //Major Opposites: nature, fire, ice, ender
|
||||
new int[]{2, 1}, //Minor Opposites: Water, Arcane
|
||||
new int[]{9, 6}), //Adjacent Affinities: Life, Lightning
|
||||
|
||||
LIGHTNING(6,
|
||||
0xdece19,
|
||||
7, //ice is direct opposite
|
||||
new int[]{2, 10, 8, 4}, //Major Opposites: water, ender, nature, earth
|
||||
new int[]{9, 3}, //Minor Opposites: Life, Fire
|
||||
new int[]{5, 1}), //Adjacent Affinities: Air, Arcane
|
||||
|
||||
ICE(7,
|
||||
0xd3e8fc,
|
||||
6, //lightning is direct opposite
|
||||
new int[]{9, 3, 5, 1}, //Major Opposites: life, fire, air, arcane
|
||||
new int[]{2, 10}, //Minor Opposites: Water, Ender
|
||||
new int[]{8, 4}), //Adjacent Affinities: Nature, Earth
|
||||
|
||||
NATURE(8,
|
||||
0x228718,
|
||||
6, //arcane is direct opposite
|
||||
new int[]{5, 10, 6, 3}, //Major Opposites: air, ender, lightning, fire
|
||||
new int[]{9, 4}, //Minor Opposites: Life, Earth
|
||||
new int[]{2, 7}), //Adjacent Affinities: Water, Ice
|
||||
|
||||
LIFE(9,
|
||||
0x34e122,
|
||||
10, //ender is direct opposite
|
||||
new int[]{1, 7, 3, 4}, //Major Opposites: arcane, ice, fire, earth
|
||||
new int[]{8, 6}, //Minor Opposites: Nature, Lightning
|
||||
new int[]{2, 5}), //Adjacent Affinities: Water, Air
|
||||
|
||||
ENDER(10,
|
||||
0x3f043d,
|
||||
9, //life is direct opposite
|
||||
new int[]{8, 6, 2, 5}, //Major Opposites: nature, lightning, water, air
|
||||
new int[]{1, 7}, //Minor Opposites: Arcane, Ice
|
||||
new int[]{4, 3}); //Adjacent Affinities: Earth, Fire
|
||||
|
||||
|
||||
public int ID;
|
||||
private int directOpposingAffinity;
|
||||
private int[] majorOppositions;
|
||||
private int[] minorOppositions;
|
||||
private int[] adjacentAffinities;
|
||||
public Item representItem;
|
||||
public int representMeta;
|
||||
public final int color;
|
||||
|
||||
private Affinity(int ID, int color, int directOppositeAffinity, int[] majorOppositions, int[] minorOppositions, int[] adjacentAffinities){
|
||||
this.ID = ID;
|
||||
this.directOpposingAffinity = directOppositeAffinity;
|
||||
this.majorOppositions = majorOppositions;
|
||||
this.minorOppositions = minorOppositions;
|
||||
this.adjacentAffinities = adjacentAffinities;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public Affinity getOpposingAffinity(){
|
||||
if (this.directOpposingAffinity > -1)
|
||||
return Affinity.values()[this.directOpposingAffinity];
|
||||
return Affinity.NONE;
|
||||
}
|
||||
|
||||
public Affinity[] getMajorOpposingAffinities(){
|
||||
Affinity[] opposing = new Affinity[this.majorOppositions.length];
|
||||
int count = 0;
|
||||
for (int i : this.majorOppositions){
|
||||
opposing[count++] = Affinity.values()[i];
|
||||
}
|
||||
return opposing;
|
||||
}
|
||||
|
||||
public Affinity[] getMinorOpposingAffinities(){
|
||||
Affinity[] opposing = new Affinity[this.minorOppositions.length];
|
||||
int count = 0;
|
||||
for (int i : this.minorOppositions){
|
||||
opposing[count++] = Affinity.values()[i];
|
||||
}
|
||||
return opposing;
|
||||
}
|
||||
|
||||
public Affinity[] getAdjacentAffinities(){
|
||||
Affinity[] adjacent = new Affinity[this.adjacentAffinities.length];
|
||||
int count = 0;
|
||||
for (int i : this.adjacentAffinities){
|
||||
adjacent[count++] = Affinity.values()[i];
|
||||
}
|
||||
return adjacent;
|
||||
}
|
||||
|
||||
public void setRepresentItem(Item representItem, int meta){
|
||||
if (this.representItem == null){
|
||||
this.representItem = representItem;
|
||||
this.representMeta = meta;
|
||||
}
|
||||
}
|
||||
|
||||
public static Affinity getByID(int ID){
|
||||
for (Affinity affinity : Affinity.values()){
|
||||
if (affinity.ID == ID){
|
||||
return affinity;
|
||||
}
|
||||
}
|
||||
return Affinity.NONE;
|
||||
}
|
||||
|
||||
public static Affinity[] getOrderedAffinities(){
|
||||
return new Affinity[]{
|
||||
AIR,
|
||||
LIGHTNING,
|
||||
ARCANE,
|
||||
FIRE,
|
||||
ENDER,
|
||||
EARTH,
|
||||
ICE,
|
||||
NATURE,
|
||||
WATER,
|
||||
LIFE
|
||||
};
|
||||
}
|
||||
|
||||
public int getAffinityMask(){
|
||||
switch (this){
|
||||
case AIR:
|
||||
return 0x1;
|
||||
case ARCANE:
|
||||
return 0x2;
|
||||
case EARTH:
|
||||
return 0x4;
|
||||
case ENDER:
|
||||
return 0x8;
|
||||
case FIRE:
|
||||
return 0x10;
|
||||
case ICE:
|
||||
return 0x20;
|
||||
case LIFE:
|
||||
return 0x40;
|
||||
case LIGHTNING:
|
||||
return 0x80;
|
||||
case NATURE:
|
||||
return 0x100;
|
||||
case WATER:
|
||||
return 0x200;
|
||||
case NONE:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
public class BuffPowerLevel{
|
||||
public static final int Low = 0;
|
||||
public static final int Medium = 1;
|
||||
public static final int High = 2;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
public enum ContingencyTypes{
|
||||
NONE,
|
||||
FALL,
|
||||
DAMAGE_TAKEN,
|
||||
ON_FIRE,
|
||||
HEALTH_LOW,
|
||||
DEATH
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
public enum LearnStates{
|
||||
LEARNED,
|
||||
CAN_LEARN,
|
||||
CANNOT_LEARN,
|
||||
LOCKED,
|
||||
DISABLED
|
||||
};
|
||||
@@ -1,8 +0,0 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
public enum SkillPointTypes{
|
||||
BLUE,
|
||||
GREEN,
|
||||
RED,
|
||||
SILVER
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
public enum SkillTrees{
|
||||
None,
|
||||
Offense,
|
||||
Defense,
|
||||
Utility,
|
||||
Talents,
|
||||
Familiar,
|
||||
Affinity
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
public enum SpellCastResult{
|
||||
SUCCESS,
|
||||
NOT_ENOUGH_MANA,
|
||||
REAGENTS_MISSING,
|
||||
MALFORMED_SPELL_STACK,
|
||||
EFFECT_FAILED,
|
||||
SUCCESS_REDUCE_MANA,
|
||||
SILENCED
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
public enum SpellModifiers{
|
||||
SPEED(1.0D),
|
||||
GRAVITY(0),
|
||||
BOUNCE(0),
|
||||
DAMAGE(4.0D),
|
||||
HEALING(1.0D),
|
||||
VELOCITY_ADDED(0.0D),
|
||||
RADIUS(1.0D),
|
||||
DURATION(1.0D),
|
||||
PROCS(1),
|
||||
RANGE(8.0D),
|
||||
TARGET_NONSOLID_BLOCKS(0),
|
||||
PIERCING(2),
|
||||
COLOR(0xFFFFFF),
|
||||
MINING_POWER(1),
|
||||
FORTUNE_LEVEL(1),
|
||||
SILKTOUCH_LEVEL(1),
|
||||
DISMEMBERING_LEVEL(1),
|
||||
BUFF_POWER(1),
|
||||
HOMING(0);
|
||||
|
||||
public double defaultValue = 0D;
|
||||
public int defaultValueInt = 0;
|
||||
|
||||
private SpellModifiers(double defaultValue){
|
||||
this.defaultValue = defaultValue;
|
||||
this.defaultValueInt = (int)defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
package makeo.gadomancy.api;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
*
|
||||
* Created by HellFirePvP @ 17.11.2015 14:36
|
||||
*/
|
||||
public abstract class AuraEffect {
|
||||
|
||||
/**
|
||||
* Return the EffectType you want to use here.
|
||||
*
|
||||
* EffectType.ENTITY_EFFECT selects entities within {@link AuraEffect#getRange()}
|
||||
* range and fires the Entity-related methods
|
||||
*
|
||||
* EffectType.BLOCK_EFFECT selects random locations within {@link #getRange()}
|
||||
* range and fires {@link #doBlockEffect(net.minecraft.util.ChunkCoordinates, net.minecraft.util.ChunkCoordinates, net.minecraft.world.World)}
|
||||
*
|
||||
* Returning null will cause BOTH effects to happen and thus, both should be implemented.
|
||||
*/
|
||||
public abstract EffectType getEffectType();
|
||||
|
||||
/**
|
||||
* Only fired when {@link #getEffectType()} returns {@link makeo.gadomancy.api.AuraEffect.EffectType#ENTITY_EFFECT}
|
||||
*
|
||||
* @param e an entity to check if it should be handled.
|
||||
* @return if the entity should be handled with {@link #doEntityEffect(net.minecraft.util.ChunkCoordinates, net.minecraft.entity.Entity)}
|
||||
*/
|
||||
public abstract boolean isEntityApplicable(Entity e);
|
||||
|
||||
/**
|
||||
* Only fired when {@link #getEffectType()} returns {@link makeo.gadomancy.api.AuraEffect.EffectType#ENTITY_EFFECT}
|
||||
* Do the actual effect on the Entity here.
|
||||
*
|
||||
* @param originTile where the master tile of the aura pylon is.
|
||||
* @param e an entity where {@link #isEntityApplicable(net.minecraft.entity.Entity)} returned true
|
||||
*/
|
||||
public abstract void doEntityEffect(ChunkCoordinates originTile, Entity e);
|
||||
|
||||
/**
|
||||
* Only fired when {@link #getEffectType()} returns {@link makeo.gadomancy.api.AuraEffect.EffectType#BLOCK_EFFECT}
|
||||
*
|
||||
* @param random a random to evaluate random numbers. convenience reasons
|
||||
* @return the amount of blocks that should be collected.
|
||||
*/
|
||||
public abstract int getBlockCount(Random random);
|
||||
|
||||
/**
|
||||
* Only fired when {@link #getEffectType()} returns {@link makeo.gadomancy.api.AuraEffect.EffectType#BLOCK_EFFECT}
|
||||
* Do the actual effect on a block here.
|
||||
*
|
||||
* @param originTile where the master tile of the aura pylon is.
|
||||
* @param selectedBlock a selected block
|
||||
* @param world world of the tile and the block
|
||||
*/
|
||||
public abstract void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world);
|
||||
|
||||
/**
|
||||
* Returns the tick interval how often the aura effect is called
|
||||
*/
|
||||
public int getTickInterval() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the range of the aura pylon's effect
|
||||
*
|
||||
* Defines
|
||||
* - the range where entities are collected around the pylon.
|
||||
* - the range where blocks are collected around the pylon.
|
||||
* - how close the player has to be to get the aura's research
|
||||
*/
|
||||
public double getRange() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the AuraEffect to the given Aspect.
|
||||
*
|
||||
* @param a to register this to.
|
||||
* @return the current AuraEffect object
|
||||
*/
|
||||
public AuraEffect register(Aspect a) {
|
||||
GadomancyApi.registerAdditionalAuraEffect(a, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A EntityEffect AuraEffect class for convenience
|
||||
*/
|
||||
public static abstract class EntityAuraEffect extends AuraEffect {
|
||||
|
||||
@Override
|
||||
public final EffectType getEffectType() {
|
||||
return EffectType.ENTITY_EFFECT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract boolean isEntityApplicable(Entity e);
|
||||
|
||||
@Override
|
||||
public abstract void doEntityEffect(ChunkCoordinates originTile, Entity e);
|
||||
|
||||
@Override
|
||||
public final int getBlockCount(Random random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* A BlockEffect AuraEffect class for convenience
|
||||
*/
|
||||
public static abstract class BlockAuraEffect extends AuraEffect {
|
||||
|
||||
@Override
|
||||
public final EffectType getEffectType() {
|
||||
return EffectType.BLOCK_EFFECT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isEntityApplicable(Entity e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void doEntityEffect(ChunkCoordinates originTile, Entity e) {}
|
||||
|
||||
}
|
||||
|
||||
public static enum EffectType {
|
||||
|
||||
ENTITY_EFFECT,
|
||||
BLOCK_EFFECT
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package makeo.gadomancy.api;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
*
|
||||
* Created by makeo @ 11.10.2015 12:09
|
||||
*/
|
||||
public abstract class ClickBehavior {
|
||||
protected World world;
|
||||
protected Block block;
|
||||
protected int x, y, z, metadata;
|
||||
|
||||
protected boolean hasVisCost;
|
||||
|
||||
public ClickBehavior(boolean hasVisCost) {
|
||||
this.hasVisCost = hasVisCost;
|
||||
}
|
||||
|
||||
public ClickBehavior() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called by me to init all variables
|
||||
*/
|
||||
@Deprecated
|
||||
public void init(World world, Block block, int x, int y, int z, int metadata) {
|
||||
this.world = world;
|
||||
this.block = block;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if this class needs to handle the given block
|
||||
*/
|
||||
public abstract boolean isValidForBlock();
|
||||
|
||||
//TODO not handled as expected.
|
||||
public boolean hasVisCost() {
|
||||
return hasVisCost;
|
||||
}
|
||||
|
||||
public int getComparatorOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void addInstability(int instability) { }
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package makeo.gadomancy.api;
|
||||
|
||||
import makeo.gadomancy.api.golems.AdditionalGolemType;
|
||||
import makeo.gadomancy.api.golems.cores.AdditionalGolemCore;
|
||||
import makeo.gadomancy.api.internal.IApiHandler;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.entities.golems.EntityGolemBase;
|
||||
import thaumcraft.common.entities.golems.EnumGolemType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
*
|
||||
* Created by makeo @ 26.07.2015 19:00
|
||||
*/
|
||||
public abstract class GadomancyApi {
|
||||
private static IApiHandler handler;
|
||||
public static void setInstance(IApiHandler handler) {
|
||||
GadomancyApi.handler = handler;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean registerAdditionalGolemType(String name, String modId, AdditionalGolemType newType){
|
||||
return handler.registerAdditionalGolemType(name, modId, newType);
|
||||
}
|
||||
|
||||
public static AdditionalGolemType getAdditionalGolemType(String name) {
|
||||
return handler.getAdditionalGolemType(name);
|
||||
}
|
||||
|
||||
public static AdditionalGolemType getAdditionalGolemType(EnumGolemType type) {
|
||||
return getAdditionalGolemType(type.name());
|
||||
}
|
||||
|
||||
public static List<AdditionalGolemType> getAdditionalGolemTypes() {
|
||||
return handler.getAdditionalGolemTypes();
|
||||
}
|
||||
|
||||
public static boolean isAdditionalGolemType(String name) {
|
||||
return getAdditionalGolemType(name) != null;
|
||||
}
|
||||
|
||||
public static boolean isAdditionalGolemType(EnumGolemType type) {
|
||||
return isAdditionalGolemType(type.name());
|
||||
}
|
||||
|
||||
public static AdditionalGolemCore getAdditionalGolemCore(EntityGolemBase golem) {
|
||||
return handler.getAdditionalGolemCore(golem);
|
||||
}
|
||||
|
||||
public static AdditionalGolemCore getAdditionalGolemCore(ItemStack placer) {
|
||||
return handler.getAdditionalGolemCore(placer);
|
||||
}
|
||||
|
||||
public static void setAdditionalGolemCore(EntityGolemBase golem, AdditionalGolemCore core) {
|
||||
handler.setAdditionalGolemCore(golem, core);
|
||||
}
|
||||
|
||||
public static boolean registerAdditionalGolemCore(String name, AdditionalGolemCore core) {
|
||||
return handler.registerAdditionalGolemCore(name, core);
|
||||
}
|
||||
|
||||
public static void registerAdditionalAuraEffect(Aspect aspect, AuraEffect effect) {
|
||||
handler.registerAdditionalAuraEffect(aspect, effect);
|
||||
}
|
||||
|
||||
public static List<AdditionalGolemCore> getAdditionalGolemCores() {
|
||||
return handler.getAdditionalGolemCores();
|
||||
}
|
||||
|
||||
public static void registerClawClickBehavior(ClickBehavior clickBehavior) {
|
||||
handler.registerClawClickBehavior(clickBehavior);
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package makeo.gadomancy.api.golems;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import thaumcraft.common.entities.golems.EnumGolemType;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
*
|
||||
* Created by makeo @ 26.07.2015 20:55
|
||||
*/
|
||||
public abstract class AdditionalGolemType {
|
||||
private EnumGolemType enumEntry;
|
||||
private Item placerItem;
|
||||
private String modId;
|
||||
|
||||
public final int maxHealth;
|
||||
public final int armor;
|
||||
public final float movementSpeed;
|
||||
public final boolean fireResist;
|
||||
public final int upgradeAmount;
|
||||
public final int carryLimit;
|
||||
public final int regenDelay;
|
||||
public final int strength;
|
||||
|
||||
public AdditionalGolemType(int maxHealth, int armor, float movementSpeed, boolean fireResist, int upgradeAmount, int carryLimit, int regenDelay, int strength) {
|
||||
this.maxHealth = maxHealth;
|
||||
this.armor = armor;
|
||||
this.movementSpeed = movementSpeed;
|
||||
this.fireResist = fireResist;
|
||||
this.upgradeAmount = upgradeAmount;
|
||||
this.carryLimit = carryLimit;
|
||||
this.regenDelay = regenDelay;
|
||||
this.strength = strength;
|
||||
}
|
||||
|
||||
public abstract String getUnlocalizedName();
|
||||
|
||||
public abstract void registerIcons(IIconRegister ir);
|
||||
public abstract IIcon getIcon(ItemStack stack, int pass);
|
||||
|
||||
public int getRenderPasses() { return 1; }
|
||||
|
||||
public abstract ResourceLocation getEntityTexture();
|
||||
|
||||
/**
|
||||
* @return resource location for the golem inventory slot texture
|
||||
*/
|
||||
public abstract ResourceLocation getInvSlotTexture();
|
||||
|
||||
public EnumGolemType getEnumEntry() {
|
||||
return enumEntry;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return enumEntry.name();
|
||||
}
|
||||
|
||||
public Item getPlacerItem() {
|
||||
return placerItem;
|
||||
}
|
||||
|
||||
public String getModId() {
|
||||
return modId;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public final void setEnumEntry(EnumGolemType enumEntry) {
|
||||
this.enumEntry = enumEntry;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setPlacerItem(Item placerItem) {
|
||||
this.placerItem = placerItem;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setModId(String modId) {
|
||||
this.modId = modId;
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
package makeo.gadomancy.api.golems.cores;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.common.entities.golems.EntityGolemBase;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
*
|
||||
* Created by makeo @ 11.08.2015 14:10
|
||||
*/
|
||||
public abstract class AdditionalGolemCore {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Init your AI stuff here
|
||||
* @param golem the golem entity
|
||||
*/
|
||||
public abstract void setupGolem(EntityGolemBase golem);
|
||||
|
||||
/**
|
||||
* @return If the golem has a gui
|
||||
*/
|
||||
public abstract boolean hasGui();
|
||||
|
||||
/**
|
||||
* @return the core that is used to define some basic behaviors of the golem e.g. guard core: mob selection
|
||||
*/
|
||||
public byte getBaseCore() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open custom a gui here
|
||||
* Only called if hasGui is true
|
||||
* @param player player entity
|
||||
* @param golem golem entity
|
||||
* @return false -> open default gui true -> no gui
|
||||
*/
|
||||
public boolean openGui(EntityPlayer player, EntityGolemBase golem) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param golem
|
||||
* @return the held tool item of a golem e.g. fishing rod
|
||||
*/
|
||||
public ItemStack getToolItem(EntityGolemBase golem) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getUnlocalizedGuiText() {
|
||||
return "gadomancy.golem.core.text.default";
|
||||
}
|
||||
|
||||
public abstract String getUnlocalizedName();
|
||||
|
||||
/**
|
||||
* @return If you're able to set markers using the golemancers bell
|
||||
*/
|
||||
public boolean hasMarkers() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the item that is used as a core
|
||||
*/
|
||||
public abstract ItemStack getItem();
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package makeo.gadomancy.api.golems.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import thaumcraft.common.entities.golems.EntityGolemBase;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
*
|
||||
* Created by makeo @ 14.10.2015 14:09
|
||||
*/
|
||||
public class GolemDropPlacerEvent extends Event {
|
||||
public final EntityPlayer player;
|
||||
public final EntityItem placer;
|
||||
public final EntityGolemBase golem;
|
||||
|
||||
public GolemDropPlacerEvent(EntityPlayer player, EntityItem placer, EntityGolemBase golem) {
|
||||
this.player = player;
|
||||
this.placer = placer;
|
||||
this.golem = golem;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package makeo.gadomancy.api.golems.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.common.entities.golems.EntityGolemBase;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
*
|
||||
* Created by makeo @ 14.10.2015 14:09
|
||||
*/
|
||||
public class PlacerCreateGolemEvent extends Event {
|
||||
public final EntityPlayer player;
|
||||
public final ItemStack placer;
|
||||
public final EntityGolemBase golem;
|
||||
|
||||
public PlacerCreateGolemEvent(EntityPlayer player, EntityGolemBase golem, ItemStack placer) {
|
||||
this.player = player;
|
||||
this.golem = golem;
|
||||
this.placer = placer;
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package makeo.gadomancy.api.internal;
|
||||
|
||||
import makeo.gadomancy.api.AuraEffect;
|
||||
import makeo.gadomancy.api.ClickBehavior;
|
||||
import makeo.gadomancy.api.golems.AdditionalGolemType;
|
||||
import makeo.gadomancy.api.golems.cores.AdditionalGolemCore;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.entities.golems.EntityGolemBase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
*
|
||||
* Created by makeo @ 14.10.2015 14:28
|
||||
*/
|
||||
public interface IApiHandler {
|
||||
boolean registerAdditionalGolemType(String name, String modId, AdditionalGolemType newType);
|
||||
|
||||
AdditionalGolemType getAdditionalGolemType(String name);
|
||||
|
||||
List<AdditionalGolemType> getAdditionalGolemTypes();
|
||||
|
||||
AdditionalGolemCore getAdditionalGolemCore(EntityGolemBase golem);
|
||||
|
||||
AdditionalGolemCore getAdditionalGolemCore(ItemStack placer);
|
||||
|
||||
boolean registerAdditionalGolemCore(String name, AdditionalGolemCore core);
|
||||
|
||||
void setAdditionalGolemCore(EntityGolemBase golem, AdditionalGolemCore core);
|
||||
|
||||
List<AdditionalGolemCore> getAdditionalGolemCores();
|
||||
|
||||
void registerClawClickBehavior(ClickBehavior clickBehavior);
|
||||
|
||||
void registerAdditionalAuraEffect(Aspect aspect, AuraEffect effect);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package tb.api;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public interface ITobacco {
|
||||
|
||||
public abstract void performTobaccoEffect(EntityPlayer smoker, int metadata, boolean isSilverwood);
|
||||
|
||||
}
|
||||
@@ -1,676 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Jan 14, 2014, 6:15:28 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.brew.Brew;
|
||||
import vazkii.botania.api.internal.DummyMethodHandler;
|
||||
import vazkii.botania.api.internal.DummySubTile;
|
||||
import vazkii.botania.api.internal.IInternalMethodHandler;
|
||||
import vazkii.botania.api.lexicon.KnowledgeType;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipeMiniFlower;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.api.recipe.RecipePureDaisy;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.api.subtile.signature.BasicSignature;
|
||||
import vazkii.botania.api.subtile.signature.SubTileSignature;
|
||||
import vazkii.botania.api.wiki.IWikiProvider;
|
||||
import vazkii.botania.api.wiki.SimpleWikiProvider;
|
||||
import vazkii.botania.api.wiki.WikiHooks;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public final class BotaniaAPI {
|
||||
|
||||
private static List<LexiconCategory> categories = new ArrayList<LexiconCategory>();
|
||||
private static List<LexiconEntry> allEntries = new ArrayList<LexiconEntry>();
|
||||
|
||||
public static Map<String, KnowledgeType> knowledgeTypes = new HashMap<String, KnowledgeType>();
|
||||
|
||||
public static Map<String, Brew> brewMap = new LinkedHashMap<String, Brew>();
|
||||
|
||||
public static List<String> disposableBlocks = new ArrayList<String>();
|
||||
public static List<String> semiDisposableBlocks = new ArrayList<String>();
|
||||
|
||||
public static List<RecipePetals> petalRecipes = new ArrayList<RecipePetals>();
|
||||
public static List<RecipePureDaisy> pureDaisyRecipes = new ArrayList<RecipePureDaisy>();
|
||||
public static List<RecipeManaInfusion> manaInfusionRecipes = new ArrayList<RecipeManaInfusion>();
|
||||
public static List<RecipeRuneAltar> runeAltarRecipes = new ArrayList<RecipeRuneAltar>();
|
||||
public static List<RecipeElvenTrade> elvenTradeRecipes = new ArrayList<RecipeElvenTrade>();
|
||||
public static List<RecipeBrew> brewRecipes = new ArrayList<RecipeBrew>();
|
||||
public static List<RecipeManaInfusion> miniFlowerRecipes = new ArrayList<RecipeManaInfusion>();
|
||||
|
||||
private static BiMap<String, Class<? extends SubTileEntity>> subTiles = HashBiMap.<String, Class<? extends SubTileEntity>> create();
|
||||
private static Map<Class<? extends SubTileEntity>, SubTileSignature> subTileSignatures = new HashMap<Class<? extends SubTileEntity>, SubTileSignature>();
|
||||
public static Set<String> subtilesForCreativeMenu = new LinkedHashSet();
|
||||
public static Map<String, String> subTileMods = new HashMap<String, String>();
|
||||
public static BiMap<String, String> miniFlowers = HashBiMap.<String, String> create();
|
||||
|
||||
public static Map<String, Integer> oreWeights = new HashMap<String, Integer>();
|
||||
public static Map<String, Integer> oreWeightsNether = new HashMap<String, Integer>();
|
||||
public static Map<Item, Block> seeds = new HashMap();
|
||||
public static Set<Item> looniumBlacklist = new LinkedHashSet<Item>();
|
||||
public static Set<Block> paintableBlocks = new LinkedHashSet<Block>();
|
||||
public static Set<String> magnetBlacklist = new LinkedHashSet<String>();
|
||||
public static Set<Class<? extends Entity>> gravityRodBlacklist = new LinkedHashSet<Class<? extends Entity>>();
|
||||
|
||||
public static ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", 16, new int[] { 2, 6, 5, 2 }, 18);
|
||||
public static ToolMaterial manasteelToolMaterial = EnumHelper.addToolMaterial("MANASTEEL", 3, 300, 6.2F, 2F, 20);
|
||||
|
||||
public static ArmorMaterial elementiumArmorMaterial = EnumHelper.addArmorMaterial("B_ELEMENTIUM", 18, new int[] { 2, 6, 5, 2 }, 18);
|
||||
public static ToolMaterial elementiumToolMaterial = EnumHelper.addToolMaterial("B_ELEMENTIUM", 3, 720, 6.2F, 2F, 20);
|
||||
|
||||
public static ArmorMaterial terrasteelArmorMaterial = EnumHelper.addArmorMaterial("TERRASTEEL", 34, new int[] {3, 8, 6, 3}, 26);
|
||||
public static ToolMaterial terrasteelToolMaterial = EnumHelper.addToolMaterial("TERRASTEEL", 4, 2300, 9F, 3F, 26);
|
||||
|
||||
public static ArmorMaterial manaweaveArmorMaterial = EnumHelper.addArmorMaterial("MANAWEAVE", 5, new int[] { 1, 2, 2, 1 }, 18);
|
||||
|
||||
public static EnumRarity rarityRelic = EnumHelper.addRarity("RELIC", EnumChatFormatting.GOLD, "Relic");
|
||||
|
||||
public static KnowledgeType basicKnowledge;
|
||||
public static KnowledgeType elvenKnowledge;
|
||||
|
||||
// This is here for completeness sake, but you shouldn't use it
|
||||
public static KnowledgeType relicKnowledge;
|
||||
|
||||
// All of these categories are initialized during botania's PreInit stage.
|
||||
public static LexiconCategory categoryBasics;
|
||||
public static LexiconCategory categoryMana;
|
||||
public static LexiconCategory categoryFunctionalFlowers;
|
||||
public static LexiconCategory categoryGenerationFlowers;
|
||||
public static LexiconCategory categoryDevices;
|
||||
public static LexiconCategory categoryTools;
|
||||
public static LexiconCategory categoryBaubles;
|
||||
public static LexiconCategory categoryEnder;
|
||||
public static LexiconCategory categoryAlfhomancy;
|
||||
public static LexiconCategory categoryMisc;
|
||||
|
||||
public static Brew fallbackBrew = new Brew("fallback", "botania.brew.fallback", 0, 0);
|
||||
|
||||
static {
|
||||
registerSubTile("", DummySubTile.class);
|
||||
|
||||
basicKnowledge = registerKnowledgeType("minecraft", EnumChatFormatting.RESET, true);
|
||||
elvenKnowledge = registerKnowledgeType("alfheim", EnumChatFormatting.DARK_GREEN, false);
|
||||
relicKnowledge = registerKnowledgeType("relic", EnumChatFormatting.DARK_PURPLE, false);
|
||||
|
||||
addOreWeight("oreAluminum", 3940); // Tinkers' Construct
|
||||
addOreWeight("oreAmber", 2075); // Thaumcraft
|
||||
addOreWeight("oreApatite", 1595); // Forestry
|
||||
addOreWeight("oreBlueTopaz", 3195); // Ars Magica
|
||||
addOreWeight("oreCertusQuartz", 3975); // Applied Energistics
|
||||
addOreWeight("oreChimerite", 3970); // Ars Magica
|
||||
addOreWeight("oreCinnabar", 2585); // Thaumcraft
|
||||
addOreWeight("oreCoal", 46525); // Vanilla
|
||||
addOreWeight("oreCopper", 8325); // IC2, Thermal Expansion, Tinkers' Construct, etc.
|
||||
addOreWeight("oreDark", 1350); // EvilCraft
|
||||
addOreWeight("oreDarkIron", 1700); // Factorization (older versions)
|
||||
addOreWeight("oreFzDarkIron", 1700); // Factorization (newer versions)
|
||||
addOreWeight("oreDiamond", 1265); // Vanilla
|
||||
addOreWeight("oreEmerald", 780); // Vanilla
|
||||
addOreWeight("oreGalena", 1000); // Factorization
|
||||
addOreWeight("oreGold", 2970); // Vanilla
|
||||
addOreWeight("oreInfusedAir", 925); // Thaumcraft
|
||||
addOreWeight("oreInfusedEarth", 925); // Thaumcraft
|
||||
addOreWeight("oreInfusedEntropy", 925); // Thaumcraft
|
||||
addOreWeight("oreInfusedFire", 925); // Thaumcraft
|
||||
addOreWeight("oreInfusedOrder", 925); // Thaumcraft
|
||||
addOreWeight("oreInfusedWater", 925); // Thaumcraft
|
||||
addOreWeight("oreIron", 20665); // Vanilla
|
||||
addOreWeight("oreLapis", 1285); // Vanilla
|
||||
addOreWeight("oreLead", 7985); // IC2, Thermal Expansion, Factorization, etc.
|
||||
addOreWeight("oreMCropsEssence", 3085); // Magical Crops
|
||||
addOreWeight("oreMithril", 8); // Thermal Expansion
|
||||
addOreWeight("oreNickel", 2275); // Thermal Expansion
|
||||
addOreWeight("oreOlivine", 1100); // Project RED
|
||||
addOreWeight("orePlatinum", 365); // Thermal Expansion
|
||||
addOreWeight("oreRedstone", 6885); // Vanilla
|
||||
addOreWeight("oreRuby", 1100); // Project RED
|
||||
addOreWeight("oreSapphire", 1100); // Project RED
|
||||
addOreWeight("oreSilver", 6300); // Thermal Expansion, Factorization, etc.
|
||||
addOreWeight("oreSulfur", 1105); // Railcraft
|
||||
addOreWeight("oreTin", 9450); // IC2, Thermal Expansion, etc.
|
||||
addOreWeight("oreUranium", 1337); // IC2
|
||||
addOreWeight("oreVinteum", 5925); // Ars Magica
|
||||
addOreWeight("oreYellorite", 3520); // Big Reactors
|
||||
addOreWeight("oreZinc", 6485); // Flaxbeard's Steam Power
|
||||
addOreWeight("oreMythril", 6485); // Simple Ores2
|
||||
addOreWeight("oreAdamantium", 2275); // Simple Ores2
|
||||
addOreWeight("oreTungsten", 3520); // Simple Tungsten
|
||||
|
||||
addOreWeightNether("oreQuartz", 19600); // Vanilla
|
||||
addOreWeightNether("oreCobalt", 500); // Tinker's Construct
|
||||
addOreWeightNether("oreArdite", 500); // Tinker's Construct
|
||||
addOreWeightNether("oreFirestone", 5); // Railcraft
|
||||
addOreWeightNether("oreNetherCoal", 17000); // Nether Ores
|
||||
addOreWeightNether("oreNetherCopper", 4700); // Nether Ores
|
||||
addOreWeightNether("oreNetherDiamond", 175); // Nether Ores
|
||||
addOreWeightNether("oreNetherEssence", 2460); // Magical Crops
|
||||
addOreWeightNether("oreNetherGold", 3635); // Nether Ores
|
||||
addOreWeightNether("oreNetherIron", 5790); // Nether Ores
|
||||
addOreWeightNether("oreNetherLapis", 3250); // Nether Ores
|
||||
addOreWeightNether("oreNetherLead", 2790); // Nether Ores
|
||||
addOreWeightNether("oreNetherNickel", 1790); // Nether Ores
|
||||
addOreWeightNether("oreNetherPlatinum", 170); // Nether Ores
|
||||
addOreWeightNether("oreNetherRedstone", 5600); // Nether Ores
|
||||
addOreWeightNether("oreNetherSilver", 1550); // Nether Ores
|
||||
addOreWeightNether("oreNetherSteel", 1690); // Nether Ores
|
||||
addOreWeightNether("oreNetherTin", 3750); // Nether Ores
|
||||
addOreWeightNether("oreFyrite", 1000); // Netherrocks
|
||||
addOreWeightNether("oreAshstone", 1000); // Netherrocks
|
||||
addOreWeightNether("oreDragonstone", 175); // Netherrocks
|
||||
addOreWeightNether("oreArgonite", 1000); // Netherrocks
|
||||
addOreWeightNether("oreOnyx", 500); // SimpleOres 2
|
||||
addOreWeightNether("oreHaditeCoal", 500); // Hadite
|
||||
|
||||
addSeed(Items.wheat_seeds, Blocks.wheat);
|
||||
addSeed(Items.potato, Blocks.potatoes);
|
||||
addSeed(Items.carrot, Blocks.carrots);
|
||||
addSeed(Items.nether_wart, Blocks.nether_wart);
|
||||
addSeed(Items.pumpkin_seeds, Blocks.pumpkin_stem);
|
||||
addSeed(Items.melon_seeds, Blocks.melon_stem);
|
||||
|
||||
registerModWiki("Minecraft", new SimpleWikiProvider("Minecraft Wiki", "http://minecraft.gamepedia.com/%s"));
|
||||
|
||||
IWikiProvider technicWiki = new SimpleWikiProvider("Technic Wiki", "http://wiki.technicpack.net/%s");
|
||||
IWikiProvider mekanismWiki = new SimpleWikiProvider("Mekanism Wiki", "http://wiki.aidancbrady.com/wiki/%s");
|
||||
IWikiProvider buildcraftWiki = new SimpleWikiProvider("BuildCraft Wiki", "http://www.mod-buildcraft.com/wiki/doku.php?id=%s");
|
||||
|
||||
registerModWiki("Mekanism", mekanismWiki);
|
||||
registerModWiki("MekanismGenerators", mekanismWiki);
|
||||
registerModWiki("MekanismTools", mekanismWiki);
|
||||
registerModWiki("EnderIO", new SimpleWikiProvider("EnderIO Wiki", "http://wiki.enderio.com/%s"));
|
||||
registerModWiki("TropiCraft", new SimpleWikiProvider("Tropicraft Wiki", "http://wiki.tropicraft.net/wiki/%s"));
|
||||
registerModWiki("RandomThings", new SimpleWikiProvider("Random Things Wiki", "http://randomthingsminecraftmod.wikispaces.com/%s"));
|
||||
registerModWiki("Witchery", new SimpleWikiProvider("Witchery Wiki", "https://sites.google.com/site/witcherymod/%s", "-", true));
|
||||
registerModWiki("AppliedEnergistics2", new SimpleWikiProvider("AE2 Wiki", "http://ae-mod.info/%s"));
|
||||
registerModWiki("BigReactors", technicWiki);
|
||||
registerModWiki("BuildCraft|Core", buildcraftWiki);
|
||||
registerModWiki("BuildCraft|Builders", buildcraftWiki);
|
||||
registerModWiki("BuildCraft|Energy", buildcraftWiki);
|
||||
registerModWiki("BuildCraft|Factory", buildcraftWiki);
|
||||
registerModWiki("BuildCraft|Silicon", buildcraftWiki);
|
||||
registerModWiki("BuildCraft|Transport", buildcraftWiki);
|
||||
registerModWiki("ArsMagica2", new SimpleWikiProvider("ArsMagica2 Wiki", "http://wiki.arsmagicamod.com/wiki/%s"));
|
||||
registerModWiki("PneumaticCraft", new SimpleWikiProvider("PneumaticCraft Wiki", "http://www.minemaarten.com/wikis/pneumaticcraft-wiki/pneumaticcraft-wiki-%s"));
|
||||
registerModWiki("StevesCarts2", new SimpleWikiProvider("Steve's Carts Wiki", "http://stevescarts2.wikispaces.com/%s"));
|
||||
registerModWiki("GanysSurface", new SimpleWikiProvider("Gany's Surface Wiki", "http://ganys-surface.wikia.com/wiki/%s"));
|
||||
registerModWiki("GanysNether", new SimpleWikiProvider("Gany's Nether Wiki", "http://ganys-nether.wikia.com/wiki/%s"));
|
||||
registerModWiki("GanysEnd", new SimpleWikiProvider("Gany's End Wiki", "http://ganys-end.wikia.com/wiki/%s"));
|
||||
|
||||
registerPaintableBlock(Blocks.stained_glass);
|
||||
registerPaintableBlock(Blocks.stained_glass_pane);
|
||||
registerPaintableBlock(Blocks.stained_hardened_clay);
|
||||
registerPaintableBlock(Blocks.wool);
|
||||
registerPaintableBlock(Blocks.carpet);
|
||||
|
||||
registerDisposableBlock("dirt"); // Vanilla
|
||||
registerDisposableBlock("sand"); // Vanilla
|
||||
registerDisposableBlock("gravel"); // Vanilla
|
||||
registerDisposableBlock("cobblestone"); // Vanilla
|
||||
registerDisposableBlock("netherrack"); // Vanilla
|
||||
registerSemiDisposableBlock("stoneAndesite"); // Botania
|
||||
registerSemiDisposableBlock("stoneBasalt"); // Botania
|
||||
registerSemiDisposableBlock("stoneDiorite"); // Botania
|
||||
registerSemiDisposableBlock("stoneGranite"); // Botania
|
||||
}
|
||||
|
||||
/**
|
||||
* The internal method handler in use.
|
||||
* <b>DO NOT OVERWRITE THIS OR YOU'RE GOING TO FEEL MY WRATH WHEN I UPDATE THE API.</b>
|
||||
* The fact I have to write that means some moron already tried, don't be that moron.
|
||||
* @see IInternalMethodHandler
|
||||
*/
|
||||
public static IInternalMethodHandler internalHandler = new DummyMethodHandler();
|
||||
|
||||
/**
|
||||
* Registers a new Knowledge Type.
|
||||
* @param id The ID for this knowledge type.
|
||||
* @param color The color to display this knowledge type as.
|
||||
*/
|
||||
public static KnowledgeType registerKnowledgeType(String id, EnumChatFormatting color, boolean autoUnlock) {
|
||||
KnowledgeType type = new KnowledgeType(id, color, autoUnlock);
|
||||
knowledgeTypes.put(id, type);
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Brew and returns it.
|
||||
*/
|
||||
public static Brew registerBrew(Brew brew) {
|
||||
brewMap.put(brew.getKey(), brew);
|
||||
return brew;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a brew from the key passed in, returns the fallback if
|
||||
* it's not in the map.
|
||||
*/
|
||||
public static Brew getBrewFromKey(String key) {
|
||||
if(brewMap.containsKey(key))
|
||||
return brewMap.get(key);
|
||||
return fallbackBrew;
|
||||
}
|
||||
|
||||
/*
|
||||
* Registers a Block as disposable using its Ore Dictionary Name.
|
||||
*/
|
||||
public static void registerDisposableBlock(String oreDictName) {
|
||||
disposableBlocks.add(oreDictName);
|
||||
}
|
||||
|
||||
/*
|
||||
* Registers a Block as semi disposable using its Ore Dictionary Name.
|
||||
* This means it will not be trashed when sneaking.
|
||||
*/
|
||||
public static void registerSemiDisposableBlock(String oreDictName) {
|
||||
semiDisposableBlocks.add(oreDictName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a paintableBlock and returns it.
|
||||
*/
|
||||
public static Block registerPaintableBlock(Block paintable){
|
||||
paintableBlocks.add(paintable);
|
||||
return paintable;
|
||||
}
|
||||
|
||||
/*
|
||||
* Blacklists an Entity from being affected by the Rod of the Shaded Mesa.
|
||||
* Pass in the class for the Entity, e.g. EntityCow.class
|
||||
*/
|
||||
public static void blacklistEntityFromGravityRod(Class entity) {
|
||||
gravityRodBlacklist.add(entity);
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if the provided Entity is contained in the Blacklist.
|
||||
* Pass in the class for the Entity, e.g. entity.getClass()
|
||||
*/
|
||||
public static boolean isEntityBlacklistedFromGravityRod(Class entity) {
|
||||
return gravityRodBlacklist.contains(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Blacklists an item from being pulled by the Ring of Magnetization.
|
||||
* Short.MAX_VALUE can be used as the stack's damage for a wildcard.
|
||||
*/
|
||||
public static void blacklistItemFromMagnet(ItemStack stack) {
|
||||
String key = getMagnetKey(stack);
|
||||
magnetBlacklist.add(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Blacklists a block from having items on top of it being pulled by the Ring of Magnetization.
|
||||
* Short.MAX_VALUE can be used as meta for a wildcard.
|
||||
*/
|
||||
public static void blacklistBlockFromMagnet(Block block, int meta) {
|
||||
String key = getMagnetKey(block, meta);
|
||||
magnetBlacklist.add(key);
|
||||
}
|
||||
|
||||
public static boolean isItemBlacklistedFromMagnet(ItemStack stack) {
|
||||
return isItemBlacklistedFromMagnet(stack, 0);
|
||||
}
|
||||
|
||||
public static boolean isItemBlacklistedFromMagnet(ItemStack stack, int recursion) {
|
||||
if(recursion > 5)
|
||||
return false;
|
||||
|
||||
if(stack.getItemDamage() != Short.MAX_VALUE) {
|
||||
ItemStack copy = new ItemStack(stack.getItem(), 0, Short.MAX_VALUE);
|
||||
boolean general = isItemBlacklistedFromMagnet(copy, recursion + 1);
|
||||
if(general)
|
||||
return true;
|
||||
}
|
||||
|
||||
String key = getMagnetKey(stack);
|
||||
return magnetBlacklist.contains(key);
|
||||
}
|
||||
|
||||
public static boolean isBlockBlacklistedFromMagnet(Block block, int meta) {
|
||||
return isBlockBlacklistedFromMagnet(block, meta, 0);
|
||||
}
|
||||
|
||||
public static boolean isBlockBlacklistedFromMagnet(Block block, int meta, int recursion) {
|
||||
if(recursion >= 5)
|
||||
return false;
|
||||
|
||||
if(meta != Short.MAX_VALUE) {
|
||||
boolean general = isBlockBlacklistedFromMagnet(block, Short.MAX_VALUE, recursion + 1);
|
||||
if(general)
|
||||
return true;
|
||||
}
|
||||
|
||||
String key = getMagnetKey(block, meta);
|
||||
return magnetBlacklist.contains(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Petal Recipe.
|
||||
* @param output The ItemStack to craft.
|
||||
* @param inputs The objects for crafting. Can be ItemStack, MappableStackWrapper
|
||||
* or String (case for Ore Dictionary). The array can't be larger than 16.
|
||||
* @return The recipe created.
|
||||
*/
|
||||
public static RecipePetals registerPetalRecipe(ItemStack output, Object... inputs) {
|
||||
RecipePetals recipe = new RecipePetals(output, inputs);
|
||||
petalRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Pure Daisy Recipe.
|
||||
* @param input The block that works as an input for the recipe. Can be a Block or an oredict String.
|
||||
* @param output The block to be placed upon recipe completion.
|
||||
* @param outputMeta The metadata to be placed upon recipe completion.
|
||||
* @return The recipe created.
|
||||
*/
|
||||
public static RecipePureDaisy registerPureDaisyRecipe(Object input, Block output, int outputMeta) {
|
||||
RecipePureDaisy recipe = new RecipePureDaisy(input, output, outputMeta);
|
||||
pureDaisyRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Rune Altar Recipe.
|
||||
* @param output The ItemStack to craft.
|
||||
* @param mana The amount of mana required. Don't go over 100000!
|
||||
* @param inputs The objects for crafting. Can be ItemStack, MappableStackWrapper
|
||||
* or String (case for Ore Dictionary). The array can't be larger than 16.
|
||||
* @return The recipe created.
|
||||
*/
|
||||
public static RecipeRuneAltar registerRuneAltarRecipe(ItemStack output, int mana, Object... inputs) {
|
||||
RecipeRuneAltar recipe = new RecipeRuneAltar(output, mana, inputs);
|
||||
runeAltarRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Mana Infusion Recipe (throw an item in a mana pool)
|
||||
* @param output The ItemStack to craft
|
||||
* @param input The input item, be it an ItemStack or an ore dictionary entry String.
|
||||
* @param mana The amount of mana required. Don't go over 100000!
|
||||
* @return The recipe created.
|
||||
*/
|
||||
public static RecipeManaInfusion registerManaInfusionRecipe(ItemStack output, Object input, int mana) {
|
||||
RecipeManaInfusion recipe = new RecipeManaInfusion(output, input, mana);
|
||||
manaInfusionRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a Mana Infusion Recipe and flags it as an Alchemy recipe (requires an
|
||||
* Alchemy Catalyst below the pool).
|
||||
* @see BotaniaAPI#registerManaInfusionRecipe
|
||||
*/
|
||||
public static RecipeManaInfusion registerManaAlchemyRecipe(ItemStack output, Object input, int mana) {
|
||||
RecipeManaInfusion recipe = registerManaInfusionRecipe(output, input, mana);
|
||||
recipe.setAlchemy(true);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a Mana Infusion Recipe and flags it as an Conjuration recipe (requires a
|
||||
* Conjuration Catalyst below the pool).
|
||||
* @see BotaniaAPI#registerManaInfusionRecipe
|
||||
*/
|
||||
public static RecipeManaInfusion registerManaConjurationRecipe(ItemStack output, Object input, int mana) {
|
||||
RecipeManaInfusion recipe = registerManaInfusionRecipe(output, input, mana);
|
||||
recipe.setConjuration(true);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Elven Trade recipe (throw an item in an Alfheim Portal).
|
||||
* @param output The ItemStack to return.
|
||||
* @param inputs The items required, can be ItemStack or ore dictionary entry string.
|
||||
* @return The recipe created.
|
||||
*/
|
||||
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack output, Object... inputs) {
|
||||
RecipeElvenTrade recipe = new RecipeElvenTrade(output, inputs);
|
||||
elvenTradeRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Brew Recipe (for the Botanical Brewery).
|
||||
* @param brew The brew in to be set in this recipe.
|
||||
* @inputs The items used in the recipe, no more than 6.
|
||||
*/
|
||||
public static RecipeBrew registerBrewRecipe(Brew brew, Object... inputs) {
|
||||
RecipeBrew recipe = new RecipeBrew(brew, inputs);
|
||||
brewRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a SubTileEntity, a new special flower. Look in the subtile package of the API.
|
||||
* If you call this after PostInit you're a failiure and we are very disappointed in you.
|
||||
*/
|
||||
public static void registerSubTile(String key, Class<? extends SubTileEntity> subtileClass) {
|
||||
subTiles.put(key, subtileClass);
|
||||
subTileMods.put(key, Loader.instance().activeModContainer().getModId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a SubTileEntity and makes it a mini flower. Also adds the recipe and returns it.
|
||||
* @see BotaniaAPI#registerSubTile
|
||||
*/
|
||||
public static RecipeManaInfusion registerMiniSubTile(String key, Class<? extends SubTileEntity> subtileClass, String original) {
|
||||
registerSubTile(key, subtileClass);
|
||||
miniFlowers.put(original, key);
|
||||
|
||||
RecipeMiniFlower recipe = new RecipeMiniFlower(key, original, 2500);
|
||||
manaInfusionRecipes.add(recipe);
|
||||
miniFlowerRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a SubTileEntity's signature.
|
||||
* @see SubTileSignature
|
||||
*/
|
||||
public static void registerSubTileSignature(Class<? extends SubTileEntity> subtileClass, SubTileSignature signature) {
|
||||
subTileSignatures.put(subtileClass, signature);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the singleton signature for a SubTileEntity class. Registers a fallback if one wasn't registered
|
||||
* before the call.
|
||||
*/
|
||||
public static SubTileSignature getSignatureForClass(Class<? extends SubTileEntity> subtileClass) {
|
||||
if(!subTileSignatures.containsKey(subtileClass))
|
||||
registerSubTileSignature(subtileClass, new BasicSignature(subTiles.inverse().get(subtileClass)));
|
||||
|
||||
return subTileSignatures.get(subtileClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the singleton signature for a SubTileEntity's name. Registers a fallback if one wasn't registered
|
||||
* before the call.
|
||||
*/
|
||||
public static SubTileSignature getSignatureForName(String name) {
|
||||
Class<? extends SubTileEntity> subtileClass = subTiles.get(name);
|
||||
return getSignatureForClass(subtileClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the key for a SubTileEntity into the creative menu. This goes into the
|
||||
* subtilesForCreativeMenu Set. This does not need to be called for mini flowers,
|
||||
* those will just use the mini flower map to add themselves next to the source.
|
||||
*/
|
||||
public static void addSubTileToCreativeMenu(String key) {
|
||||
subtilesForCreativeMenu.add(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a category to the list of registered categories to appear in the Lexicon.
|
||||
*/
|
||||
public static void addCategory(LexiconCategory category) {
|
||||
categories.add(category);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all registered categories.
|
||||
*/
|
||||
public static List<LexiconCategory> getAllCategories() {
|
||||
return categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all registered entries.
|
||||
*/
|
||||
public static List<LexiconEntry> getAllEntries() {
|
||||
return allEntries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Lexicon Entry and adds it to the category passed in.
|
||||
*/
|
||||
public static void addEntry(LexiconEntry entry, LexiconCategory category) {
|
||||
allEntries.add(entry);
|
||||
category.entries.add(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps an ore (ore dictionary key) to it's weight on the world generation. This
|
||||
* is used for the Orechid flower. Check the static block in the BotaniaAPI class
|
||||
* to get the weights for the vanilla blocks.<br>
|
||||
* Alternatively get the values with the OreDetector mod:<br>
|
||||
* https://gist.github.com/Vazkii/9493322
|
||||
*/
|
||||
public static void addOreWeight(String ore, int weight) {
|
||||
oreWeights.put(ore, weight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps an ore (ore dictionary key) to it's weight on the nether world generation. This
|
||||
* is used for the Orechid Ignem flower. Check the static block in the BotaniaAPI class
|
||||
* to get the weights for the vanilla blocks.<br>
|
||||
* Alternatively get the values with the OreDetector mod:<br>
|
||||
* https://gist.github.com/Vazkii/9493322
|
||||
*/
|
||||
public static void addOreWeightNether(String ore, int weight) {
|
||||
if(ore.contains("Nether") && OreDictionary.getOres(ore.replace("Nether", "")).size() == 0)
|
||||
return;
|
||||
|
||||
oreWeightsNether.put(ore, weight);
|
||||
}
|
||||
|
||||
public static int getOreWeight(String ore) {
|
||||
return oreWeights.get(ore);
|
||||
}
|
||||
|
||||
public static int getOreWeightNether(String ore) {
|
||||
return oreWeightsNether.get(ore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows an item to be counted as a seed. Any item in this list can be
|
||||
* dispensed by a dispenser, the block is the block to be placed.
|
||||
*/
|
||||
public static void addSeed(Item item, Block block) {
|
||||
seeds.put(item, block);
|
||||
}
|
||||
|
||||
/**
|
||||
* Blacklists an item from the Loonium drop table.
|
||||
*/
|
||||
public static void blackListItemFromLoonium(Item item) {
|
||||
looniumBlacklist.add(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last recipe to have been added to the recipe list.
|
||||
*/
|
||||
public static IRecipe getLatestAddedRecipe() {
|
||||
List<IRecipe> list = CraftingManager.getInstance().getRecipeList();
|
||||
return list.get(list.size() - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last x recipes added to the recipe list.
|
||||
*/
|
||||
public static List<IRecipe> getLatestAddedRecipes(int x) {
|
||||
List<IRecipe> list = CraftingManager.getInstance().getRecipeList();
|
||||
List<IRecipe> newList = new ArrayList();
|
||||
for(int i = x - 1; i >= 0; i--)
|
||||
newList.add(list.get(list.size() - 1 - i));
|
||||
|
||||
return newList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Wiki provider for a mod so it uses that instead of the fallback
|
||||
* FTB wiki. Make sure to call this on PostInit only!
|
||||
*/
|
||||
public static void registerModWiki(String mod, IWikiProvider provider) {
|
||||
WikiHooks.registerModWiki(mod, provider);
|
||||
}
|
||||
|
||||
public static Class<? extends SubTileEntity> getSubTileMapping(String key) {
|
||||
if(!subTiles.containsKey(key))
|
||||
key = "";
|
||||
|
||||
return subTiles.get(key);
|
||||
}
|
||||
|
||||
public static String getSubTileStringMapping(Class<? extends SubTileEntity> clazz) {
|
||||
return subTiles.inverse().get(clazz);
|
||||
}
|
||||
|
||||
public static Set<String> getAllSubTiles() {
|
||||
return subTiles.keySet();
|
||||
}
|
||||
|
||||
private static String getMagnetKey(ItemStack stack) {
|
||||
if(stack == null)
|
||||
return "";
|
||||
|
||||
return "i_" + stack.getItem().getUnlocalizedName() + "@" + stack.getItemDamage();
|
||||
}
|
||||
|
||||
private static String getMagnetKey(Block block, int meta) {
|
||||
return "bm_" + block.getUnlocalizedName() + "@" + meta;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Oct 29, 2014, 6:09:48 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.boss;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.boss.IBossDisplayData;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* An extension of IBossDisplayData. This counts as a botania boss and as a normal
|
||||
* minecraft boss since it has IBossDisplayData. Instead of using the typical
|
||||
* BossStatus.setBossStatus(entity, true) to set the health bar in the render use
|
||||
* BotaniaAPI.internalMethodHandler.setBossStatus(entity);<br><br>
|
||||
* Alternatively, you can check if botania is loaded and use the vanilla one
|
||||
* if that's not the case.
|
||||
*/
|
||||
public interface IBotaniaBoss extends IBossDisplayData {
|
||||
|
||||
/**
|
||||
* The ResourceLocation to bind for this boss's boss bar.
|
||||
* You can use BotaniaAPI.internalMethodHandler.getDefaultBossBarTexture() to get
|
||||
* the one used by botania bosses.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getBossBarTexture();
|
||||
|
||||
/**
|
||||
* A Rectangle instance delimiting the uv, width and height of this boss's
|
||||
* boss bar texture. This is for the background, not the bar that shows
|
||||
* the HP.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Rectangle getBossBarTextureRect();
|
||||
|
||||
/**
|
||||
* A Rectangle instance delimiting the uv, width and height of this boss's
|
||||
* boss bar HP texture. This is for the foreground that shows how much
|
||||
* HP the boss has. The width of the rectangle will be multiplied by the
|
||||
* faction of the boss's current HP by max HP.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Rectangle getBossBarHPTextureRect();
|
||||
|
||||
/**
|
||||
* A callback for when this boss's boss bar renders, you can do aditional rendering
|
||||
* here if needed.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void bossBarRenderCallback(ScaledResolution res, int x, int y);
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Oct 29, 2014, 6:13:21 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.boss;
|
||||
|
||||
import vazkii.botania.api.internal.ShaderCallback;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* A Botania boss whose HP bar makes use of shaders. Shaders
|
||||
* used through this have a few uniforms available:
|
||||
* <li><b><i>int</i> time</b> - The amount of total ticks elapsed.</li>
|
||||
* <li><b><i>int</i> startX</b> - The U coordinate passed in for the render of this bar's texture.</li>
|
||||
* <li><b><i>int</i> startY</b> - The V coordinate passed in for the render of this bar's texture.</li>
|
||||
*/
|
||||
public interface IBotaniaBossWithShader extends IBotaniaBoss {
|
||||
|
||||
/**
|
||||
* The Shader Program to use for this boss bar. Return 0 case
|
||||
* you don't want a shader to be used. You can use separate shaders
|
||||
* for the background and foreground.
|
||||
* @param background True if rendering the background of the boss bar,
|
||||
* false if rendering the bar itself that shows the HP.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBossBarShaderProgram(boolean background);
|
||||
|
||||
/**
|
||||
* A callback for the shader, used to pass in uniforms. Return null for no callback.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ShaderCallback getBossBarShaderCallback(boolean background, int shader);
|
||||
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Nov 1, 2014, 6:22:54 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.brew;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
/**
|
||||
* The class for a Brew definition, each one is a singleton.
|
||||
*/
|
||||
public class Brew {
|
||||
|
||||
String key;
|
||||
String name;
|
||||
int color;
|
||||
int cost;
|
||||
List<PotionEffect> effects;
|
||||
boolean canInfuseBloodPendant = true;
|
||||
boolean canInfuseIncense = true;
|
||||
|
||||
/**
|
||||
* @param name The unlocalized name of this potion.
|
||||
* @param color The color for the potion to be rendered in the bottle, note that it will get
|
||||
* changed a bit when it renders (for more or less brightness) to give a fancy effect.
|
||||
* @param cost The cost, in Mana for this brew.
|
||||
* @param effects A list of effects to apply to the player when they drink it.
|
||||
*/
|
||||
public Brew(String key, String name, int color, int cost, PotionEffect... effects) {
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
this.cost = cost;
|
||||
this.effects = new ArrayList(Arrays.asList(effects));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this brew to not be able to be infused onto the Tainted Blood Pendant.
|
||||
*/
|
||||
public Brew setNotBloodPendantInfusable() {
|
||||
canInfuseBloodPendant = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this brew to not be able to be infused onto Incense Sticks.
|
||||
*/
|
||||
public Brew setNotIncenseInfusable() {
|
||||
canInfuseIncense = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean canInfuseBloodPendant() {
|
||||
return canInfuseBloodPendant;
|
||||
}
|
||||
|
||||
public boolean canInfuseIncense() {
|
||||
return canInfuseIncense;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the key for this brew, for it to be found in the map in the API.
|
||||
* This should ALWAYS return the same result.
|
||||
*/
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the insensitive unlocalized name. This is used for the lexicon.
|
||||
*/
|
||||
public String getUnlocalizedName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the unlocalized name for the ItemStack passed in.
|
||||
*/
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the display color for the ItemStack passed in. Note that for
|
||||
* the lexicon, this passes in a botania Managlass Vial or an
|
||||
* Alfglass Flask at all times.
|
||||
*/
|
||||
public int getColor(ItemStack stack) {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the insensitive unlocalized mana cost. This is used for the lexicon.
|
||||
*/
|
||||
public int getManaCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mana cost for the ItemStack passed in.
|
||||
*/
|
||||
public int getManaCost(ItemStack stack) {
|
||||
return getManaCost();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of potion effects for the ItemStack passed in.
|
||||
* Note that for the lexicon, this passes in a botania Managlass
|
||||
* Vial or an Alfglass Flask at all times.
|
||||
*/
|
||||
public List<PotionEffect> getPotionEffects(ItemStack stack) {
|
||||
return effects;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Nov 1, 2014, 6:26:40 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.brew;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* An Item that implements this counts as a Brew Container, by which
|
||||
* it can be used a center item for brew recipes and can contain
|
||||
* a brew.
|
||||
*/
|
||||
public interface IBrewContainer {
|
||||
|
||||
/**
|
||||
* Returs an ItemStack that should be an item that has the brew
|
||||
* passed in.
|
||||
*/
|
||||
public ItemStack getItemForBrew(Brew brew, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the cost to add this brew onto this container. Return -1
|
||||
* to not allow for the brew to be added. Normally you'd
|
||||
* use brew.getManaCost(stack);
|
||||
*/
|
||||
public int getManaCost(Brew brew, ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Nov 1, 2014, 9:20:33 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.brew;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* An Item that implements this is a Brew item, by which it contains
|
||||
* a brew. This is only used in vanilla to prevent the brew item
|
||||
* from going back into the brewery but other mods might use it for whatever.
|
||||
*/
|
||||
public interface IBrewItem {
|
||||
|
||||
public Brew getBrew(ItemStack brew);
|
||||
|
||||
}
|
||||
@@ -1,321 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Feb 14, 2015, 3:28:54 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
public final class CorporeaHelper {
|
||||
|
||||
private static final List<IInventory> empty = Collections.unmodifiableList(new ArrayList());
|
||||
private static final WeakHashMap<List<ICorporeaSpark>, List<IInventory>> cachedNetworks = new WeakHashMap();
|
||||
private static final List<ICorporeaAutoCompleteController> autoCompleteControllers = new ArrayList<ICorporeaAutoCompleteController>();
|
||||
|
||||
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
||||
|
||||
public static final String[] WILDCARD_STRINGS = new String[] {
|
||||
"...", "~", "+", "?" , "*"
|
||||
};
|
||||
|
||||
/**
|
||||
* How many items were matched in the last request. If java had "out" params like C# this wouldn't be needed :V
|
||||
*/
|
||||
public static int lastRequestMatches = 0;
|
||||
/**
|
||||
* How many items were extracted in the last request.
|
||||
*/
|
||||
public static int lastRequestExtractions = 0;
|
||||
|
||||
/**
|
||||
* Gets a list of all the inventories on this spark network. This list is cached for use once every tick,
|
||||
* and if something changes during that tick it'll still have the first result.
|
||||
*/
|
||||
public static List<IInventory> getInventoriesOnNetwork(ICorporeaSpark spark) {
|
||||
ICorporeaSpark master = spark.getMaster();
|
||||
if(master == null)
|
||||
return empty;
|
||||
List<ICorporeaSpark> network = master.getConnections();
|
||||
|
||||
if(cachedNetworks.containsKey(network)) {
|
||||
List<IInventory> cache = cachedNetworks.get(network);
|
||||
if(cache != null)
|
||||
return cache;
|
||||
}
|
||||
|
||||
List<IInventory> inventories = new ArrayList();
|
||||
if(network != null)
|
||||
for(ICorporeaSpark otherSpark : network)
|
||||
if(otherSpark != null) {
|
||||
IInventory inv = otherSpark.getInventory();
|
||||
if(inv != null)
|
||||
inventories.add(inv);
|
||||
}
|
||||
|
||||
cachedNetworks.put(network, inventories);
|
||||
return inventories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of available items in the network of the type passed in, checking NBT or not.
|
||||
* The higher level functions that use a List< IInventory > or a Map< IInventory, Integer > should be
|
||||
* called instead if the context for those exists to avoid having to get the values again.
|
||||
*/
|
||||
public static int getCountInNetwork(ItemStack stack, ICorporeaSpark spark, boolean checkNBT) {
|
||||
List<IInventory> inventories = getInventoriesOnNetwork(spark);
|
||||
return getCountInNetwork(stack, inventories, checkNBT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of available items in the network of the type passed in, checking NBT or not.
|
||||
* The higher level function that use a Map< IInventory, Integer > should be
|
||||
* called instead if the context for this exists to avoid having to get the value again.
|
||||
*/
|
||||
public static int getCountInNetwork(ItemStack stack, List<IInventory> inventories, boolean checkNBT) {
|
||||
Map<IInventory, Integer> map = getInventoriesWithItemInNetwork(stack, inventories, checkNBT);
|
||||
return getCountInNetwork(stack, map, checkNBT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of available items in the network of the type passed in, checking NBT or not.
|
||||
*/
|
||||
public static int getCountInNetwork(ItemStack stack, Map<IInventory, Integer> inventories, boolean checkNBT) {
|
||||
int count = 0;
|
||||
|
||||
for(IInventory inv : inventories.keySet())
|
||||
count += inventories.get(inv);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a Map mapping IInventories to the amount of items of the type passed in that exist
|
||||
* The higher level function that use a List< IInventory > should be
|
||||
* called instead if the context for this exists to avoid having to get the value again.
|
||||
*/
|
||||
public static Map<IInventory, Integer> getInventoriesWithItemInNetwork(ItemStack stack, ICorporeaSpark spark, boolean checkNBT) {
|
||||
List<IInventory> inventories = getInventoriesOnNetwork(spark);
|
||||
return getInventoriesWithItemInNetwork(stack, inventories, checkNBT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a Map mapping IInventories to the amount of items of the type passed in that exist
|
||||
* The deeper level function that use a List< IInventory > should be
|
||||
* called instead if the context for this exists to avoid having to get the value again.
|
||||
*/
|
||||
public static Map<IInventory, Integer> getInventoriesWithItemInNetwork(ItemStack stack,List<IInventory> inventories, boolean checkNBT) {
|
||||
Map<IInventory, Integer> countMap = new HashMap<IInventory, Integer>();
|
||||
List<IWrappedInventory> wrappedInventories = BotaniaAPI.internalHandler.wrapInventory(inventories);
|
||||
for (IWrappedInventory inv : wrappedInventories) {
|
||||
CorporeaRequest request = new CorporeaRequest(stack, checkNBT, -1);
|
||||
inv.countItems(request);
|
||||
if (request.foundItems > 0) {
|
||||
countMap.put(inv.getWrappedObject(), request.foundItems);
|
||||
}
|
||||
}
|
||||
|
||||
return countMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bridge for requestItem() using an ItemStack.
|
||||
*/
|
||||
public static List<ItemStack> requestItem(ItemStack stack, ICorporeaSpark spark, boolean checkNBT, boolean doit) {
|
||||
return requestItem(stack, stack.stackSize, spark, checkNBT, doit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bridge for requestItem() using a String and an item count.
|
||||
*/
|
||||
public static List<ItemStack> requestItem(String name, int count, ICorporeaSpark spark, boolean doit) {
|
||||
return requestItem(name, count, spark, false, doit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests list of ItemStacks of the type passed in from the network, or tries to, checking NBT or not.
|
||||
* This will remove the items from the adequate inventories unless the "doit" parameter is false.
|
||||
* Returns a new list of ItemStacks of the items acquired or an empty list if none was found.
|
||||
* Case itemCount is -1 it'll find EVERY item it can.
|
||||
* <br><br>
|
||||
* The "matcher" parameter has to be an ItemStack or a String, if the first it'll check if the
|
||||
* two stacks are similar using the "checkNBT" parameter, else it'll check if the name of the item
|
||||
* equals or matches (case a regex is passed in) the matcher string.
|
||||
* <br><br>
|
||||
* When requesting counting of items, individual stacks may exceed maxStackSize for
|
||||
* purposes of counting huge amounts.
|
||||
*/
|
||||
public static List<ItemStack> requestItem(Object matcher, int itemCount, ICorporeaSpark spark, boolean checkNBT, boolean doit) {
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
CorporeaRequestEvent event = new CorporeaRequestEvent(matcher, itemCount, spark, checkNBT, doit);
|
||||
if(MinecraftForge.EVENT_BUS.post(event))
|
||||
return stacks;
|
||||
|
||||
List<IInventory> inventories = getInventoriesOnNetwork(spark);
|
||||
List<IWrappedInventory> inventoriesW = BotaniaAPI.internalHandler.wrapInventory(inventories);
|
||||
Map<ICorporeaInterceptor, ICorporeaSpark> interceptors = new HashMap<ICorporeaInterceptor, ICorporeaSpark>();
|
||||
|
||||
CorporeaRequest request = new CorporeaRequest(matcher, checkNBT, itemCount);
|
||||
for(IWrappedInventory inv : inventoriesW) {
|
||||
ICorporeaSpark invSpark = inv.getSpark();
|
||||
|
||||
Object originalInventory = inv.getWrappedObject();
|
||||
if(originalInventory instanceof ICorporeaInterceptor) {
|
||||
ICorporeaInterceptor interceptor = (ICorporeaInterceptor) originalInventory;
|
||||
interceptor.interceptRequest(matcher, itemCount, invSpark, spark, stacks, inventories, doit);
|
||||
interceptors.put(interceptor, invSpark);
|
||||
}
|
||||
|
||||
if(doit) {
|
||||
stacks.addAll(inv.extractItems(request));
|
||||
} else {
|
||||
stacks.addAll(inv.countItems(request));
|
||||
}
|
||||
}
|
||||
|
||||
lastRequestMatches = request.foundItems;
|
||||
lastRequestExtractions = request.extractedItems;
|
||||
|
||||
for(ICorporeaInterceptor interceptor : interceptors.keySet())
|
||||
interceptor.interceptRequestLast(matcher, itemCount, interceptors.get(interceptor), spark, stacks, inventories, doit);
|
||||
|
||||
return stacks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the spark attached to the inventory passed case it's a TileEntity.
|
||||
*/
|
||||
public static ICorporeaSpark getSparkForInventory(IInventory inv) {
|
||||
if(!(inv instanceof TileEntity))
|
||||
return null;
|
||||
|
||||
TileEntity tile = (TileEntity) inv;
|
||||
return getSparkForBlock(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the spark attached to the block in the coords passed in. Note that the coords passed
|
||||
* in are for the block that the spark will be on, not the coords of the spark itself.
|
||||
*/
|
||||
public static ICorporeaSpark getSparkForBlock(World world, int x, int y, int z) {
|
||||
List<ICorporeaSpark> sparks = world.getEntitiesWithinAABB(ICorporeaSpark.class, AxisAlignedBB.getBoundingBox(x, y + 1, z, x + 1, y + 2, z + 1));
|
||||
return sparks.isEmpty() ? null : sparks.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if the block in the coords passed in has a spark attached. Note that the coords passed
|
||||
* in are for the block that the spark will be on, not the coords of the spark itself.
|
||||
*/
|
||||
public static boolean doesBlockHaveSpark(World world, int x, int y, int z) {
|
||||
return getSparkForBlock(world, x, y, z) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if the slot passed in can be extracted from by a spark.
|
||||
*/
|
||||
public static boolean isValidSlot(IInventory inv, int slot) {
|
||||
return !(inv instanceof ISidedInventory) || arrayHas(((ISidedInventory) inv).getAccessibleSlotsFromSide(ForgeDirection.UP.ordinal()), slot) && ((ISidedInventory) inv).canExtractItem(slot, inv.getStackInSlot(slot), ForgeDirection.UP.ordinal());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if two stacks match.
|
||||
*/
|
||||
public static boolean stacksMatch(ItemStack stack1, ItemStack stack2, boolean checkNBT) {
|
||||
return stack1 != null && stack2 != null && stack1.isItemEqual(stack2) && (!checkNBT || ItemStack.areItemStackTagsEqual(stack1, stack2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if the name of a stack matches the string passed in.
|
||||
*/
|
||||
public static boolean stacksMatch(ItemStack stack, String s) {
|
||||
if(stack == null)
|
||||
return false;
|
||||
|
||||
boolean contains = false;
|
||||
for(String wc : WILDCARD_STRINGS) {
|
||||
if(s.endsWith(wc)) {
|
||||
contains = true;
|
||||
s = s.substring(0, s.length() - wc.length());
|
||||
}
|
||||
else if(s.startsWith(wc)) {
|
||||
contains = true;
|
||||
s = s.substring(wc.length());
|
||||
}
|
||||
|
||||
if(contains)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
String name = stripControlCodes(stack.getDisplayName().toLowerCase().trim());
|
||||
return equalOrContain(name, s, contains) || equalOrContain(name + "s", s, contains) || equalOrContain(name + "es", s, contains) || name.endsWith("y") && equalOrContain(name.substring(0, name.length() - 1) + "ies", s, contains);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the cached networks, called once per tick, should not be called outside
|
||||
* of the botania code.
|
||||
*/
|
||||
public static void clearCache() {
|
||||
cachedNetworks.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to check if an int array contains an int.
|
||||
*/
|
||||
public static boolean arrayHas(int[] arr, int val) {
|
||||
for (int element : arr)
|
||||
if(element == val)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to make stacksMatch() less messy.
|
||||
*/
|
||||
public static boolean equalOrContain(String s1, String s2, boolean contain) {
|
||||
return contain ? s1.contains(s2) : s1.equals(s2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a ICorporeaAutoCompleteController
|
||||
*/
|
||||
public static void registerAutoCompleteController(ICorporeaAutoCompleteController controller) {
|
||||
autoCompleteControllers.add(controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the auto complete helper should run
|
||||
*/
|
||||
public static boolean shouldAutoComplete() {
|
||||
for(ICorporeaAutoCompleteController controller : autoCompleteControllers)
|
||||
if(controller.shouldAutoComplete())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Copy from StringUtils
|
||||
public static String stripControlCodes(String str) {
|
||||
return patternControlCode.matcher(str).replaceAll("");
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vindex>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
|
||||
public class CorporeaRequest {
|
||||
public Object matcher;
|
||||
public boolean checkNBT;
|
||||
public int count;
|
||||
public int foundItems = 0;
|
||||
public int extractedItems = 0;
|
||||
|
||||
public CorporeaRequest(Object matcher, boolean checkNBT, int count) {
|
||||
super();
|
||||
this.matcher = matcher;
|
||||
this.checkNBT = checkNBT;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Apr 30, 2015, 2:55:57 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* Fired when a corporea request is initiated. Can be cancelled.
|
||||
*/
|
||||
@Cancelable
|
||||
public class CorporeaRequestEvent extends Event {
|
||||
|
||||
public final Object request;
|
||||
public final int count;
|
||||
public final ICorporeaSpark spark;
|
||||
public final boolean checkNBT;
|
||||
/**
|
||||
* If false then items won't be pulled.
|
||||
*/
|
||||
public final boolean realRequest;
|
||||
|
||||
public CorporeaRequestEvent(Object request, int count, ICorporeaSpark spark, boolean nbt, boolean real) {
|
||||
this.request = request;
|
||||
this.count = count;
|
||||
this.spark = spark;
|
||||
checkNBT = nbt;
|
||||
realRequest = real;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* This class was created by <SoundLogic>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [June 8, 2015, 1:04:05 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* An interface for systems which may control if the item auto complete system should be active
|
||||
*/
|
||||
public interface ICorporeaAutoCompleteController {
|
||||
|
||||
/**
|
||||
* Return true if auto completion should be enabled.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldAutoComplete();
|
||||
|
||||
}
|
||||
Loaded 100 of 392 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user