mirror of
https://github.com/GTNewHorizons/ForbiddenMagic.git
synced 2026-11-10 23:43:46 +00:00
Dragonrekt
This commit is contained in:
1 parent
1211e88fe2
commit
0eb028601d
23 files changed
+895
-4
No files matched your search
@@ -0,0 +1,11 @@
|
||||
package cofh.api;
|
||||
|
||||
public class CoFHAPIProps {
|
||||
|
||||
private CoFHAPIProps() {
|
||||
|
||||
}
|
||||
|
||||
public static final String VERSION = "1.7.10R1.0.2";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyStorage}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class EnergyStorage implements IEnergyStorage {
|
||||
|
||||
protected int energy;
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
|
||||
public EnergyStorage(int capacity) {
|
||||
|
||||
this(capacity, capacity, capacity);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxTransfer) {
|
||||
|
||||
this(capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxReceive, int maxExtract) {
|
||||
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public EnergyStorage readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
this.energy = nbt.getInteger("Energy");
|
||||
|
||||
if (energy > capacity) {
|
||||
energy = capacity;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||
|
||||
if (energy < 0) {
|
||||
energy = 0;
|
||||
}
|
||||
nbt.setInteger("Energy", energy);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public void setCapacity(int capacity) {
|
||||
|
||||
this.capacity = capacity;
|
||||
|
||||
if (energy > capacity) {
|
||||
energy = capacity;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMaxTransfer(int maxTransfer) {
|
||||
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
|
||||
public void setMaxReceive(int maxReceive) {
|
||||
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
|
||||
public void setMaxExtract(int maxExtract) {
|
||||
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public int getMaxReceive() {
|
||||
|
||||
return maxReceive;
|
||||
}
|
||||
|
||||
public int getMaxExtract() {
|
||||
|
||||
return maxExtract;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers
|
||||
* are guaranteed to have it.
|
||||
*
|
||||
* @param energy
|
||||
*/
|
||||
public void setEnergyStored(int energy) {
|
||||
|
||||
this.energy = energy;
|
||||
|
||||
if (this.energy > capacity) {
|
||||
this.energy = capacity;
|
||||
} else if (this.energy < 0) {
|
||||
this.energy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this
|
||||
* externally, as not all IEnergyHandlers are guaranteed to have it.
|
||||
*
|
||||
* @param energy
|
||||
*/
|
||||
public void modifyEnergyStored(int energy) {
|
||||
|
||||
this.energy += energy;
|
||||
|
||||
if (this.energy > capacity) {
|
||||
this.energy = capacity;
|
||||
} else if (this.energy < 0) {
|
||||
this.energy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* IEnergyStorage */
|
||||
@Override
|
||||
public int receiveEnergy(int maxReceive, boolean simulate) {
|
||||
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
if (!simulate) {
|
||||
energy += energyReceived;
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(int maxExtract, boolean simulate) {
|
||||
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if (!simulate) {
|
||||
energy -= energyExtracted;
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
|
||||
return energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not
|
||||
* accept it; otherwise just use IEnergyHandler.
|
||||
* <p>
|
||||
* Note that {@link IEnergyHandler} is an extension of this.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyConnection {
|
||||
|
||||
/**
|
||||
* Returns TRUE if the TileEntity can connect on a given side.
|
||||
*/
|
||||
boolean canConnectEnergy(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes that support external manipulation of their internal energy storages.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link ItemEnergyContainer}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyContainerItem {
|
||||
|
||||
/**
|
||||
* Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged.
|
||||
*
|
||||
* @param container
|
||||
* ItemStack to be charged.
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to be sent into the item.
|
||||
* @param simulate
|
||||
* If TRUE, the charge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) received by the item.
|
||||
*/
|
||||
int receiveEnergy(ItemStack container, int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally
|
||||
* discharged.
|
||||
*
|
||||
* @param container
|
||||
* ItemStack to be discharged.
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to be extracted from the item.
|
||||
* @param simulate
|
||||
* If TRUE, the discharge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted from the item.
|
||||
*/
|
||||
int extractEnergy(ItemStack container, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Get the amount of energy currently stored in the container item.
|
||||
*/
|
||||
int getEnergyStored(ItemStack container);
|
||||
|
||||
/**
|
||||
* Get the max amount of energy that can be stored in the container item.
|
||||
*/
|
||||
int getMaxEnergyStored(ItemStack container);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver {
|
||||
|
||||
// merely a convenience interface (remove these methods in 1.8; provided here for back-compat via compiler doing things)
|
||||
|
||||
/**
|
||||
* Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
|
||||
*
|
||||
* @param from
|
||||
* Orientation the energy is received from.
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to receive.
|
||||
* @param simulate
|
||||
* If TRUE, the charge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) received.
|
||||
*/
|
||||
@Override
|
||||
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
|
||||
*
|
||||
* @param from
|
||||
* Orientation the energy is extracted from.
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to extract.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted.
|
||||
*/
|
||||
@Override
|
||||
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
@Override
|
||||
int getEnergyStored(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
@Override
|
||||
int getMaxEnergyStored(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which should provide energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyProvider extends IEnergyConnection {
|
||||
|
||||
/**
|
||||
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
|
||||
*
|
||||
* @param from
|
||||
* Orientation the energy is extracted from.
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to extract.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted.
|
||||
*/
|
||||
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyReceiver extends IEnergyConnection {
|
||||
|
||||
/**
|
||||
* Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
|
||||
*
|
||||
* @param from
|
||||
* Orientation the energy is received from.
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to receive.
|
||||
* @param simulate
|
||||
* If TRUE, the charge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) received.
|
||||
*/
|
||||
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
/**
|
||||
* An energy storage is the unit of interaction with Energy inventories.<br>
|
||||
* This is not to be implemented on TileEntities. This is for internal use only.
|
||||
* <p>
|
||||
* A reference implementation can be found at {@link EnergyStorage}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyStorage {
|
||||
|
||||
/**
|
||||
* Adds energy to the storage. Returns quantity of energy that was accepted.
|
||||
*
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to be inserted.
|
||||
* @param simulate
|
||||
* If TRUE, the insertion will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) accepted by the storage.
|
||||
*/
|
||||
int receiveEnergy(int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Removes energy from the storage. Returns quantity of energy that was removed.
|
||||
*
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to be extracted.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted from the storage.
|
||||
*/
|
||||
int extractEnergy(int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored();
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
||||
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
|
||||
public ItemEnergyContainer() {
|
||||
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity) {
|
||||
|
||||
this(capacity, capacity, capacity);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity, int maxTransfer) {
|
||||
|
||||
this(capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity, int maxReceive, int maxExtract) {
|
||||
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public ItemEnergyContainer setCapacity(int capacity) {
|
||||
|
||||
this.capacity = capacity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setMaxTransfer(int maxTransfer) {
|
||||
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
|
||||
public void setMaxReceive(int maxReceive) {
|
||||
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
|
||||
public void setMaxExtract(int maxExtract) {
|
||||
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
/* IEnergyContainerItem */
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
|
||||
if (container.stackTagCompound == null) {
|
||||
container.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
if (!simulate) {
|
||||
energy += energyReceived;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if (!simulate) {
|
||||
energy -= energyExtracted;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack container) {
|
||||
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
return container.stackTagCompound.getInteger("Energy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack container) {
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyHandler}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class TileEnergyHandler extends TileEntity implements IEnergyHandler {
|
||||
|
||||
protected EnergyStorage storage = new EnergyStorage(32000);
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
super.readFromNBT(nbt);
|
||||
storage.readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
|
||||
super.writeToNBT(nbt);
|
||||
storage.writeToNBT(nbt);
|
||||
}
|
||||
|
||||
/* IEnergyConnection */
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* IEnergyReceiver */
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
|
||||
return storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
/* IEnergyProvider */
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
|
||||
return storage.extractEnergy(maxExtract, simulate);
|
||||
}
|
||||
|
||||
/* IEnergyReceiver and IEnergyProvider */
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
|
||||
return storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
|
||||
return storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||
* http://www.teamcofh.com
|
||||
*/
|
||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|energy")
|
||||
package cofh.api.energy;
|
||||
|
||||
import cofh.api.CoFHAPIProps;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||
* http://www.teamcofh.com
|
||||
*/
|
||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI")
|
||||
package cofh.api;
|
||||
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -28,6 +28,7 @@ public class Config {
|
||||
public static int impactEnchID;
|
||||
|
||||
public static int bloodSealPotionID = 70;
|
||||
public static int dragonwrackPotionID = 71;
|
||||
|
||||
public static int hellfireUpgradeID;
|
||||
public static int pandemoniumUpgradeID;
|
||||
@@ -59,6 +60,7 @@ public class Config {
|
||||
public static boolean special = true;
|
||||
public static boolean twilight = true;
|
||||
public static boolean emc = true;
|
||||
public static boolean dargon = true;
|
||||
//public static boolean eewand = true;
|
||||
|
||||
public static int bloodvis = 5;
|
||||
@@ -114,6 +116,7 @@ public class Config {
|
||||
}
|
||||
|
||||
bloodSealPotionID = conf.get("potions", "Blood Seal", bloodSealPotionID).getInt(bloodSealPotionID);
|
||||
dragonwrackPotionID = conf.get("potions", "Dragonwrack", dragonwrackPotionID).getInt(dragonwrackPotionID);
|
||||
|
||||
crossMod = conf.get("compatibility", "Cross-Mod Interaction", crossMod, "Disable to keep mods segregated.").getBoolean(true);
|
||||
crossWand = conf.get("compatibility", "Conversion Wands", crossWand, "Disable to remove all conversion wands.").getBoolean(true);
|
||||
@@ -124,6 +127,7 @@ public class Config {
|
||||
tc = conf.get("compatibility", "Tinkers Construct Interaction", tc).getBoolean(true);
|
||||
special = conf.get("compatibility", "Special Mobs Interaction", special).getBoolean(true);
|
||||
twilight = conf.get("compatibility", "Twilight Forest Interaction", twilight).getBoolean(true);
|
||||
dargon = conf.get("compatibility", "Draconic Evolution Interaction", dargon).getBoolean(true);
|
||||
emc = conf.get("compatibility", "Equivalent Exchange 3 EMC", emc, "Disable if you don't want Forbidden Magic to add EMC values to items.").getBoolean(true);
|
||||
//eewand = conf.get("compatibility", "Equivalent Exchange 3 Wand", eewand, "Disable to specifically disable the EMC to Vis wand.").getBoolean(true);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class Forbidden {
|
||||
ForbiddenItems.addItems();
|
||||
ForbiddenBlocks.addBlocks();
|
||||
DarkEnchantments.hex();
|
||||
if(Compat.bm)
|
||||
if(Compat.bm || Compat.dargon)
|
||||
DarkPotions.alchemize();
|
||||
proxy.registerRenderInfo();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ package fox.spiteful.forbidden.compat;
|
||||
import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy;
|
||||
import fox.spiteful.forbidden.*;
|
||||
import fox.spiteful.forbidden.blocks.ForbiddenBlocks;
|
||||
import fox.spiteful.forbidden.items.tools.ItemDragonslayer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -32,6 +34,7 @@ public class Compat {
|
||||
public static boolean special = false;
|
||||
public static boolean twilight = false;
|
||||
public static boolean ee3 = false;
|
||||
public static boolean dargon = false;
|
||||
|
||||
public static void initiate() {
|
||||
if(!Config.crossMod)
|
||||
@@ -45,6 +48,7 @@ public class Compat {
|
||||
special = Config.wrathCage && Config.special && Loader.isModLoaded("SpecialMobs");
|
||||
twilight = Config.wrathCage && Config.twilight && Loader.isModLoaded("TwilightForest");
|
||||
ee3 = (Config.emc /* || Config.eewand*/) && Loader.isModLoaded("EE3");
|
||||
dargon = Config.dargon && Loader.isModLoaded("DraconicEvolution");
|
||||
}
|
||||
|
||||
public static void compatify() {
|
||||
@@ -379,6 +383,30 @@ public class Compat {
|
||||
Config.spawnerMobs.put("TwilightForest.Yeti", Aspect.COLD);
|
||||
Config.spawnerMobs.put("TwilightForest.WinterWolf", Aspect.COLD);
|
||||
}
|
||||
|
||||
if(dargon){
|
||||
try {
|
||||
|
||||
Item ingot = Items.iron_ingot;
|
||||
Item sword = Items.iron_sword;
|
||||
if(twilight){
|
||||
try {
|
||||
ingot = getItem("TwilightForest", "item.knightMetal");
|
||||
sword = getItem("TwilightForest", "item.knightlySword");
|
||||
}catch (Exception e){
|
||||
LogHandler.log(Level.INFO, e, "Forbidden Magic couldn't figure out Twilight Forest's progression.");
|
||||
twilight = false;
|
||||
}
|
||||
}
|
||||
((ItemDragonslayer)ForbiddenItems.dragonslayer).repair = ingot;
|
||||
InfusionRecipe dragonslayer_recipe = ThaumcraftApi.addInfusionCraftingRecipe("DRAGONSLAYER", new ItemStack(ForbiddenItems.dragonslayer, 1), 6, (new AspectList()).add(Aspect.LIGHT, 16).add(Aspect.ORDER, 8).add(Aspect.MAN, 16).add(Aspect.METAL, 32), new ItemStack(sword), new ItemStack[]{new ItemStack(Items.nether_star, 1), new ItemStack(Items.golden_helmet, 1, 0), new ItemStack(Items.writable_book, 1), new ItemStack(Items.ender_pearl, 1, 2)});
|
||||
(new DarkResearchItem("DRAGONSLAYER", "FORBIDDEN", "[DE]", (new AspectList()).add(Aspect.WEAPON, 16).add(Aspect.ARMOR, 8).add(Aspect.MIND, 4), 2, -6, 3, new ItemStack(ForbiddenItems.dragonslayer, 1))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.DRAGONSLAYER.1"), new ResearchPage(dragonslayer_recipe)}).setParents("INFUSION").setConcealed().registerResearchItem();
|
||||
|
||||
} catch (Exception e) {
|
||||
LogHandler.log(Level.INFO, e, "Forbidden Magic wasn't unbalanced enough for Draconic Evolution.");
|
||||
dargon = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Item getItem(String mod, String item) throws ItemNotFoundException {
|
||||
|
||||
@@ -55,6 +55,8 @@ public class ForbiddenItems {
|
||||
public static Item bloodOrb;
|
||||
public static Item boundwell;
|
||||
|
||||
public static Item dragonslayer;
|
||||
|
||||
public static WandRod WAND_ROD_TAINTED;
|
||||
public static WandRod WAND_ROD_INFERNAL;
|
||||
public static WandRod WAND_ROD_NEUTRONIUM;
|
||||
@@ -143,7 +145,7 @@ public class ForbiddenItems {
|
||||
WAND_CAP_VINTEUM = new DarkWandCap("vinteum", 0.9F, new ItemStack(wandCap, 1, 1), 6, new ResourceLocation("forbidden", "textures/models/wand_cap_vinteum.png"));
|
||||
WAND_CAP_MANASTEEL = new DarkWandCap("manasteel", 0.9F, new ItemStack(wandCap, 1, 3), 6, new ResourceLocation("forbidden", "textures/models/wand_cap_manasteel.png"));
|
||||
WAND_CAP_ELEMENTIUM = new DarkWandCap("elementium", 0.8F, new ItemStack(wandCap, 1, 5), 9, new ResourceLocation("forbidden", "textures/models/wand_cap_elementium.png"));
|
||||
WAND_CAP_TERRASTEEL = new DarkWandCap("terrasteel", 1.8F, new ItemStack(wandCap, 1, 5), 1, new ResourceLocation("forbidden", "textures/models/wand_cap_terrasteel.png"));
|
||||
WAND_CAP_TERRASTEEL = new DarkWandCap("terrasteel", 1.8F, new ItemStack(wandCap, 1, 2), 1, new ResourceLocation("forbidden", "textures/models/wand_cap_terrasteel.png"));
|
||||
|
||||
|
||||
resource = new ItemResource().setUnlocalizedName("FMResource");
|
||||
@@ -169,6 +171,16 @@ public class ForbiddenItems {
|
||||
}
|
||||
}
|
||||
|
||||
if(Compat.dargon){
|
||||
try {
|
||||
dragonslayer = new ItemDragonslayer().setUnlocalizedName("Sword_Dragonslayer");
|
||||
GameRegistry.registerItem(dragonslayer, "Dragonslayer");
|
||||
}
|
||||
catch (Throwable e){
|
||||
Compat.dargon = false;
|
||||
}
|
||||
}
|
||||
|
||||
crystalwell = new ItemCrystalwell().setUnlocalizedName("Crystalwell");
|
||||
GameRegistry.registerItem(crystalwell, "Crystalwell");
|
||||
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
package fox.spiteful.forbidden.items.tools;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.forbidden.Config;
|
||||
import fox.spiteful.forbidden.Forbidden;
|
||||
import fox.spiteful.forbidden.LogHandler;
|
||||
import fox.spiteful.forbidden.compat.Compat;
|
||||
import fox.spiteful.forbidden.potions.DarkPotions;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EntityDamageSource;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import thaumcraft.api.IRepairable;
|
||||
|
||||
public class ItemDragonslayer extends ItemSword implements IRepairable {
|
||||
public IIcon icon;
|
||||
public Item repair;
|
||||
|
||||
public ItemDragonslayer() {
|
||||
super(ToolMaterial.EMERALD);
|
||||
this.setCreativeTab(Forbidden.tab);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister ir) {
|
||||
this.icon = ir.registerIcon("forbidden:dragonslayer");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int par1) {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack itemstack) {
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack stack, ItemStack stack2) {
|
||||
return stack2.getItem() == repair || super.getIsRepairable(stack, stack2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase player) {
|
||||
stack.damageItem(1, player);
|
||||
if (!victim.worldObj.isRemote && Compat.dargon & isDragon(victim)) {
|
||||
absoluteDamage(victim, new EntityDamageSource("dragonslayer", player).setDamageBypassesArmor(), Math.max(4F, victim.getMaxHealth() / 5F));
|
||||
if(victim instanceof EntityPlayer) {
|
||||
EntityPlayer target = (EntityPlayer)victim;
|
||||
for(int x = 0;x < 5;x++){
|
||||
if(target.getEquipmentInSlot(x) != null){
|
||||
ItemStack equip = target.getEquipmentInSlot(x);
|
||||
if(equip.getItem() instanceof IEnergyContainerItem){
|
||||
IEnergyContainerItem battery = (IEnergyContainerItem)equip.getItem();
|
||||
battery.extractEnergy(equip, battery.getMaxEnergyStored(equip) / 20, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
victim.addPotionEffect(new PotionEffect(DarkPotions.dragonwrack.getId(), 300));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isDragon(Entity target){
|
||||
if(target == null)
|
||||
return false;
|
||||
if(target instanceof EntityPlayer){
|
||||
EntityPlayer player = (EntityPlayer)target;
|
||||
for(int x = 1;x < 5;x++){
|
||||
if(player.getEquipmentInSlot(x) != null){
|
||||
UniqueIdentifier id = GameRegistry.findUniqueIdentifierFor(player.getEquipmentInSlot(x).getItem());
|
||||
if(id != null && id.modId.equals("DraconicEvolution"))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(target instanceof EntityDragon ||
|
||||
target.getCommandSenderName().toLowerCase().contains("dragon") ||
|
||||
target.getCommandSenderName().toLowerCase().contains("drake") ||
|
||||
target.getCommandSenderName().toLowerCase().contains("dracon"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void absoluteDamage(EntityLivingBase target, DamageSource src, float damage){
|
||||
target.func_110142_aN().func_94547_a(src, target.getHealth(), damage);
|
||||
target.setHealth(target.getHealth() - damage);
|
||||
if(target.getHealth() < 1){
|
||||
target.onDeath(src);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onGetHurt(LivingHurtEvent event) {
|
||||
if(event.entityLiving instanceof EntityPlayer && event.source.getEntity() != null){
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
ItemStack equip = player.getCurrentEquippedItem();
|
||||
if(equip != null && equip.getItem() == this && isDragon(event.source.getEntity())){
|
||||
event.ammount = Math.min(event.ammount, 3F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onAttacked(LivingAttackEvent event) {
|
||||
if(event.entityLiving instanceof EntityPlayer && event.source.getEntity() != null){
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
ItemStack equip = player.getCurrentEquippedItem();
|
||||
if(equip != null && player.isUsingItem() && equip.getItem() == this && isDragon(event.source.getEntity())){
|
||||
event.setCanceled(true);
|
||||
if(event.source.getEntity() instanceof EntityPlayer) {
|
||||
EntityPlayer other = (EntityPlayer)event.source.getEntity();
|
||||
other.addPotionEffect(new PotionEffect(DarkPotions.dragonwrack.getId(), 300));
|
||||
for(int x = 0;x < 5;x++){
|
||||
if(other.getEquipmentInSlot(x) != null){
|
||||
ItemStack gear = other.getEquipmentInSlot(x);
|
||||
if(gear.getItem() instanceof IEnergyContainerItem){
|
||||
IEnergyContainerItem battery = (IEnergyContainerItem)gear.getItem();
|
||||
battery.extractEnergy(gear, battery.getMaxEnergyStored(gear) / 50, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class ItemSkullAxe extends ItemSword implements IRepairable {
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack stack, ItemStack stack2) {
|
||||
return stack2.isItemEqual(new ItemStack(Config.thaumcraftResource.getItem(), 1, 2)) ? true : super.getIsRepairable(stack, stack2);
|
||||
return stack2.isItemEqual(new ItemStack(Config.thaumcraftResource.getItem(), 1, 2)) || super.getIsRepairable(stack, stack2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package fox.spiteful.forbidden.potions;
|
||||
|
||||
import fox.spiteful.forbidden.Config;
|
||||
import fox.spiteful.forbidden.compat.Compat;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
@@ -10,6 +11,7 @@ import java.lang.reflect.Modifier;
|
||||
public class DarkPotions {
|
||||
public static final ResourceLocation icons = new ResourceLocation("forbidden", "textures/misc/potions.png");
|
||||
public static Potion bloodSeal;
|
||||
public static Potion dragonwrack;
|
||||
|
||||
public static void alchemize(){
|
||||
if(Potion.potionTypes.length < 256) {
|
||||
@@ -33,6 +35,15 @@ public class DarkPotions {
|
||||
}
|
||||
}
|
||||
|
||||
bloodSeal = new PotionBloodSeal(Config.bloodSealPotionID);
|
||||
if(Compat.bm)
|
||||
bloodSeal = new PotionBloodSeal(Config.bloodSealPotionID);
|
||||
if(Compat.dargon) {
|
||||
try {
|
||||
dragonwrack = new PotionDragonwrack(Config.dragonwrackPotionID);
|
||||
}
|
||||
catch (Exception e){
|
||||
Compat.dargon = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package fox.spiteful.forbidden.potions;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.forbidden.items.tools.ItemDragonslayer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
public class PotionDragonwrack extends Potion {
|
||||
|
||||
DamageSource wrack;
|
||||
|
||||
public PotionDragonwrack(int id){
|
||||
super(id, false, 0xFFFFAA);
|
||||
this.setPotionName("potion.dragonwrack");
|
||||
this.setIconIndex(4, 1);
|
||||
wrack = new DamageSource("dragonwrack").setDamageBypassesArmor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getStatusIconIndex() {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(DarkPotions.icons);
|
||||
return super.getStatusIconIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performEffect(EntityLivingBase victim, int level)
|
||||
{
|
||||
if(!ItemDragonslayer.isDragon(victim) || victim.worldObj.isRemote)
|
||||
return;
|
||||
ItemDragonslayer.absoluteDamage(victim, wrack, Math.max(1F, victim.getMaxHealth() / 20F));
|
||||
if(victim instanceof EntityPlayer){
|
||||
EntityPlayer player = (EntityPlayer)victim;
|
||||
for(int x = 0;x < 5;x++){
|
||||
if(player.getEquipmentInSlot(x) != null){
|
||||
ItemStack equip = player.getEquipmentInSlot(x);
|
||||
if(equip.getItem() instanceof IEnergyContainerItem){
|
||||
IEnergyContainerItem battery = (IEnergyContainerItem)equip.getItem();
|
||||
battery.extractEnergy(equip, battery.getMaxEnergyStored(equip) / 50, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isReady(int tick, int level)
|
||||
{
|
||||
int k;
|
||||
|
||||
k = 40 >> level;
|
||||
return k <= 0 || tick % k == 0;
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,7 @@ item.SubCollar.name=Collar of Pain
|
||||
item.RingNutrition.name=Ring of Nutrition
|
||||
item.TaintFruit.name=Tainted Fruit
|
||||
item.TaintCoal.name=Hexcoal
|
||||
item.Sword_Dragonslayer.name=Sword of the Dragonslayer
|
||||
#
|
||||
# Wand components
|
||||
item.Wand.tainted.rod=Tainted
|
||||
@@ -119,6 +120,7 @@ enchantment.impact=Impact
|
||||
#
|
||||
# Potions
|
||||
potion.blood_seal=Blood Seal
|
||||
potion.dragonwrack=Dragonwrack
|
||||
#
|
||||
# Focus Upgrades
|
||||
forbidden.upgrade.hellfire.name=Hellfire
|
||||
@@ -142,6 +144,8 @@ itemGroup.forbidden=Forbidden Magic
|
||||
itemGroup.mobcrystal=Imprinting Crystals
|
||||
tc.research_category.FORBIDDEN=Apocrypha
|
||||
death.attack.blooderp=%1$s was bled dry
|
||||
death.attack.dragonslayer=%1$s was slain by %2$s
|
||||
death.attack.dragonwrack=%1$s succumbed to a mortal wound
|
||||
#
|
||||
# Research
|
||||
forbidden.research_name.NETHERSHARDS=Nether Shards
|
||||
@@ -367,6 +371,10 @@ forbidden.research_name.SUBCOLLAR=Collar of Pain
|
||||
forbidden.research_text.SUBCOLLAR=Pain and Magic
|
||||
forbidden.research_page.SUBCOLLAR.1=Sometimes, people just want to get hurt. Especially if there's a benefit...<BR><BR>The Collar of Pain has all the capabilities of an Amulet of Vis Storage with the added bonus that it will generate vis whenever you take damage. The more you get hurt, the more vis it generates.
|
||||
#
|
||||
forbidden.research_name.DRAGONSLAYER=Sword of the Dragonslayer
|
||||
forbidden.research_text.DRAGONSLAYER=JOOR-ZAH-FRUL
|
||||
forbidden.research_page.DRAGONSLAYER.1=Myths and legends abound of valiant heroes battling against great and terrifying beasts. Dragons are some of the most terrifying creatures, and the slaying of one is spoken of in legends for generations afterwards.<BR><BR>By infusing a sword with such mythical importance, you create a blade capable of felling such terrifying opponents. The Sword of the Dragonslayer exists to slay dragons, dealing them mortal wounds and deflecting their attacks with ease.<BR><BR>Not all dragons are born as dragons. Any human using the power of dragons will find themselves reminded of their mortality.
|
||||
#
|
||||
# Lexicon
|
||||
forbidden.lexicon.euclidaisy=Euclidaisy
|
||||
forbidden.lexicon.euclidaisy.0=The eerie, pink &1Euclidaisy&0 is an oddity. It uses large amounts of mana to conjure some sort of ethereal substance that only seems useful to thaumaturges.<br>&oIt doesn't combustion bend.&r
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 305 B |
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
Reference in new issue
Block a user