diff --git a/build.gradle b/build.gradle index 91e1e70..14d4285 100644 --- a/build.gradle +++ b/build.gradle @@ -38,14 +38,22 @@ if (new File(projectDir, '.git').exists()) { } repositories { - maven { + maven { //Tinker's and Mantle name 'DVS1 Maven FS' url 'http://dvs1.progwml6.com/files/maven' - } + } maven { // the repo from which to get NEI and stuff name 'CB Repo' url "http://chickenbones.net/maven/" } + maven { //WAILA + name "ProfMobius Maven FS" + url "http://mobiusstrip.eu/maven" + } + maven { + name "ForgeFS" + url 'http://files.minecraftforge.net/maven' + } } minecraft { @@ -54,16 +62,12 @@ minecraft { } dependencies { - compile files{ - 'Baubles-deobf.jar' - } - compile "codechicken:CodeChickenLib:1.7.10-1.1.1.99:dev" + compile "codechicken:CodeChickenLib:" + config.mc_version + "-" + config.ccLib_version + ":dev" compile "codechicken:CodeChickenCore:" + config.mc_version + "-" + config.ccc_version + ":dev" compile "codechicken:NotEnoughItems:" + config.mc_version + "-" + config.nei_version + ":dev" compile "codechicken:ForgeMultipart:" + config.mc_version + "-" + config.forgeMultipart_version + ":dev" - compile "mantle:Mantle:1.7.10-0.3.2.jenkins186:deobf" - compile ("tconstruct:TConstruct:1.7.10-1.7.1.build790:deobf") { - } + compile "mantle:Mantle:1.7.10-0.3.2.jenkins187:deobf" + compile "tconstruct:TConstruct:" + config.mc_version + "-" + config.tconstruct_version + ":deobf" } processResources diff --git a/build.properties b/build.properties index 9c8e8b5..6e1c7bc 100644 --- a/build.properties +++ b/build.properties @@ -1,11 +1,18 @@ mod_name=BloodArsenal + package_group=com.arc.bloodarsenal + mod_version=1.1.0 + mc_version=1.7.10 -ccc_version=1.0.4.29 -nei_version=1.0.3.64 -forgeMultipart_version=1.1.0.314 -forge_version=10.13.2.1236 + +ccLib_version=1.1.3.127 +ccc_version=1.0.4.35 +nei_version=1.0.4.90 +forgeMultipart_version=1.1.1.324 +tconstruct_version=1.8.3.build906 + +forge_version=10.13.2.1291 build_number=1 diff --git a/src/main/java/api/java/cofh/api/energy/IEnergyContainerItem.java b/src/main/java/api/java/cofh/api/energy/IEnergyContainerItem.java new file mode 100644 index 0000000..0f02dde --- /dev/null +++ b/src/main/java/api/java/cofh/api/energy/IEnergyContainerItem.java @@ -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. + * + * A reference implementation is provided {@link ItemEnergyContainer}. + * + * @author King Lemming + * + */ +public interface IEnergyContainerItem +{ + + /** + * Adds energy to an prefix. Returns the quantity of energy that was accepted. This should always return 0 if the prefix cannot be externally charged. + * + * @param container + * ItemStack to be charged. + * @param maxReceive + * Maximum amount of energy to be sent into the prefix. + * @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 prefix. + */ + int receiveEnergy (ItemStack container, int maxReceive, boolean simulate); + + /** + * Removes energy from an prefix. Returns the quantity of energy that was removed. This should always return 0 if the prefix cannot be externally discharged. + * + * @param container + * ItemStack to be discharged. + * @param maxExtract + * Maximum amount of energy to be extracted from the prefix. + * @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 prefix. + */ + int extractEnergy (ItemStack container, int maxExtract, boolean simulate); + + /** + * Get the amount of energy currently stored in the prefix. + */ + int getEnergyStored (ItemStack container); + + /** + * Get the max amount of energy that can be stored in the prefix. + */ + int getMaxEnergyStored (ItemStack container); + +} \ No newline at end of file diff --git a/src/main/java/api/java/cofh/core/item/IEqualityOverrideItem.java b/src/main/java/api/java/cofh/core/item/IEqualityOverrideItem.java new file mode 100644 index 0000000..c2dc3ac --- /dev/null +++ b/src/main/java/api/java/cofh/core/item/IEqualityOverrideItem.java @@ -0,0 +1,9 @@ +package cofh.core.item; + +import net.minecraft.item.ItemStack; + +public interface IEqualityOverrideItem { + + public boolean isLastHeldItemEqual(ItemStack current, ItemStack previous); + +} \ No newline at end of file diff --git a/src/main/java/api/java/mcp/mobius/waila/api/IWailaBlock.java b/src/main/java/api/java/mcp/mobius/waila/api/IWailaBlock.java new file mode 100644 index 0000000..8b4dd13 --- /dev/null +++ b/src/main/java/api/java/mcp/mobius/waila/api/IWailaBlock.java @@ -0,0 +1,34 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +@Deprecated +public interface IWailaBlock { + /* + * Use this method to return an item stack in case the default lookup system fails. + * Return null if you want to use the default lookup system. + * You get the world, the player and the location of the block. With that, it is easy to gather information & tile entities + */ + ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config); + + /* Waila HUD is divided into 3 zones. The head corresponds to the item name, + * body to where you mostly want to put informations, and I reserve the tail for modname display + */ + + /* Those 2 methods works exactly the same way, except they are related to a different zone in Waila HUD. + * You get in input world, player and the block location. You also get the itemstack as returned by the default lookup system or getWailaStack(). + * ConfigHandler provides the current Waila config state so you can show/hide elements depending on the configuration. Refer the ConfigHandler class for more info. + * currenttip represents the current list of text lines in the tooltip zone. + * For example, getWailaHead() will have the current item name as currenttip. + * You can modify the tips, add more, remove some, etc. + * When you are done, just returns the currenttip and it will display in Waila. + * + * Always return the currenttip is you don't want to modify the current zone. + */ + + List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/main/java/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java b/src/main/java/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java new file mode 100644 index 0000000..935d475 --- /dev/null +++ b/src/main/java/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java @@ -0,0 +1,9 @@ +package mcp.mobius.waila.api; + +import net.minecraft.item.ItemStack; + +public interface IWailaBlockDecorator { + + void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config); + +} diff --git a/src/main/java/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java b/src/main/java/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java new file mode 100644 index 0000000..faede63 --- /dev/null +++ b/src/main/java/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java @@ -0,0 +1,28 @@ +package mcp.mobius.waila.api; + +import java.util.HashMap; +import java.util.Set; + +public interface IWailaConfigHandler { + /* Returns a set of all the currently loaded modules in the config handler */ + public Set getModuleNames(); + + /* Returns all the currently available options for a given module */ + public HashMap getConfigKeys(String modName); + + /* Add a new option to a given module + * + * modName is the name of the module to add the option to (ie : Buildcraft, IndustrialCraft2, etc) + * key is the config key (ie : bc.tankcontent, ic2.inputvalue) + * name is the human readable name of the option (ie : "Tank content", "Max EU Input") + * */ + //public void addConfig(String modName, String key, String name); + + /* Returns the current value of an option (true/false) with a default value defvalue if not set*/ + public boolean getConfig(String key, boolean defvalue); + + /* Returns the current value of an option (true/false) with a default value true if not set*/ + public boolean getConfig(String key); + + //public void setConfig(String key, boolean value); +} diff --git a/src/main/java/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java b/src/main/java/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java new file mode 100644 index 0000000..0288624 --- /dev/null +++ b/src/main/java/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java @@ -0,0 +1,33 @@ +package mcp.mobius.waila.api; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +/* The Accessor is used to get some basic data out of the game without having to request + * direct access to the game engine. + * It will also return things that are unmodified by the overriding systems (like getWailaStack). + */ + +public interface IWailaDataAccessor { + + World getWorld(); + EntityPlayer getPlayer(); + Block getBlock(); + int getBlockID(); + int getMetadata(); + TileEntity getTileEntity(); + MovingObjectPosition getPosition(); + Vec3 getRenderingPosition(); + NBTTagCompound getNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); + ForgeDirection getSide(); + ItemStack getStack(); +} diff --git a/src/main/java/api/java/mcp/mobius/waila/api/IWailaDataProvider.java b/src/main/java/api/java/mcp/mobius/waila/api/IWailaDataProvider.java new file mode 100644 index 0000000..4859d9c --- /dev/null +++ b/src/main/java/api/java/mcp/mobius/waila/api/IWailaDataProvider.java @@ -0,0 +1,33 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +public interface IWailaDataProvider{ + /* + * Use this method to return an item stack in case the default lookup system fails. + * Return null if you want to use the default lookup system. + * You get the world, the player and the location of the block. With that, it is easy to gather information & tile entities + */ + ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config); + + /* Waila HUD is divided into 3 zones. The head corresponds to the item name, + * body to where you mostly want to put informations, and I reserve the tail for modname display + */ + + /* Those 2 methods works exactly the same way, except they are related to a different zone in Waila HUD. + * You get in input world, player and the block location. You also get the itemstack as returned by the default lookup system or getWailaStack(). + * ConfigHandler provides the current Waila config state so you can show/hide elements depending on the configuration. Refer the ConfigHandler class for more info. + * currenttip represents the current list of text lines in the tooltip zone. + * For example, getWailaHead() will have the current item name as currenttip. + * You can modify the tips, add more, remove some, etc. + * When you are done, just returns the currenttip and it will display in Waila. + * + * Always return the currenttip is you don't want to modify the current zone. + */ + + List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/main/java/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java b/src/main/java/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java new file mode 100644 index 0000000..788067a --- /dev/null +++ b/src/main/java/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java @@ -0,0 +1,24 @@ +package mcp.mobius.waila.api; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +/* The Accessor is used to get some basic data out of the game without having to request + * direct access to the game engine. + * It will also return things that are unmodified by the overriding systems (like getWailaStack). + */ + +public interface IWailaEntityAccessor { + World getWorld(); + EntityPlayer getPlayer(); + Entity getEntity(); + MovingObjectPosition getPosition(); + Vec3 getRenderingPosition(); + NBTTagCompound getNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); +} diff --git a/src/main/java/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java b/src/main/java/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java new file mode 100644 index 0000000..9548289 --- /dev/null +++ b/src/main/java/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java @@ -0,0 +1,16 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.entity.Entity; + +public interface IWailaEntityProvider { + + /* A way to get an override on the entity returned by the raytracing */ + Entity getWailaOverride(IWailaEntityAccessor accessor, IWailaConfigHandler config); + + /* The classical HEAD/BODY/TAIL text getters */ + List getWailaHead(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); + List getWailaBody(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); + List getWailaTail(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/main/java/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java b/src/main/java/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java new file mode 100644 index 0000000..19e01fa --- /dev/null +++ b/src/main/java/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java @@ -0,0 +1,27 @@ +package mcp.mobius.waila.api; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +/* The Accessor is used to get some basic data out of the game without having to request + * direct access to the game engine. + * It will also return things that are unmodified by the overriding systems (like getWailaStack). + */ + +public interface IWailaFMPAccessor { + World getWorld(); + EntityPlayer getPlayer(); + TileEntity getTileEntity(); + MovingObjectPosition getPosition(); + NBTTagCompound getNBTData(); + NBTTagCompound getFullNBTData(); + int getNBTInteger(NBTTagCompound tag, String keyname); + double getPartialFrame(); + Vec3 getRenderingPosition(); + String getID(); +} diff --git a/src/main/java/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java b/src/main/java/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java new file mode 100644 index 0000000..839af31 --- /dev/null +++ b/src/main/java/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java @@ -0,0 +1,7 @@ +package mcp.mobius.waila.api; + +import net.minecraft.item.ItemStack; + +public interface IWailaFMPDecorator { + void decorateBlock(ItemStack itemStack, IWailaFMPAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/main/java/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java b/src/main/java/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java new file mode 100644 index 0000000..232c83e --- /dev/null +++ b/src/main/java/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java @@ -0,0 +1,12 @@ +package mcp.mobius.waila.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +public interface IWailaFMPProvider { + /* The classical HEAD/BODY/TAIL text getters */ + List getWailaHead(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); + List getWailaBody(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); + List getWailaTail(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); +} diff --git a/src/main/java/api/java/mcp/mobius/waila/api/IWailaRegistrar.java b/src/main/java/api/java/mcp/mobius/waila/api/IWailaRegistrar.java new file mode 100644 index 0000000..162aeb6 --- /dev/null +++ b/src/main/java/api/java/mcp/mobius/waila/api/IWailaRegistrar.java @@ -0,0 +1,44 @@ +package mcp.mobius.waila.api; + +public interface IWailaRegistrar { + /* Add a config option in the section modname with displayed text configtext and access key keyname */ + public void addConfig(String modname, String keyname, String configtext); + public void addConfigRemote(String modname, String keyname, String configtext); + public void addConfig(String modname, String keyname); + public void addConfigRemote(String modname, String keyname); + + /* Register a stack overrider for the given blockID */ + public void registerStackProvider(IWailaDataProvider dataProvider, Class block); + + /* Same thing, but works on a class hierarchy instead */ + public void registerHeadProvider (IWailaDataProvider dataProvider, Class block); + public void registerBodyProvider (IWailaDataProvider dataProvider, Class block); + public void registerTailProvider (IWailaDataProvider dataProvider, Class block); + + /* Entity text registration methods */ + public void registerHeadProvider (IWailaEntityProvider dataProvider, Class entity); + public void registerBodyProvider (IWailaEntityProvider dataProvider, Class entity); + public void registerTailProvider (IWailaEntityProvider dataProvider, Class entity); + public void registerOverrideEntityProvider (IWailaEntityProvider dataProvider, Class entity); + + /* FMP Providers */ + public void registerHeadProvider(IWailaFMPProvider dataProvider, String name); + public void registerBodyProvider(IWailaFMPProvider dataProvider, String name); + public void registerTailProvider(IWailaFMPProvider dataProvider, String name); + + /* The block decorators */ + public void registerDecorator (IWailaBlockDecorator decorator, Class block); + public void registerDecorator (IWailaFMPDecorator decorator, String name); + + /* Selective NBT key syncing. Will register a key to sync over the network for the given class (block, te or ent). + * Accept * as a ending wildcard + * registerNBTKey("bob.*", MyBlock.class) + * registerNBTKey("data.life", MyEntity.class) + * registerNBTKey("*", MyTileEntity.class) will reproduce the full tag syncing from 1.4.5 + * */ + public void registerSyncedNBTKey(String key, Class target); + + /* UNUSED FOR NOW (Will be used for the ingame wiki */ + public void registerDocTextFile (String filename); + public void registerShortDataProvider (IWailaSummaryProvider dataProvider, Class item); +} diff --git a/src/main/java/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java b/src/main/java/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java new file mode 100644 index 0000000..f790649 --- /dev/null +++ b/src/main/java/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java @@ -0,0 +1,21 @@ +package mcp.mobius.waila.api; + +import java.util.LinkedHashMap; + +import net.minecraft.item.ItemStack; + +public interface IWailaSummaryProvider { + /* This interface is used to control the display data in the description screen */ + + /* BASIC TOOLS & ITEMS DATA */ + //EnumToolMaterial getMaterial(ItemStack stack); + //String getMaterialName(ItemStack stack); + //String getEffectiveBlock(ItemStack stack); + //int getHarvestLevel(ItemStack stack); + //float getEfficiencyOnProperMaterial(ItemStack stack); + //int getEnchantability(ItemStack stack); + //int getDamageVsEntity(ItemStack stack); + //int getDurability(ItemStack stack); + + LinkedHashMap getSummary(ItemStack stack, LinkedHashMap currentSummary, IWailaConfigHandler config); +} diff --git a/src/main/java/api/java/mcp/mobius/waila/api/SpecialChars.java b/src/main/java/api/java/mcp/mobius/waila/api/SpecialChars.java new file mode 100644 index 0000000..5bd92a8 --- /dev/null +++ b/src/main/java/api/java/mcp/mobius/waila/api/SpecialChars.java @@ -0,0 +1,40 @@ +package mcp.mobius.waila.api; + +public class SpecialChars { + + public static String MCStyle = "\u00A7"; + + public static String BLACK = MCStyle + "0"; + public static String DBLUE = MCStyle + "1"; + public static String DGREEN = MCStyle + "2"; + public static String DAQUA = MCStyle + "3"; + public static String DRED = MCStyle + "4"; + public static String DPURPLE = MCStyle + "5"; + public static String GOLD = MCStyle + "6"; + public static String GRAY = MCStyle + "7"; + public static String DGRAY = MCStyle + "8"; + public static String BLUE = MCStyle + "9"; + public static String GREEN = MCStyle + "a"; + public static String AQUA = MCStyle + "b"; + public static String RED = MCStyle + "c"; + public static String LPURPLE = MCStyle + "d"; + public static String YELLOW = MCStyle + "e"; + public static String WHITE = MCStyle + "f"; + + public static String OBF = MCStyle + "k"; + public static String BOLD = MCStyle + "l"; + public static String STRIKE = MCStyle + "m"; + public static String UNDER = MCStyle + "n"; + public static String ITALIC = MCStyle + "o"; + public static String RESET = MCStyle + "r"; + + public static String WailaStyle = "\u00A4"; + public static String WailaIcon = "\u00A5"; + public static String TAB = WailaStyle + WailaStyle +"a"; + public static String ALIGNRIGHT = WailaStyle + WailaStyle +"b"; + public static String ALIGNCENTER = WailaStyle + WailaStyle +"c"; + public static String HEART = WailaStyle + WailaIcon +"a"; + public static String HHEART = WailaStyle + WailaIcon +"b"; + public static String EHEART = WailaStyle + WailaIcon +"c"; + +} diff --git a/src/main/java/api/java/mcp/mobius/waila/api/package-info.java b/src/main/java/api/java/mcp/mobius/waila/api/package-info.java new file mode 100644 index 0000000..9b5e663 --- /dev/null +++ b/src/main/java/api/java/mcp/mobius/waila/api/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="1.0",owner="Waila",provides="WailaAPI") +package mcp.mobius.waila.api; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/api/java/morph/api/Ability.java b/src/main/java/api/java/morph/api/Ability.java new file mode 100644 index 0000000..36a75e9 --- /dev/null +++ b/src/main/java/api/java/morph/api/Ability.java @@ -0,0 +1,208 @@ +package morph.api; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * + * Abstract ability class. + * Think of it like the Entity class, extend it to make your own types. + * Some abilities may seem more like traits, but let's just call it an ability for simplicity's sake. + * Please take note that entities inherit their superclass' abilities. + * @author iChun + * + */ +public abstract class Ability +{ + /** + * Ability parent field. Will be null for instances used in registration. Ability is then cloned and parent assigned later on. + */ + private EntityLivingBase parent; + + /** + * Flag for Ability activity. If true, tick/postRender/kill will notbe called. + */ + public boolean inactive; + + /** + * Basic constructor (but you didn't really need me to tell you that ;D ) + */ + public Ability() + { + parent = null; + } + + /** + * Function for mod mob support, with args. + */ + public Ability parse(String[] args) { return this; } + + /** + * Since parent is private it needs a setter. + * @param newParent + */ + public void setParent(EntityLivingBase ent) + { + parent = ent; + } + + /** + * Get's the parent entity for this ability + * @return Entity the ability takes effect on + */ + public EntityLivingBase getParent() + { + return parent; + } + + /** + * Each ability has to return a String type. + * This is used for comparison, saving, as well as construction/loading of Ability. + * Think of it like the way Minecraft registers entities. + * @return Ability type + */ + public abstract String getType(); + + /** + * Ticks every world tick, basically an ability onUpdate, similar to Entity's onUpdate. + * Will only tick if getParent() is not null. + * Please remember that getParent is not necessarily a player. + */ + public abstract void tick(); + + /** + * Called when the ability is finally removed when the parent demorphs or morphs into a state that does not have this ability type. + * This will NOT be called if the parent morphs into another morph that has this type of ability. + */ + public abstract void kill(); + + /** + * Creates a copy of this ability for use with parents. + * As previously stated before the ability instance used during registration is a base so it needs to be cloned for use with parents. + */ + public abstract Ability clone(); + + /** + * Return true for this if you need an inactive copy of this morph in-between morph states (abilities of the next morph are only swapped over when morph is complete) + * Currently used for AbilitySwim to adjust the fog render. + * @return requiresInactiveClone + */ + public boolean requiresInactiveClone() + { + return false; + } + + /** + * Saving of ability to NBTTagCompound. + * Mainly used for synching Abilities between the client-server for mod mobs which do not use the API to add abilities. + * The ability type (getType()) is appended to nbt before function is called. + * Not actually used. + * @param NBTTagCompound saveData + */ + public abstract void save(NBTTagCompound tag); + + /** + * Loading of ability from NBTTagCompound. + * Mainly used to load custom fields from NBT. + * Not actually used. + * @param NBTTagCompound saveData + */ + public abstract void load(NBTTagCompound tag); + + /** + * Rendering to be done post-render. + * EG: Used by AbilitySwim to render air bubbles whilst on land. + */ + @SideOnly(Side.CLIENT) + public abstract void postRender(); + + /** + * Icon location for ability. Can be null. + * Mod's default icons are 32x32. Can be any resolution though. + * @return resourcelocation for icon + */ + @SideOnly(Side.CLIENT) + public abstract ResourceLocation getIcon(); + + @SideOnly(Side.CLIENT) + public boolean entityHasAbility(EntityLivingBase living) + { + return true; + } + + /** + * Registers the ability so the mod can look up the class when attempting to load Ability save data. + * Call this no later than PostInit. + * @param ability type + * @param AbilityClass + */ + public static void registerAbility(String name, Class clz) + { + try { + Class.forName("morph.common.ability.AbilityHandler").getDeclaredMethod("registerAbility", String.class, Class.class).invoke(null, name, clz); + } catch (Exception e) { + } + } + + /** + * Maps abilities to an Entity. + * Adds on to the previous ability list, so this allows you to add abilities to Entity classes which already have abilities mapped. + * However, only one ability of the same type is allowed for each entity. This method will overwrite abilities of the same type that were already mapped. + * This will also register new abilities which were not registered before (just in case). + * Call this no later than PostInit. + * @param entClass + * @param abilities + */ + public static void mapAbilities(Class entClass, Ability...abilities) + { + try { + Class.forName("morph.common.ability.AbilityHandler").getDeclaredMethod("mapAbilities", Class.class, Ability[].class).invoke(null, entClass, abilities); + } catch (Exception e) { + } + } + + /** + * Superman's kryptonite. + * @param Entity class to remove ability from + * @param Ability type + */ + public static void removeAbility(Class entClass, String type) + { + try { + Class.forName("morph.common.ability.AbilityHandler").getDeclaredMethod("removeAbility", Class.class, String.class).invoke(null, entClass, type); + } catch (Exception e) { + } + } + + /** + * Checks to see if the entity class has a mapped ability type. + * @param entClass + * @param Ability type + * @return Entity class has ability type + */ + public static boolean hasAbility(Class entClass, String type) + { + try { + return (Boolean)Class.forName("morph.common.ability.AbilityHandler").getDeclaredMethod("hasAbility", Class.class, String.class).invoke(null, entClass, type); + } catch (Exception e) { + return false; + } + } + + /** + * Creates an ability by type. + * Check out AbilityHandler to see each Ability type and the parse function in their respective classes for the arguments. + * @return + */ + public static Ability createNewAbilityByType(String type, String[] arguments) + { + try { + return (Ability)Class.forName("morph.common.ability.AbilityHandler").getDeclaredMethod("createNewAbilityByType", String.class, String[].class).invoke(null, type, arguments); + } catch (Exception e) { + return null; + } + } +} diff --git a/src/main/java/api/java/morph/api/Api.java b/src/main/java/api/java/morph/api/Api.java new file mode 100644 index 0000000..1cfb49d --- /dev/null +++ b/src/main/java/api/java/morph/api/Api.java @@ -0,0 +1,170 @@ +package morph.api; + +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.ResourceLocation; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public final class Api +{ + /** + * Returns if a player is has a morph. If morph progress < 1.0F, player is mid-morphing. + * Players demorphing are considered as a player with a morph until the demorph is complete. + * @param Player Username + * @param Clientside (false for Serverside) + */ + public static boolean hasMorph(String playerName, boolean isClient) + { + try { + return (Boolean)Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("hasMorph", String.class, boolean.class).invoke(null, playerName, isClient); + } catch (Exception e) { + return false; + } + } + + /** + * Returns morph progression of a player. Time per morph is 80 ticks. + * If player does not have a morph, 1.0F will be returned. + * @param Player Username + * @param Clientside (false for Serverside) + */ + public static float morphProgress(String playerName, boolean isClient) + { + try { + return (Float)Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("morphProgress", String.class, boolean.class).invoke(null, playerName, isClient); + } catch (Exception e) { + return 1.0F; + } + } + + /** + * Returns previous entity instance used to render the morph. + * If player does not have a previous morph state, null will be returned. + * @param Player Username + * @param Clientside (false for Serverside) + */ + public static EntityLivingBase getPrevMorphEntity(String playerName, boolean isClient) + { + try { + return (EntityLivingBase)Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("getPrevMorphEntity", String.class, boolean.class).invoke(null, playerName, isClient); + } catch (Exception e) { + return null; + } + } + + /** + * Returns entity instance used to render the morph. + * If player does not have a morph, null will be returned. + * @param Player Username + * @param Clientside (false for Serverside) + */ + public static EntityLivingBase getMorphEntity(String playerName, boolean isClient) + { + try { + return (EntityLivingBase)Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("getMorphEntity", String.class, boolean.class).invoke(null, playerName, isClient); + } catch (Exception e) { + return null; + } + } + + /** + * Blacklists an entity from being morphed into. + * Previously saved morphs of the classtype will not be removed. + * @param Class (extends EntityLivingBase) + */ + public static void blacklistEntity(Class clz) + { + try { + Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("blacklistEntity", Class.class).invoke(null, clz); + } catch (Exception e) { + } + } + + /** + * Forces a player to morph into an EntityLivingBase, also adds said entity to the morph list. + * Called Serverside only. + * @param player + * @param living + * @return morphSuccessful + */ + public static boolean forceMorph(EntityPlayerMP player, EntityLivingBase living) + { + try { + return (Boolean)Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("forceMorph", EntityPlayerMP.class, EntityLivingBase.class).invoke(null, player, living); + } catch (Exception e) { + return false; + } + } + + /** + * Forces a player to demorph. + * Called Serverside only. + * @param player + */ + public static void forceDemorph(EntityPlayerMP player) + { + try { + Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("forceDemorph", EntityPlayerMP.class).invoke(null, player); + } catch (Exception e) { + } + } + + /** + * Checks if the entity passed on is a Morph. + * If it is, the player name will be passed, else null. + * @param EntityLivingBase instance + * @param Clientside (false for Serverside) + */ + public static String isEntityAMorph(EntityLivingBase living, boolean isClient) + { + try { + return (String)Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("isEntityAMorph", EntityLivingBase.class, boolean.class).invoke(null, living, isClient); + } catch (Exception e) { + return null; + } + } + + /** + * Allows the rendering of the next player rendered. + * Prevents Morph from cancelling the player render event to render the morphed entity. + */ + public static void allowNextPlayerRender() + { + try { + Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("allowNextPlayerRender").invoke(null); + } catch (Exception e) { + } + } + + /** + * Returns the black grainy morph skin that overlays the player when the player is morphing + * @return Morph Skin Resource Location + */ + @SideOnly(Side.CLIENT) + public static ResourceLocation getMorphSkinTexture() + { + try { + return (ResourceLocation)Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("getMorphSkinTexture").invoke(null); + } catch (Exception e) { + return AbstractClientPlayer.locationStevePng; + } + } + + /** + * Assign a specific arm to a model for rendering in First Person. + * @param model Model which arm you are registering for + * @param arm The arm in a ModelRenderer form. + */ + @SideOnly(Side.CLIENT) + public static void registerArmForModel(ModelBase model, ModelRenderer arm) + { + try { + Class.forName("morph.common.core.ApiHandler").getDeclaredMethod("registerArmForModel", ModelBase.class, ModelRenderer.class).invoke(null, model, arm); + } catch (Exception e) { + } + } +} diff --git a/src/main/java/api/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java b/src/main/java/api/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java new file mode 100644 index 0000000..8eff88d --- /dev/null +++ b/src/main/java/api/java/powercrystals/minefactoryreloaded/api/FactoryRegistry.java @@ -0,0 +1,113 @@ +package powercrystals.minefactoryreloaded.api; + +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.event.FMLInterModComms; +import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; + +/** + * @author PowerCrystals + * + * Class used to register plants and other farming-related things with MFR. Will do nothing if MFR does not exist. + * + */ +public class FactoryRegistry +{ + /* + * This may be called at any time during pre-init, init or post-init, assuming all blocks and items + * that are being accessed from the registry have been appropriately registered. + * Possible messages: + * + * // Registration: + * addLaserPreferredOre | NBTTag with an ItemStack saved on it, with the color on the "value" attribute, + * | A ValuedItem with item and value set. + * registerAutoSpawnerBlacklist | The String identifier of an entity, + * | A subclass of EntityLivingBase. + * registerFertilizable | An instance of IFactoryFertilizable. + * registerFertilizer | An instance of IFactoryFertilizer. + * registerFruitLog | The String identifier of a block. + * registerGrindable | An instance of IFactoryGrindable. + * registerGrinderBlacklist | A subclass of EntityLivingBase. + * registerHarvestable | An instance of IFactoryHarvestable. + * registerLaserOre | NBTTag with an ItemStack saved on it, with the weight on the "value" attribute, + * | A ValuedItem with item and value set. + * registerLiquidDrinkHandler | A ValuedItem with key and object set; ILiquidDrinkHandler expected. + * registerMobEggHandler | An instance of IMobEggHandler. + * registerPickableFruit | An instance of IFactoryFruit. + * registerPlantable | An instance of IFactoryPlantable. + * registerRanchable | An instance of IFactoryRanchable. + * registerRedNetLogicCircuit | An instance of IRedNetLogicCircuit. + * registerRubberTreeBiome | The biomeName field of a biome to white list for rubber trees to spawn in. + * registerSafariNetBlacklist | A subclass of EntityLivingBase. + * registerSafariNetHandler | An instance of ISafariNetHandler. + * registerSludgeDrop | NBTTag with an ItemStack saved on it, with the weight on the "value" attribute, + * | A ValuedItem with item and value set. + * registerSpawnHandler | An instance of IMobSpawnHandler. + * registerVillagerTradeMob | An instance of IRandomMobProvider. + * + * // Simple implementations: + * { Harvestables + * registerHarvestable_Standard | The String identifier of a block. + * registerHarvestable_Log | The String identifier of a block. + * registerHarvestable_Leaves | The String identifier of a block. + * registerHarvestable_Vine | The String identifier of a block. + * registerHarvestable_Shrub | The String identifier of a block. + * registerHarvestable_Mushroom | The String identifier of a block. + * registerHarvestable_Crop | An ItemStack of a block, with a damage value indicating the meta value to harvest at. + * | A ValuedItem with value and object set; Block expected. + * registerHarvestable_Gourd | An NBTTag with the stem and fruit attributes, both String identifiers of blocks. + * } + * { Plantables + * registerPlantable_Standard | An NBTTag with the seed (Item, String identifier), and + * crop (Block, String identifier) attributes set, optionally + * also having the meta (Integer, placed metadata value) attribute set. + * No special checks for location, just sustainability. + * registerPlantable_Crop | An NBTTag with the seed (Item, String identifier), and + * crop (Block, String identifier) attributes set, optionally + * also having the meta (Integer, placed metadata value) attribute set. + * Will automatically hoe dirt and grass into farmland when planting. + * registerPlantable_Sapling | An NBTTag with the sapling (Block, String identifier), and optionally + * the seed (Item, String identifier) attributes set. + * } + * { Fertilizer + * registerFertilizer | An NBTTag with the fert (Item, String identifier), meta (Integer), and + * type (Integer, index into FertilizerType.values()) attributes set. + * } + * { Fertilizables + * registerFertilizable_Grass | The String identifier of a block. Will bonemeal the block and expect + * tall grass be planted above and around it, must be IGrowable. Works with + * the GrowPlant and Grass type fertilizers, not recommended for crop plants. + * registerFertilizable_Gourd | The String identifier of a block. Must be IGrowable, and expects identical + * behavior to vanilla stems. Works with the GrowPlant fertilizers. + * registerFertilizable_Crop | An NBTTag with the plant (Block, String identifier, IGrowable), and + * meta (Integer, max growth phase) attributes set, optionally also having + * the type (Integer, index into FertilizerType) attribute set. + * registerFertilizable_Cocoa | An NBTTag with the plant (Block, String identifier), and optionally also + * the type (Integer, index into FertilizerType) attributes set. + * Expects metadata of the block to exactly match cocoa pods. + * registerFertilizable_Standard | An NBTTag with the plant (Block, String identifier, IGrowable), and + * optionally also the type (Integer, index into FertilizerType) attributes set. + * Expects the block to change when successfully grown (e.g., saplings). + * } + */ + public static void sendMessage(String message, Object value) + { + if (!Loader.isModLoaded("MineFactoryReloaded") || + Loader.instance().activeModContainer() == null) + return; + try + { + Method m = FMLInterModComms.class.getDeclaredMethod("enqueueMessage", Object.class, String.class, IMCMessage.class); + m.setAccessible(true); + Constructor c = IMCMessage.class.getDeclaredConstructor(String.class, Object.class); + c.setAccessible(true); + m.invoke(null, Loader.instance().activeModContainer(), "MineFactoryReloaded", c.newInstance(message, value)); + } + catch(Exception e) + { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/api/java/powercrystals/minefactoryreloaded/api/HarvestType.java b/src/main/java/api/java/powercrystals/minefactoryreloaded/api/HarvestType.java new file mode 100644 index 0000000..a56208e --- /dev/null +++ b/src/main/java/api/java/powercrystals/minefactoryreloaded/api/HarvestType.java @@ -0,0 +1,44 @@ +package powercrystals.minefactoryreloaded.api; + +/** + * @author PowerCrystals + * + * Determines what algorithm the Harvester uses when it encounters this IFactoryHarvestable in the world. + */ +public enum HarvestType +{ + /** + * Just break the single block - no special action needed. e.g. Carrots, flowers, wheat. + */ + Normal, + /** + * Search for harvestable blocks adjacent to this block but leave this block. e.g. Pumpkin, melon + */ + Gourd, + /** + * Search for identical blocks above. + */ + Column, + /** + * Search for identical blocks above but leave the bottom one for the future. e.g. Cactus, sugarcane. + */ + LeaveBottom, + /** + * This block is the base of a tree and the harvester should enter tree-cutting mode. + */ + Tree, + /** + * This block is the base of the tree and the harvester should enter tree-cutting mode. + * The tree is searched for in the negative y axis instead. + */ + TreeFlipped, + /** + * This block is part of a tree as above. + */ + TreeLeaf, + /** + * This block is part of a tree as above, but fruits are cut before logs. e.g. cocoa + * The tree is not searched for. + */ + TreeFruit +} diff --git a/src/main/java/api/java/powercrystals/minefactoryreloaded/api/IFactoryGrindable.java b/src/main/java/api/java/powercrystals/minefactoryreloaded/api/IFactoryGrindable.java new file mode 100644 index 0000000..edfb8c9 --- /dev/null +++ b/src/main/java/api/java/powercrystals/minefactoryreloaded/api/IFactoryGrindable.java @@ -0,0 +1,35 @@ +package powercrystals.minefactoryreloaded.api; + +import java.util.List; +import java.util.Random; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.world.World; + +/** + * @author PowerCrystals + * + * Defines a grindable entity for the Grinder. + */ +public interface IFactoryGrindable +{ + /** + * @return The class that this grindable instance is handling. This must be a subtype of EntityLivingBase or the entity will never + * be noticed by the Grinder. + */ + public Class getGrindableEntity(); + + /** + * @param world The world this entity is in. + * @param entity The entity instance being ground. + * @param random A Random instance. + * @return The drops generated when this entity is killed. + */ + public List grind(World world, EntityLivingBase entity, Random random); + + /** + * @param entity The entity instance being ground. + * @return Whether this entity has been fully processed or not. + */ + public boolean processEntity(EntityLivingBase entity); +} diff --git a/src/main/java/api/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java b/src/main/java/api/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java new file mode 100644 index 0000000..d4e620a --- /dev/null +++ b/src/main/java/api/java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java @@ -0,0 +1,71 @@ +package powercrystals.minefactoryreloaded.api; + +import java.util.List; +import java.util.Map; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * @author PowerCrystals + * + * Defines a harvestable block for the Harvester. + */ +public interface IFactoryHarvestable +{ + /** + * @return The block this harvestable instance is managing. + */ + public Block getPlant(); + + /** + * @return The type of harvest the Harvester should perform on this block. + */ + public HarvestType getHarvestType(); + + /** + * @return Whether or not the Harvester should break the block when harvesting. If false, no changes will be performed by the Harvester itself. + */ + public boolean breakBlock(); + + /** + * @param world The world this block is in. + * @param harvesterSettings The harvester's current settings. Do not modify these. + * @param x The X coordinate of the block being harvested. + * @param y The Y coordinate of the block being harvested. + * @param z The Z coordinate of the block being harvested. + * @return True if this block can be harvested. + */ + public boolean canBeHarvested(World world, Map harvesterSettings, int x, int y, int z); + + /** + * @param world The world this block is in. + * @param rand A Random instance to use when generating drops. + * @param harvesterSettings The harvester's current settings. Do not modify these. + * @param x The X coordinate of the block being harvested. + * @param y The Y coordinate of the block being harvested. + * @param z The Z coordinate of the block being harvested. + * @return The drops generated by breaking this block. For a default implementation, calling Block.getBlockDropped() is usually sufficient. + */ + public List getDrops(World world, Random rand, Map harvesterSettings, int x, int y, int z); + + /** + * Called before the block is going to be harvested. Usually empty. + * @param world The world this block is in. + * @param x The X coordinate of the block being harvested. + * @param y The Y coordinate of the block being harvested. + * @param z The Z coordinate of the block being harvested. + */ + public void preHarvest(World world, int x, int y, int z); + + /** + * Called after the block is going to be harvested. Used to re-till soil, for example. + * @param world The world this block is in. + * @param x The X coordinate of the block being harvested. + * @param y The Y coordinate of the block being harvested. + * @param z The Z coordinate of the block being harvested. + */ + public void postHarvest(World world, int x, int y, int z); +} diff --git a/src/main/java/api/java/powercrystals/minefactoryreloaded/api/ILiquidDrinkHandler.java b/src/main/java/api/java/powercrystals/minefactoryreloaded/api/ILiquidDrinkHandler.java new file mode 100644 index 0000000..31eba00 --- /dev/null +++ b/src/main/java/api/java/powercrystals/minefactoryreloaded/api/ILiquidDrinkHandler.java @@ -0,0 +1,8 @@ +package powercrystals.minefactoryreloaded.api; + +import net.minecraft.entity.EntityLivingBase; + +public interface ILiquidDrinkHandler +{ + public void onDrink(EntityLivingBase player); +} diff --git a/src/main/java/api/java/powercrystals/minefactoryreloaded/api/MobDrop.java b/src/main/java/api/java/powercrystals/minefactoryreloaded/api/MobDrop.java new file mode 100644 index 0000000..7f5dd7c --- /dev/null +++ b/src/main/java/api/java/powercrystals/minefactoryreloaded/api/MobDrop.java @@ -0,0 +1,21 @@ +package powercrystals.minefactoryreloaded.api; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.WeightedRandom; + +public class MobDrop extends WeightedRandom.Item +{ + private ItemStack _stack; + + public MobDrop(int weight, ItemStack stack) + { + super(weight); + _stack = stack; + } + + public ItemStack getStack() + { + if(_stack == null) return null; + return _stack.copy(); + } +} diff --git a/src/main/java/api/java/powercrystals/minefactoryreloaded/api/ValuedItem.java b/src/main/java/api/java/powercrystals/minefactoryreloaded/api/ValuedItem.java new file mode 100644 index 0000000..3d075fa --- /dev/null +++ b/src/main/java/api/java/powercrystals/minefactoryreloaded/api/ValuedItem.java @@ -0,0 +1,72 @@ +package powercrystals.minefactoryreloaded.api; + +import net.minecraft.item.ItemStack; + +public class ValuedItem +{ + public final int value; + public final ItemStack item; + public final String key; + public final Object object; + + public ValuedItem(int v, ItemStack i) + { + value = v; + item = i; + key = null; + object = null; + } + + public ValuedItem(String v, Object i) + { + value = -1; + item = null; + key = v; + object = i; + } + + /** + * Presently unused but included so that if they do get used in the future, + * people including this in their jar and loading before MFR don't destroy everyone + */ + + public ValuedItem(int v, Object i) + { + value = v; + item = null; + key = null; + object = i; + } + + public ValuedItem(String v, ItemStack i) + { + value = -1; + item = i; + key = v; + object = null; + } + + public ValuedItem(int v, String k, ItemStack i) + { + value = v; + item = i; + key = k; + object = null; + } + + public ValuedItem(int v, String k, Object i) + { + value = v; + item = null; + key = k; + object = i; + } + + public ValuedItem(int v, String k, ItemStack i, Object o) + { + value = v; + item = i; + key = k; + object = o; + } +} diff --git a/src/main/java/api/java/thaumcraft/api/IGoggles.java b/src/main/java/api/java/thaumcraft/api/IGoggles.java new file mode 100644 index 0000000..2f53d81 --- /dev/null +++ b/src/main/java/api/java/thaumcraft/api/IGoggles.java @@ -0,0 +1,22 @@ +package thaumcraft.api; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; + +/** + * + * @author Azanor + * + * Equipped head slot items that extend this class will be able to perform most functions that + * goggles of revealing can apart from view nodes which is handled by IRevealer. + * + */ + +public interface IGoggles { + + /* + * If this method returns true things like block essentia contents will be shown. + */ + public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player); + +} diff --git a/src/main/java/api/java/thaumcraft/api/crafting/IInfusionStabiliser.java b/src/main/java/api/java/thaumcraft/api/crafting/IInfusionStabiliser.java new file mode 100644 index 0000000..d137ff2 --- /dev/null +++ b/src/main/java/api/java/thaumcraft/api/crafting/IInfusionStabiliser.java @@ -0,0 +1,19 @@ +package thaumcraft.api.crafting; + +import net.minecraft.world.World; + +/** + * + * @author Azanor + * + * Blocks that implement this interface act as infusion crafting stabilisers like candles and skulls + * + */ +public interface IInfusionStabiliser { + + /** + * returns true if the block can stabilise things + */ + public boolean canStabaliseInfusion(World world, int x, int y, int z); + +} diff --git a/src/main/java/com/arc/bloodarsenal/BloodArsenal.java b/src/main/java/com/arc/bloodarsenal/BloodArsenal.java index 0a660e0..1705e63 100644 --- a/src/main/java/com/arc/bloodarsenal/BloodArsenal.java +++ b/src/main/java/com/arc/bloodarsenal/BloodArsenal.java @@ -35,10 +35,10 @@ import java.io.File; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -@Mod(modid="BloodArsenal", version="1.1.3", name="Blood Arsenal", dependencies="required-after:AWWayofTime;after:NotEnoughItems;after:Baubles;after:TConstruct", guiFactory = "com.arc.bloodarsenal.gui.ConfigGuiFactory") +@Mod(modid = BloodArsenal.MODID, version = "1.1.4", name = "Blood Arsenal", dependencies = "required-after:AWWayofTime;after:NotEnoughItems;after:Baubles;after:TConstruct", guiFactory = "com.arc.bloodarsenal.gui.ConfigGuiFactory") public class BloodArsenal { - public static String MODID = "BloodArsenal"; + public final static String MODID = "BloodArsenal"; @SidedProxy(clientSide = "com.arc.bloodarsenal.ClientProxy", serverSide = "com.arc.bloodarsenal.CommonProxy") public static CommonProxy proxy; @@ -83,7 +83,7 @@ public class BloodArsenal ModItems.init(); ModItems.registerItems(); - Potion[] potionTypes = null; + Potion[] potionTypes; for (Field f : Potion.class.getDeclaredFields()) { @@ -159,7 +159,7 @@ public class BloodArsenal if (Loader.isModLoaded("TConstruct")) { isTinkersConstructLoaded = true; - logger.info("Loaded Tinker's Construct integration ほし!"); + logger.info("Loaded Tinker's Construct integration"); BloodArsenalTinkers.addMaterials(); BloodArsenalTinkers.addParts(); diff --git a/src/main/java/com/arc/bloodarsenal/BloodArsenalRecipes.java b/src/main/java/com/arc/bloodarsenal/BloodArsenalRecipes.java index d00baff..f50f41a 100644 --- a/src/main/java/com/arc/bloodarsenal/BloodArsenalRecipes.java +++ b/src/main/java/com/arc/bloodarsenal/BloodArsenalRecipes.java @@ -3,6 +3,8 @@ package com.arc.bloodarsenal; import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry; import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry; import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe; +import baubles.api.BaublesApi; +import baubles.common.Baubles; import com.arc.bloodarsenal.block.ModBlocks; import com.arc.bloodarsenal.items.ModItems; import cpw.mods.fml.common.Loader; @@ -11,8 +13,11 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.ShapedRecipes; import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; public class BloodArsenalRecipes { @@ -29,6 +34,7 @@ public class BloodArsenalRecipes AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blood_cookie), new ItemStack(Items.cookie), 1, 2000, 5, 5, false); AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blood_infused_glowstone_dust), new ItemStack(Items.glowstone_dust), 3, 2500, 5, 5, false); AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blood_ball), new ItemStack(Items.snowball), 2, 500, 5, 5, false); + AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blood_money), new ItemStack(Items.paper), 4, 10000, 5, 5, false); } public static void registerBindingRecipes() @@ -60,66 +66,88 @@ public class BloodArsenalRecipes ItemStack archmageOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.archmageBloodOrb, 1, craftingConstant); ItemStack transcendentOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.transcendentBloodOrb, 1, craftingConstant); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.blood_stained_ice, 8), "aaa", "aba", "aaa", 'a', Blocks.ice, 'b', apprenticeOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.blood_stained_glass, 8), "aaa", "aba", "aaa", 'a', Blocks.glass, 'b', apprenticeOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.blood_infused_axe_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_axe_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.blood_infused_pickaxe_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_pickaxe_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.blood_infused_shovel_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_shovel_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.blood_infused_sword_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_sword_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.blood_diamond), "aba", "bcb", "aba", 'a', Blocks.glass, 'b', Items.diamond, 'c', masterOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.blood_infused_diamond_unactive), "aba", "bcb", "ada", 'a', ModItems.amorphic_catalyst, 'b', ModBlocks.blood_infused_iron_block, 'c', ModItems.blood_diamond, 'd', masterOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.blood_infused_axe_diamond), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_diamond_bound, 'b', ModItems.blood_infused_axe_iron, 'c', ModItems.amorphic_catalyst, 'd', masterOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.blood_infused_pickaxe_diamond), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_diamond_bound, 'b', ModItems.blood_infused_pickaxe_iron, 'c', ModItems.amorphic_catalyst, 'd', masterOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.blood_infused_shovel_diamond), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_diamond_bound, 'b', ModItems.blood_infused_shovel_iron, 'c', ModItems.amorphic_catalyst, 'd', masterOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.blood_infused_sword_diamond), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_diamond_bound, 'b', ModItems.blood_infused_sword_iron, 'c', ModItems.amorphic_catalyst, 'd', masterOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.soul_booster), "aaa", "aba", "aca", 'a', ModItems.soul_fragment, 'b', Blocks.beacon, 'c', magicianOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.soul_nullifier), "aaa", "aba", "aca", 'a', ModItems.soul_fragment, 'b', WayofTime.alchemicalWizardry.ModItems.armourInhibitor, 'c', magicianOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.sigil_of_swimming), "aba", "cdc", "aea", 'a', Items.water_bucket, 'b', Items.bucket, 'c', Items.lava_bucket, 'd', WayofTime.alchemicalWizardry.ModItems.voidSigil, 'e', apprenticeOrb)); -// GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.self_sacrifice_amulet), "aaa", "aba", "caa", 'a', Items.string, 'b', weakOrb, 'c', WayofTime.alchemicalWizardry.ModBlocks.runeOfSelfSacrifice)); -// GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.sacrifice_amulet), "aaa", "aba", "caa", 'a', Items.string, 'b', weakOrb, 'c', WayofTime.alchemicalWizardry.ModBlocks.runeOfSacrifice)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.sigil_of_ender), "aba", "cdc", "efe", 'a', Blocks.obsidian, 'b', Items.ender_eye, 'c', Items.ender_pearl, 'd', imbuedSlate, 'e', Blocks.ender_chest, 'f', magicianOrb)); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.sigil_of_divinity), "aba", "cde", "fgf", 'a', ModBlocks.blood_infused_glowstone, 'b', new ItemStack(Items.golden_apple, 1, 1), 'c', Items.nether_star, 'd', WayofTime.alchemicalWizardry.ModItems.sigilOfElementalAffinity, 'e', ModItems.blood_infused_diamond_bound, 'f', ModItems.amorphic_catalyst, 'g', transcendentOrb)); + addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.blood_stained_ice, 8), "aaa", "aba", "aaa", 'a', Blocks.ice, 'b', apprenticeOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.blood_stained_glass, 8), "aaa", "aba", "aaa", 'a', Blocks.glass, 'b', apprenticeOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.life_infuser), "aba", "aca", "aea", 'a', ModItems.blood_infused_iron, 'b', masterOrb, 'c', WayofTime.alchemicalWizardry.ModBlocks.blockAltar, 'd', new ItemStack(ModItems.blood_infused_diamond_bound)); + addOreDictBloodOrbRecipe(new ItemStack(ModBlocks.lp_materializer), "aba", "bcb", "aba", 'a', ModItems.blood_infused_iron, 'b', imbuedSlate, 'c', masterOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_axe_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_axe_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_pickaxe_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_pickaxe_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_shovel_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_shovel_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_sword_iron), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_iron, 'b', ModItems.blood_infused_sword_wood, 'c', ModItems.amorphic_catalyst, 'd', magicianOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_diamond), "aba", "bcb", "aba", 'a', Blocks.glass, 'b', Items.diamond, 'c', masterOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_diamond_unactive), "aba", "bcb", "ada", 'a', ModItems.amorphic_catalyst, 'b', ModBlocks.blood_infused_iron_block, 'c', ModItems.blood_diamond, 'd', masterOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_axe_diamond), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_diamond_bound, 'b', ModItems.blood_infused_axe_iron, 'c', ModItems.amorphic_catalyst, 'd', masterOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_pickaxe_diamond), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_diamond_bound, 'b', ModItems.blood_infused_pickaxe_iron, 'c', ModItems.amorphic_catalyst, 'd', masterOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_shovel_diamond), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_diamond_bound, 'b', ModItems.blood_infused_shovel_iron, 'c', ModItems.amorphic_catalyst, 'd', masterOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_infused_sword_diamond), "aaa", "aba", "cdc", 'a', ModItems.blood_infused_diamond_bound, 'b', ModItems.blood_infused_sword_iron, 'c', ModItems.amorphic_catalyst, 'd', masterOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.soul_booster), "aaa", "aba", "aca", 'a', ModItems.soul_fragment, 'b', Blocks.beacon, 'c', magicianOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.soul_nullifier), "aaa", "aba", "aca", 'a', ModItems.soul_fragment, 'b', WayofTime.alchemicalWizardry.ModItems.armourInhibitor, 'c', magicianOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_swimming), "aba", "cdc", "aea", 'a', Items.water_bucket, 'b', Items.bucket, 'c', Items.lava_bucket, 'd', WayofTime.alchemicalWizardry.ModItems.voidSigil, 'e', apprenticeOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_ender), "aba", "cdc", "efe", 'a', Blocks.obsidian, 'b', Items.ender_eye, 'c', Items.ender_pearl, 'd', imbuedSlate, 'e', Blocks.ender_chest, 'f', magicianOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_divinity), "aba", "cde", "fgf", 'a', ModBlocks.blood_infused_glowstone, 'b', new ItemStack(Items.golden_apple, 1, 1), 'c', Items.nether_star, 'd', WayofTime.alchemicalWizardry.ModItems.sigilOfElementalAffinity, 'e', ModItems.blood_infused_diamond_bound, 'f', ModItems.amorphic_catalyst, 'g', transcendentOrb); + addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_burned_string, 4), "aaa", "aba", "aaa", 'a', Items.string, 'b', weakOrb); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_stone), "aaa", "aaa", "aaa", 'a', blankSlate); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_stone, 1, 1), "aaa", "aaa", "aaa", 'a', reinforcedSlate); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_stone, 1, 2), "aaa", "aaa", "aaa", 'a', imbuedSlate); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_stone, 1, 3), "aaa", "aaa", "aaa", 'a', demonicSlate); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_stone, 1, 4), "aaa", "aaa", "aaa", 'a', etherealSlate); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_infused_iron_block), "aaa", "aaa", "aaa", 'a', ModItems.blood_infused_iron); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_door_wood), "aa", "aa", "aa", 'a', ModBlocks.blood_infused_planks); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_stained_ice_packed), "aa", "aa", 'a', ModBlocks.blood_stained_ice); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_door_wood), "aa", "aa", "aa", 'a', ModBlocks.blood_infused_planks); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_door_iron), "aa", "aa", "aa", 'a', ModItems.blood_infused_iron); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_infused_glowstone), "aa", "aa", 'a', ModItems.blood_infused_glowstone_dust); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_lamp), "aba", "bcb", "aba", 'a', ModItems.blood_infused_iron, 'b', ModBlocks.blood_stained_glass, 'c', ModBlocks.blood_infused_glowstone); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_infused_diamond_block), "aaa", "aaa", "aaa", 'a', ModItems.blood_infused_diamond_bound); - GameRegistry.addRecipe(new ItemStack(ModItems.blood_infused_stick), "a", "a", 'a', ModBlocks.blood_infused_planks); - GameRegistry.addRecipe(new ItemStack(ModItems.blood_infused_pickaxe_wood), "aaa", " b ", " b ", 'a', ModBlocks.blood_infused_planks, 'b', ModItems.blood_infused_stick); - GameRegistry.addRecipe(new ItemStack(ModItems.blood_infused_axe_wood), "aa ", "ab ", " b ", 'a', ModBlocks.blood_infused_planks, 'b', ModItems.blood_infused_stick); - GameRegistry.addRecipe(new ItemStack(ModItems.blood_infused_shovel_wood), " a ", " b ", " b ", 'a', ModBlocks.blood_infused_planks, 'b', ModItems.blood_infused_stick); - GameRegistry.addRecipe(new ItemStack(ModItems.blood_infused_sword_wood), " a ", " a ", " b ", 'a', ModBlocks.blood_infused_planks, 'b', ModItems.blood_infused_stick); + addOreDictRecipe(new ItemStack(ModBlocks.blood_stone), "aaa", "aaa", "aaa", 'a', blankSlate); + addOreDictRecipe(new ItemStack(ModBlocks.blood_stone, 1, 1), "aaa", "aaa", "aaa", 'a', reinforcedSlate); + addOreDictRecipe(new ItemStack(ModBlocks.blood_stone, 1, 2), "aaa", "aaa", "aaa", 'a', imbuedSlate); + addOreDictRecipe(new ItemStack(ModBlocks.blood_stone, 1, 3), "aaa", "aaa", "aaa", 'a', demonicSlate); + addOreDictRecipe(new ItemStack(ModBlocks.blood_stone, 1, 4), "aaa", "aaa", "aaa", 'a', etherealSlate); + addOreDictRecipe(new ItemStack(ModBlocks.blood_infused_iron_block), "aaa", "aaa", "aaa", 'a', ModItems.blood_infused_iron); + addOreDictRecipe(new ItemStack(ModBlocks.blood_door_wood), "aa", "aa", "aa", 'a', ModBlocks.blood_infused_planks); + addOreDictRecipe(new ItemStack(ModBlocks.blood_stained_ice_packed), "aa", "aa", 'a', ModBlocks.blood_stained_ice); + addOreDictRecipe(new ItemStack(ModBlocks.blood_door_wood), "aa", "aa", "aa", 'a', ModBlocks.blood_infused_planks); + addOreDictRecipe(new ItemStack(ModBlocks.blood_door_iron), "aa", "aa", "aa", 'a', ModItems.blood_infused_iron); + addOreDictRecipe(new ItemStack(ModBlocks.blood_infused_glowstone), "aa", "aa", 'a', ModItems.blood_infused_glowstone_dust); + addOreDictRecipe(new ItemStack(ModBlocks.blood_lamp), "aba", "bcb", "aba", 'a', ModItems.blood_infused_iron, 'b', ModBlocks.blood_stained_glass, 'c', ModBlocks.blood_infused_glowstone); + addOreDictRecipe(new ItemStack(ModBlocks.blood_infused_diamond_block), "aaa", "aaa", "aaa", 'a', ModItems.blood_infused_diamond_bound); + addOreDictRecipe(new ItemStack(ModItems.blood_infused_stick), "a", "a", 'a', ModBlocks.blood_infused_planks); + addOreDictRecipe(new ItemStack(ModItems.blood_infused_pickaxe_wood), "aaa", " b ", " b ", 'a', ModBlocks.blood_infused_planks, 'b', ModItems.blood_infused_stick); + addOreDictRecipe(new ItemStack(ModItems.blood_infused_axe_wood), "aa ", "ab ", " b ", 'a', ModBlocks.blood_infused_planks, 'b', ModItems.blood_infused_stick); + addOreDictRecipe(new ItemStack(ModItems.blood_infused_shovel_wood), " a ", " b ", " b ", 'a', ModBlocks.blood_infused_planks, 'b', ModItems.blood_infused_stick); + addOreDictRecipe(new ItemStack(ModItems.blood_infused_sword_wood), " a ", " a ", " b ", 'a', ModBlocks.blood_infused_planks, 'b', ModItems.blood_infused_stick); + addOreDictRecipe(new ItemStack(ModItems.blood_money, 1, 1), "aa", "aa", 'a', new ItemStack(ModItems.blood_money)); + addOreDictRecipe(new ItemStack(ModItems.blood_money, 1, 2), "aa", "aa", 'a', new ItemStack(ModItems.blood_money, 1, 1)); + addOreDictRecipe(new ItemStack(ModItems.blood_money, 1, 3), "aa", "aa", 'a', new ItemStack(ModItems.blood_money, 1, 2)); - GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.blood_infused_planks, 4), ModBlocks.blood_infused_wood); - GameRegistry.addShapelessRecipe(new ItemStack(WayofTime.alchemicalWizardry.ModItems.blankSlate, 9), ModBlocks.blood_stone); - GameRegistry.addShapelessRecipe(new ItemStack(WayofTime.alchemicalWizardry.ModItems.reinforcedSlate, 9), new ItemStack(ModBlocks.blood_stone, 1, 1)); - GameRegistry.addShapelessRecipe(new ItemStack(WayofTime.alchemicalWizardry.ModItems.imbuedSlate, 9), new ItemStack(ModBlocks.blood_stone, 1, 2)); - GameRegistry.addShapelessRecipe(new ItemStack(WayofTime.alchemicalWizardry.ModItems.demonicSlate, 9), new ItemStack(ModBlocks.blood_stone, 1, 3)); + addShapelessOreDictRecipe(new ItemStack(ModBlocks.blood_infused_planks, 4), ModBlocks.blood_infused_wood); + addShapelessOreDictRecipe(new ItemStack(WayofTime.alchemicalWizardry.ModItems.blankSlate, 9), ModBlocks.blood_stone); + addShapelessOreDictRecipe(new ItemStack(WayofTime.alchemicalWizardry.ModItems.reinforcedSlate, 9), new ItemStack(ModBlocks.blood_stone, 1, 1)); + addShapelessOreDictRecipe(new ItemStack(WayofTime.alchemicalWizardry.ModItems.imbuedSlate, 9), new ItemStack(ModBlocks.blood_stone, 1, 2)); + addShapelessOreDictRecipe(new ItemStack(WayofTime.alchemicalWizardry.ModItems.demonicSlate, 9), new ItemStack(ModBlocks.blood_stone, 1, 3)); //This is a long one - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.amorphic_catalyst), WayofTime.alchemicalWizardry.ModItems.blankSlate, WayofTime.alchemicalWizardry.ModItems.aether, WayofTime.alchemicalWizardry.ModItems.terrae, WayofTime.alchemicalWizardry.ModItems.crystallos, WayofTime.alchemicalWizardry.ModItems.sanctus, WayofTime.alchemicalWizardry.ModItems.magicales, WayofTime.alchemicalWizardry.ModItems.crepitous, WayofTime.alchemicalWizardry.ModItems.incendium, WayofTime.alchemicalWizardry.ModItems.aquasalus); - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.blood_infused_iron, 9), ModBlocks.blood_infused_iron_block); - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.orange_juice), ModItems.blood_orange, Items.glass_bottle); - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.juice_and_cookies), Items.cookie, ModItems.orange_juice); + addShapelessOreDictRecipe(new ItemStack(ModItems.amorphic_catalyst), WayofTime.alchemicalWizardry.ModItems.blankSlate, WayofTime.alchemicalWizardry.ModItems.aether, WayofTime.alchemicalWizardry.ModItems.terrae, WayofTime.alchemicalWizardry.ModItems.crystallos, WayofTime.alchemicalWizardry.ModItems.sanctus, WayofTime.alchemicalWizardry.ModItems.magicales, WayofTime.alchemicalWizardry.ModItems.crepitous, WayofTime.alchemicalWizardry.ModItems.incendium, WayofTime.alchemicalWizardry.ModItems.aquasalus); + addShapelessOreDictRecipe(new ItemStack(ModItems.blood_infused_iron, 9), ModBlocks.blood_infused_iron_block); + addShapelessOreDictRecipe(new ItemStack(ModItems.orange_juice), ModItems.blood_orange, Items.glass_bottle); + addShapelessOreDictRecipe(new ItemStack(ModItems.juice_and_cookies), Items.cookie, ModItems.orange_juice); - if (Loader.isModLoaded("Baubles")) + if (BloodArsenal.isBaublesLoaded) { -// GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.vampire_ring),"ab ", "bcb", " b ", 'a', ModItems.blood_infused_diamond_bound, 'b', Blocks.stone, 'c', masterOrb)); +// addOreDictBloodOrbRecipe(new ItemStack(ModItems.vampire_ring), "ab ", "bcb", " b ", 'a', ModItems.blood_infused_diamond_bound, 'b', Blocks.stone, 'c', masterOrb); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.self_sacrifice_amulet), "aaa", "aba", "caa", 'a', ModItems.blood_burned_string, 'b', weakOrb, 'c', WayofTime.alchemicalWizardry.ModBlocks.runeOfSelfSacrifice)); +// GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.sacrifice_amulet), "aaa", "aba", "caa", 'a', ModItems.blood_burned_string, 'b', weakOrb, 'c', WayofTime.alchemicalWizardry.ModBlocks.runeOfSacrifice)); // GameRegistry.addRecipe(new ItemStack(ModItems.self_sacrifice_amulet), "a", 'a', new ItemStack(Items.slime_ball)); } { - ItemStack igniter = new ItemStack(ModItems.bound_igniter); +// ItemStack igniter = new ItemStack(ModItems.bound_igniter); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_torch), "a", "b", 'a', igniter, 'b', ModItems.blood_infused_stick); +// GameRegistry.addRecipe(new ItemStack(ModBlocks.blood_torch), "a", "b", 'a', igniter, 'b', ModItems.blood_infused_stick); +// GameRegistry.addRecipe(new ItemStack(ModItems.blood_burned_string, 4), "aaa", "aba", "aaa", 'a', Items.string, 'b', igniter); } } + + private static void addOreDictRecipe(ItemStack output, Object... recipe) + { + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(output, recipe)); + } + + private static void addOreDictBloodOrbRecipe(ItemStack output, Object... recipe) + { + CraftingManager.getInstance().getRecipeList().add(new ShapedBloodOrbRecipe(output, recipe)); + } + + private static void addShapelessOreDictRecipe(ItemStack output, Object... recipe) + { + CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(output, recipe)); + } } diff --git a/src/main/java/com/arc/bloodarsenal/ClientProxy.java b/src/main/java/com/arc/bloodarsenal/ClientProxy.java index 512117b..e7882dd 100644 --- a/src/main/java/com/arc/bloodarsenal/ClientProxy.java +++ b/src/main/java/com/arc/bloodarsenal/ClientProxy.java @@ -4,13 +4,11 @@ import WayofTime.alchemicalWizardry.client.ClientEventHandler; import com.arc.bloodarsenal.block.ModBlocks; import com.arc.bloodarsenal.entity.EntityBloodTNT; import com.arc.bloodarsenal.entity.projectile.EntityBloodBall; -import com.arc.bloodarsenal.entity.projectile.EntityEnderSigilPearl; import com.arc.bloodarsenal.entity.projectile.EntityGatlingProjectile; import com.arc.bloodarsenal.items.ModItems; import com.arc.bloodarsenal.renderer.block.TileLifeInfuserRenderer; import com.arc.bloodarsenal.renderer.block.item.TileLifeInfuserItemRenderer; import com.arc.bloodarsenal.renderer.item.ItemRenderGatling; -import com.arc.bloodarsenal.renderer.projectile.RenderEntityBloodBall; import com.arc.bloodarsenal.renderer.projectile.RenderEntityGatlingProjectile; import com.arc.bloodarsenal.renderer.block.TilePortableAltarRenderer; import com.arc.bloodarsenal.renderer.block.item.TilePortableAltarItemRenderer; @@ -22,7 +20,6 @@ import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.client.renderer.entity.RenderTNTPrimed; -import net.minecraft.init.Items; import net.minecraft.item.ItemBlock; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; @@ -37,7 +34,6 @@ public class ClientProxy extends CommonProxy RenderingRegistry.registerEntityRenderingHandler(EntityGatlingProjectile.class, new RenderEntityGatlingProjectile()); RenderingRegistry.registerEntityRenderingHandler(EntityBloodTNT.class, new RenderTNTPrimed()); RenderingRegistry.registerEntityRenderingHandler(EntityBloodBall.class, new RenderSnowball(ModItems.blood_ball)); - RenderingRegistry.registerEntityRenderingHandler(EntityEnderSigilPearl.class, new RenderSnowball(Items.ender_pearl)); ClientRegistry.bindTileEntitySpecialRenderer(TilePortableAltar.class, new TilePortableAltarRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileLifeInfuser.class, new TileLifeInfuserRenderer()); diff --git a/src/main/java/com/arc/bloodarsenal/block/BlockLPMaterializer.java b/src/main/java/com/arc/bloodarsenal/block/BlockLPMaterializer.java new file mode 100644 index 0000000..03559ad --- /dev/null +++ b/src/main/java/com/arc/bloodarsenal/block/BlockLPMaterializer.java @@ -0,0 +1,168 @@ +package com.arc.bloodarsenal.block; + +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; +import WayofTime.alchemicalWizardry.common.items.EnergyBattery; +import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding; +import com.arc.bloodarsenal.BloodArsenal; +import com.arc.bloodarsenal.tileentity.TileLPMaterializer; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidContainerRegistry; + +import java.util.Random; + +public class BlockLPMaterializer extends BlockContainer +{ + public BlockLPMaterializer() + { + super(Material.iron); + setBlockName("lp_materializer"); + setBlockTextureName("BloodArsenal:lp_materializer"); + setCreativeTab(BloodArsenal.BA_TAB); + setHardness(7.0F); + setResistance(14.0F); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) + { + TileLPMaterializer tileEntity = (TileLPMaterializer) world.getTileEntity(x, y, z); + + if (tileEntity == null) + { + return false; + } + + ItemStack playerItem = player.getCurrentEquippedItem(); + + if (playerItem != null)// <-- + { + if (playerItem.getItem().equals(ModItems.divinationSigil)) + { + if (player.worldObj.isRemote) + { + world.markBlockForUpdate(x, y, z); + } + else + { + tileEntity.sendChatInfoToPlayer(player); + } + + return true; + } + else if (playerItem.getItem().equals(ModItems.sigilOfHolding)) + { + ItemStack item = ((SigilOfHolding) playerItem.getItem()).getCurrentItem(playerItem); + + if (item != null && item.getItem().equals(ModItems.divinationSigil)) + { + if (player.worldObj.isRemote) + { + world.markBlockForUpdate(x, y, z); + } + else + { + tileEntity.sendChatInfoToPlayer(player); + } + + return true; + } + } +// else if (playerItem.getItem().equals(bucket)) + { +// if (!player.capabilities.isCreativeMode) + { +// --playerItem.stackSize; +// player.inventory.addItemStackToInventory(ModItems.bucketLife); +// tileEntity.drain(FluidContainerRegistry.BUCKET_VOLUME, true); + } + } + if (tileEntity.getStackInSlot(0) == null && playerItem.getItem() instanceof IBloodOrb) + { + ItemStack newItem = playerItem.copy(); + newItem.stackSize = 1; + --playerItem.stackSize; + tileEntity.setInventorySlotContents(0, newItem); + } + } + else if (player.isSneaking()) + { + if (tileEntity.getStackInSlot(0) != null) + { + ItemStack newItem = tileEntity.getStackInSlot(0).copy(); + newItem.stackSize = 1; + player.inventory.addItemStackToInventory(newItem); + tileEntity.setInventorySlotContents(0, null); + } + } + + return true; + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block par5, int par6) + { + dropItems(world, x, y, z); + super.breakBlock(world, x, y, z, par5, par6); + } + + private void dropItems(World world, int x, int y, int z) + { + Random rand = new Random(); + TileEntity tileEntity = world.getTileEntity(x, y, z); + + if (!(tileEntity instanceof IInventory)) + { + return; + } + + IInventory inventory = (IInventory) tileEntity; + + for (int i = 0; i < inventory.getSizeInventory(); i++) + { + ItemStack item = inventory.getStackInSlot(i); + + if (item != null && item.stackSize > 0) + { + float rx = rand.nextFloat() * 0.8F + 0.1F; + float ry = rand.nextFloat() * 0.8F + 0.1F; + float rz = rand.nextFloat() * 0.8F + 0.1F; + EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage())); + + if (item.hasTagCompound()) + { + entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy()); + } + + float factor = 0.05F; + entityItem.motionX = rand.nextGaussian() * factor; + entityItem.motionY = rand.nextGaussian() * factor + 0.2F; + entityItem.motionZ = rand.nextGaussian() * factor; + world.spawnEntityInWorld(entityItem); + item.stackSize = 0; + } + } + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) + { + return new TileLPMaterializer(); + } + + @Override + public boolean hasTileEntity() + { + return true; + } +} diff --git a/src/main/java/com/arc/bloodarsenal/block/BlockLifeInfuser.java b/src/main/java/com/arc/bloodarsenal/block/BlockLifeInfuser.java index 3854ffb..cbdf329 100644 --- a/src/main/java/com/arc/bloodarsenal/block/BlockLifeInfuser.java +++ b/src/main/java/com/arc/bloodarsenal/block/BlockLifeInfuser.java @@ -46,9 +46,9 @@ public class BlockLifeInfuser extends BlockContainer ItemStack playerItem = player.getCurrentEquippedItem(); ItemStack bucket = new ItemStack(Items.bucket); - if (tileEntity.getStackInSlot(0) == null && playerItem != null && !(playerItem.getItem() instanceof IBloodOrb)) + if (playerItem != null)// <-- { - if (playerItem.getItem().equals(ModItems.divinationSigil)) + if (playerItem.getItem().equals(ModItems.divinationSigil) || playerItem.getItem().equals(ModItems.itemSeerSigil)) { if (player.worldObj.isRemote) { @@ -80,12 +80,15 @@ public class BlockLifeInfuser extends BlockContainer } else if (playerItem.getItem().equals(ModItems.bucketLife)) { - --playerItem.stackSize; - player.inventory.addItemStackToInventory(bucket); + if (!player.capabilities.isCreativeMode) + { + --playerItem.stackSize; + player.inventory.addItemStackToInventory(bucket); + } tileEntity.fillMainTank(FluidContainerRegistry.BUCKET_VOLUME); } - else + else if (tileEntity.getStackInSlot(0) == null) { ItemStack newItem = playerItem.copy(); newItem.stackSize = 1; @@ -98,17 +101,6 @@ public class BlockLifeInfuser extends BlockContainer player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0)); tileEntity.setInventorySlotContents(0, null); } - - if (tileEntity.getStackInSlot(1) != null && playerItem != null) - { - if (playerItem.getItem() instanceof IBloodOrb) - { - ItemStack newItem = playerItem.copy(); - newItem.stackSize = 1; - --playerItem.stackSize; - tileEntity.setInventorySlotContents(1, newItem); - } - } world.markBlockForUpdate(x, y, z); return true; } @@ -158,6 +150,22 @@ public class BlockLifeInfuser extends BlockContainer } } + @Override + public void randomDisplayTick(World world, int x, int y, int z, Random rand) + { + TileLifeInfuser tileEntity = (TileLifeInfuser) world.getTileEntity(x, y, z); + + if (!tileEntity.isActive()) + { + return; + } + + if (rand.nextInt(3) != 0) + { + return; + } + } + @Override public TileEntity createNewTileEntity(World world, int meta) { diff --git a/src/main/java/com/arc/bloodarsenal/block/ModBlocks.java b/src/main/java/com/arc/bloodarsenal/block/ModBlocks.java index 3eacf5c..50e826e 100644 --- a/src/main/java/com/arc/bloodarsenal/block/ModBlocks.java +++ b/src/main/java/com/arc/bloodarsenal/block/ModBlocks.java @@ -1,10 +1,7 @@ package com.arc.bloodarsenal.block; import com.arc.bloodarsenal.items.block.BloodStoneBlock; -import com.arc.bloodarsenal.tileentity.TileCompacter; -import com.arc.bloodarsenal.tileentity.TileLifeInfuser; -import com.arc.bloodarsenal.tileentity.TileOwned; -import com.arc.bloodarsenal.tileentity.TilePortableAltar; +import com.arc.bloodarsenal.tileentity.*; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; @@ -28,6 +25,7 @@ public class ModBlocks public static BlockPortableAltar portable_altar; public static Block life_infuser; public static Block compacter; + public static Block lp_materializer; public static void init() { @@ -49,6 +47,7 @@ public class ModBlocks portable_altar = new BlockPortableAltar(); life_infuser = new BlockLifeInfuser(); compacter = new BlockCompacter(); + lp_materializer = new BlockLPMaterializer(); } public static void registerBlocksInPre() @@ -71,13 +70,15 @@ public class ModBlocks GameRegistry.registerBlock(portable_altar, "portable_altar"); GameRegistry.registerBlock(life_infuser, "life_infuser"); GameRegistry.registerBlock(compacter, "compacter"); + GameRegistry.registerBlock(lp_materializer, "lp_materializer"); } public static void registerTileEntities() { GameRegistry.registerTileEntity(TileOwned.class, "blood_infused_door"); - GameRegistry.registerTileEntity(TilePortableAltar.class, "container_portable_altar"); - GameRegistry.registerTileEntity(TileLifeInfuser.class, "container_life_infuser"); - GameRegistry.registerTileEntity(TileCompacter.class, "compacter_tile"); + GameRegistry.registerTileEntity(TilePortableAltar.class, "portable_altar"); + GameRegistry.registerTileEntity(TileLifeInfuser.class, "life_infuser"); + GameRegistry.registerTileEntity(TileCompacter.class, "compacter"); + GameRegistry.registerTileEntity(TileLPMaterializer.class, "lp_materializer"); } } diff --git a/src/main/java/com/arc/bloodarsenal/items/ItemBloodArsenal.java b/src/main/java/com/arc/bloodarsenal/items/ItemBloodArsenal.java index a7f10d3..8291c86 100644 --- a/src/main/java/com/arc/bloodarsenal/items/ItemBloodArsenal.java +++ b/src/main/java/com/arc/bloodarsenal/items/ItemBloodArsenal.java @@ -64,6 +64,8 @@ public class ItemBloodArsenal extends Item itemIcon = iconRegister.registerIcon("BloodArsenal:blood_infused_glowstone_dust"); else if (this.equals(ModItems.wolf_hide)) itemIcon = iconRegister.registerIcon("BloodArsenal:wolf_hide"); + else if (this.equals(ModItems.blood_burned_string)) + itemIcon = iconRegister.registerIcon("BloodArsenal:blood_burned_string"); } @Override diff --git a/src/main/java/com/arc/bloodarsenal/items/ItemBloodMoney.java b/src/main/java/com/arc/bloodarsenal/items/ItemBloodMoney.java index a6cc878..b30f0cf 100644 --- a/src/main/java/com/arc/bloodarsenal/items/ItemBloodMoney.java +++ b/src/main/java/com/arc/bloodarsenal/items/ItemBloodMoney.java @@ -1,11 +1,118 @@ package com.arc.bloodarsenal.items; +import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import com.arc.bloodarsenal.BloodArsenal; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +import java.util.List; public class ItemBloodMoney extends Item { + private static final int[] MONEY_MULTIPLIER = new int[]{1, 4, 16, 64}; + + @SideOnly(Side.CLIENT) + private IIcon[] icons; + public ItemBloodMoney() { super(); + setUnlocalizedName("blood_money"); + setCreativeTab(BloodArsenal.BA_TAB); + setHasSubtypes(true); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) + { + icons = new IIcon[MONEY_MULTIPLIER.length]; + + for (int i = 0; i < MONEY_MULTIPLIER.length; ++i) + { + icons[i] = iconRegister.registerIcon("BloodArsenal:" + "blood_money" + MONEY_MULTIPLIER[i]); + } + } + + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + String player = par3EntityPlayer.getCommandSenderName(); + World world = par3EntityPlayer.worldObj; + LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, player); + + if (data == null) + { + data = new LifeEssenceNetwork(player); + world.setItemData(player, data); + } + + if (world.isRemote) + { + return par1ItemStack; + } + + if (SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) + { + return par1ItemStack; + } + + int meta = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, MONEY_MULTIPLIER.length - 1); + + if (meta == 0) + { + SoulNetworkHandler.addCurrentEssenceToMaximum(player, 10000, Integer.MAX_VALUE); + } + else if (meta == 1) + { + SoulNetworkHandler.addCurrentEssenceToMaximum(player, 40000, Integer.MAX_VALUE); + } + else if (meta == 2) + { + SoulNetworkHandler.addCurrentEssenceToMaximum(player, 160000, Integer.MAX_VALUE); + } + else if (meta == 3) + { + SoulNetworkHandler.addCurrentEssenceToMaximum(player, 640000, Integer.MAX_VALUE); + } + + return par1ItemStack; + } + + @Override + public String getUnlocalizedName(ItemStack itemStack) + { + int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, MONEY_MULTIPLIER.length - 1); + + return ("" + "item.blood_money" + MONEY_MULTIPLIER[meta]); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) + { + int j = MathHelper.clamp_int(meta, 0, MONEY_MULTIPLIER.length - 1); + return icons[j]; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item id, CreativeTabs creativeTab, List list) + { + for (int meta = 0; meta < MONEY_MULTIPLIER.length; ++meta) + { + list.add(new ItemStack(id, 1, meta)); + } } } diff --git a/src/main/java/com/arc/bloodarsenal/items/ModItems.java b/src/main/java/com/arc/bloodarsenal/items/ModItems.java index 780da72..edeee84 100644 --- a/src/main/java/com/arc/bloodarsenal/items/ModItems.java +++ b/src/main/java/com/arc/bloodarsenal/items/ModItems.java @@ -63,6 +63,8 @@ public class ModItems public static Item sigil_of_divinity; public static Item blood_ball; public static Item wolf_hide; + public static Item blood_money; + public static Item blood_burned_string; public static void init() { @@ -110,6 +112,8 @@ public class ModItems sigil_of_divinity = new SigilDivinity(); blood_ball = new ItemBloodBall(); wolf_hide = new ItemBloodArsenal().setUnlocalizedName("wolf_hide"); + blood_money = new ItemBloodMoney(); + blood_burned_string = new ItemBloodArsenal().setUnlocalizedName("blood_burned_string"); } public static void registerItems() @@ -158,5 +162,7 @@ public class ModItems GameRegistry.registerItem(sigil_of_divinity, "sigil_of_divinity"); GameRegistry.registerItem(blood_ball, "blood_ball"); GameRegistry.registerItem(wolf_hide, "wolf_hide"); + GameRegistry.registerItem(blood_money, "blood_money"); + GameRegistry.registerItem(blood_burned_string, "blood_burned_string"); } } diff --git a/src/main/java/com/arc/bloodarsenal/items/bauble/ItemBauble.java b/src/main/java/com/arc/bloodarsenal/items/bauble/ItemBauble.java index 7b6a898..7ea2b53 100644 --- a/src/main/java/com/arc/bloodarsenal/items/bauble/ItemBauble.java +++ b/src/main/java/com/arc/bloodarsenal/items/bauble/ItemBauble.java @@ -18,6 +18,7 @@ public abstract class ItemBauble extends Item implements IBauble { super(); setMaxStackSize(1); + setMaxDamage(0); setCreativeTab(BloodArsenal.BA_TAB); } @@ -94,4 +95,22 @@ public abstract class ItemBauble extends Item implements IBauble public void onUnequipped(ItemStack stack, EntityLivingBase player) { } + + @Override + public boolean hasContainerItem(ItemStack stack) + { + return getContainerItem(stack) != null; + } + + @Override + public ItemStack getContainerItem(ItemStack itemStack) + { + return itemStack; + } + + @Override + public boolean doesContainerItemLeaveCraftingGrid(ItemStack p_77630_1_) + { + return false; + } } diff --git a/src/main/java/com/arc/bloodarsenal/items/bauble/SacrificeAmulet.java b/src/main/java/com/arc/bloodarsenal/items/bauble/SacrificeAmulet.java index 6c4856f..82c5525 100644 --- a/src/main/java/com/arc/bloodarsenal/items/bauble/SacrificeAmulet.java +++ b/src/main/java/com/arc/bloodarsenal/items/bauble/SacrificeAmulet.java @@ -3,6 +3,7 @@ package com.arc.bloodarsenal.items.bauble; import WayofTime.alchemicalWizardry.api.items.IAltarManipulator; import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; import baubles.api.BaubleType; +import baubles.api.IBauble; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; @@ -17,7 +18,7 @@ import net.minecraft.world.World; import java.util.List; -public class SacrificeAmulet extends ItemBauble implements IAltarManipulator +public class SacrificeAmulet extends ItemBauble implements IAltarManipulator, IBauble { public SacrificeAmulet() { diff --git a/src/main/java/com/arc/bloodarsenal/items/bauble/SelfSacrificeAmulet.java b/src/main/java/com/arc/bloodarsenal/items/bauble/SelfSacrificeAmulet.java index 93cb124..2de0fc5 100644 --- a/src/main/java/com/arc/bloodarsenal/items/bauble/SelfSacrificeAmulet.java +++ b/src/main/java/com/arc/bloodarsenal/items/bauble/SelfSacrificeAmulet.java @@ -3,6 +3,7 @@ package com.arc.bloodarsenal.items.bauble; import WayofTime.alchemicalWizardry.api.items.IAltarManipulator; import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; import baubles.api.BaubleType; +import baubles.api.IBauble; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; @@ -17,7 +18,7 @@ import net.minecraft.world.World; import java.util.List; -public class SelfSacrificeAmulet extends ItemBauble implements IAltarManipulator +public class SelfSacrificeAmulet extends ItemBauble implements IAltarManipulator, IBauble { public SelfSacrificeAmulet() { diff --git a/src/main/java/com/arc/bloodarsenal/items/bauble/VampireRing.java b/src/main/java/com/arc/bloodarsenal/items/bauble/VampireRing.java index 61a520f..0a263e5 100644 --- a/src/main/java/com/arc/bloodarsenal/items/bauble/VampireRing.java +++ b/src/main/java/com/arc/bloodarsenal/items/bauble/VampireRing.java @@ -1,20 +1,25 @@ package com.arc.bloodarsenal.items.bauble; import baubles.api.BaubleType; +import baubles.api.IBauble; import com.arc.bloodarsenal.BloodArsenal; import com.arc.bloodarsenal.BloodArsenalConfig; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; +import net.minecraft.util.IIcon; -public class VampireRing extends ItemBauble +public class VampireRing extends ItemBauble implements IBauble { public VampireRing() { super(); + setMaxStackSize(1); setUnlocalizedName("vampire_ring"); - setTextureName("BloodArsenal:vampire_ring"); } @Override @@ -43,6 +48,13 @@ public class VampireRing extends ItemBauble } } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) + { + this.itemIcon = iconRegister.registerIcon("BloodArsenal:vampire_ring"); + } + @Override public BaubleType getBaubleType(ItemStack par1ItemStack) { diff --git a/src/main/java/com/arc/bloodarsenal/items/sigil/EnderSigilUtils.java b/src/main/java/com/arc/bloodarsenal/items/sigil/EnderSigilUtils.java new file mode 100644 index 0000000..e3e9c3a --- /dev/null +++ b/src/main/java/com/arc/bloodarsenal/items/sigil/EnderSigilUtils.java @@ -0,0 +1,51 @@ +package com.arc.bloodarsenal.items.sigil; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class EnderSigilUtils +{ + public static MovingObjectPosition getTargetBlock(World world, double x, double y, double z, float yaw, float pitch, boolean par3, double range) + { + Vec3 var13 = Vec3.createVectorHelper(x, y, z); + float var14 = MathHelper.cos(-yaw * 0.01745329F - 3.141593F); + float var15 = MathHelper.sin(-yaw * 0.01745329F - 3.141593F); + float var16 = -MathHelper.cos(-pitch * 0.01745329F); + float var17 = MathHelper.sin(-pitch * 0.01745329F); + float var18 = var15 * var16; + float var20 = var14 * var16; + double var21 = range; + Vec3 var23 = var13.addVector(var18 * var21, var17 * var21, var20 * var21); + + return world.func_147447_a(var13, var23, par3, !par3, false); + } + + public static MovingObjectPosition getTargetBlock(World world, Entity entity, boolean par3) + { + float var4 = 1.0F; + float var5 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * var4; + + float var6 = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * var4; + + double var7 = entity.prevPosX + (entity.posX - entity.prevPosX) * var4; + + double var9 = entity.prevPosY + (entity.posY - entity.prevPosY) * var4 + 1.62D - entity.getYOffset();//field_70129_M + + double var11 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * var4; + + Vec3 var13 = Vec3.createVectorHelper(var7, var9, var11); + float var14 = MathHelper.cos(-var6 * 0.01745329F - 3.141593F); + float var15 = MathHelper.sin(-var6 * 0.01745329F - 3.141593F); + float var16 = -MathHelper.cos(-var5 * 0.01745329F); + float var17 = MathHelper.sin(-var5 * 0.01745329F); + float var18 = var15 * var16; + float var20 = var14 * var16; + double var21 = 10.0D; + Vec3 var23 = var13.addVector(var18 * var21, var17 * var21, var20 * var21); + + return world.func_147447_a(var13, var23, par3, !par3, false); + } +} diff --git a/src/main/java/com/arc/bloodarsenal/items/sigil/SigilEnder.java b/src/main/java/com/arc/bloodarsenal/items/sigil/SigilEnder.java index 6345634..23432c9 100644 --- a/src/main/java/com/arc/bloodarsenal/items/sigil/SigilEnder.java +++ b/src/main/java/com/arc/bloodarsenal/items/sigil/SigilEnder.java @@ -3,12 +3,10 @@ package com.arc.bloodarsenal.items.sigil; import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import com.arc.bloodarsenal.BloodArsenal; -import com.arc.bloodarsenal.entity.projectile.EntityEnderSigilPearl; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.item.EntityEnderPearl; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; import net.minecraft.world.World; @@ -38,33 +36,70 @@ public class SigilEnder extends EnergyItems implements IBindable } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { - EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); + EnergyItems.checkAndSetItemOwner(itemStack, player); - if (par1ItemStack.stackTagCompound == null) + if (itemStack.stackTagCompound == null) { - par1ItemStack.setTagCompound(new NBTTagCompound()); + itemStack.setTagCompound(new NBTTagCompound()); } - if (par3EntityPlayer.isSneaking() && !par3EntityPlayer.isSwingInProgress) + if (player.isSneaking() && !player.isSwingInProgress) { - par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + MovingObjectPosition mop = EnderSigilUtils.getTargetBlock(world, (player.prevPosX + (player.posX - player.prevPosX)), + (player.prevPosY + (player.posY - player.prevPosY) + 1.62 - player.yOffset), + (player.prevPosZ + (player.posZ - player.prevPosZ)), + (player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw)), + (player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch)), false, 128.0); - if (!par2World.isRemote) + if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && mop.sideHit != -1) { - par2World.spawnEntityInWorld(new EntityEnderSigilPearl(par2World, par3EntityPlayer)); - EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 300); + double ex = mop.hitVec.xCoord; + double wy = mop.hitVec.yCoord; + double zee = mop.hitVec.zCoord; + + switch (mop.sideHit) + { + case 0: + wy -= 2.0; + break; + case 1: + break; + case 2: + zee -= 0.5; + break; + case 3: + zee += 0.5; + break; + case 4: + ex -= 0.5; + break; + case 5: + ex += 0.5; + break; + } + + world.playSoundAtEntity(player, "mob.endermen.portal", 1F, 1F); + + for (int k = 0; k < 8; ++k) + { + world.spawnParticle("portal", player.posX + (world.rand.nextDouble() - 0.5D) * (double)player.width, player.posY + world.rand.nextDouble() * (double)player.height - 0.25D, player.posZ + (world.rand.nextDouble() - 0.5D) * (double)player.width, 0, 0, 0); + } + + player.setPositionAndUpdate(ex, wy, zee); + EnergyItems.syphonBatteries(itemStack, player, 2000); + + player.swingItem(); } - } - else if (!par3EntityPlayer.isSneaking()) + else if (!player.isSneaking()) { - par3EntityPlayer.displayGUIChest(par3EntityPlayer.getInventoryEnderChest()); - par2World.playSoundAtEntity(par3EntityPlayer, "mob.endermen.portal", 1F, 1F); - EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 200); + player.displayGUIChest(player.getInventoryEnderChest()); + world.playSoundAtEntity(player, "mob.endermen.portal", 1F, 1F); + EnergyItems.syphonBatteries(itemStack, player, 200); } - return par1ItemStack; + return itemStack; } } diff --git a/src/main/java/com/arc/bloodarsenal/items/tinkers/BloodArsenalTinkers.java b/src/main/java/com/arc/bloodarsenal/items/tinkers/BloodArsenalTinkers.java index bc64614..3d29004 100644 --- a/src/main/java/com/arc/bloodarsenal/items/tinkers/BloodArsenalTinkers.java +++ b/src/main/java/com/arc/bloodarsenal/items/tinkers/BloodArsenalTinkers.java @@ -11,6 +11,7 @@ public class BloodArsenalTinkers public static PartHelper AXE_HEAD; public static PartHelper BATTLE_SIGN_HEAD; public static PartHelper BINDING; + public static PartHelper BOLT; public static PartHelper BOW_LIMB; public static PartHelper CHISEL_HEAD; public static PartHelper CHUNK; @@ -39,17 +40,13 @@ public class BloodArsenalTinkers public static void addMaterials() { - if (BloodArsenal.isTinkersConstructLoaded) - { -// TConstructRegistry.addToolMaterial(250, "Blood Infused Iron", 3, 550, 1800, 3, 1.5F, 0, 0.0F, "", ""); - TConstructRegistry.addToolMaterial(250, "Blood Infused Iron", "blood_infused_iron", 3, 550, 1800, 3, 1.5F, 0, 0.0F, "Blood Infused Iron", 0xff0000); + TConstructRegistry.addToolMaterial(250, "Blood Infused Iron", "blood_infused_iron", 3, 550, 1800, 3, 1.5F, 0, 0.0F, "Blood Infused Iron", 0xab0000); - TConstructClientRegistry.addMaterialRenderMapping(250, "BloodArsenal", "blood_infused_iron", true); + TConstructClientRegistry.addMaterialRenderMapping(250, "BloodArsenal", "Blood Infused Iron", true); - TConstructRegistry.addBowMaterial(250, 40, 1.2F); + TConstructRegistry.addBowMaterial(250, 40, 1.2F); - TConstructRegistry.addArrowMaterial(250, 4.7F, 0.2F); - } + TConstructRegistry.addArrowMaterial(250, 4.7F, 0.2F); } public static void addParts() @@ -67,6 +64,7 @@ public class BloodArsenalTinkers AXE_HEAD = new PartHelper("axe.head", 0, ""); BATTLE_SIGN_HEAD = new PartHelper("battle.sign", 0, ""); BINDING = new PartHelper("binding", 0, ""); + BOLT = new PartHelper("bolt", 0, ""); BOW_LIMB = new PartHelper("bow.limb", 0, ""); CHISEL_HEAD = new PartHelper("chisel.head", 0, ""); CHUNK = new PartHelper("chunk", 0, ""); @@ -100,6 +98,7 @@ public class BloodArsenalTinkers AXE_HEAD.addMaterial(materialID, unlocalizedName, texture + "_axe_head"); BATTLE_SIGN_HEAD.addMaterial(materialID, unlocalizedName, texture + "_battlesign_head"); BINDING.addMaterial(materialID, unlocalizedName, texture + "_binding"); + BOLT.addMaterial(materialID, unlocalizedName, texture + "_bolt"); BOW_LIMB.addMaterial(materialID, unlocalizedName, texture + "_bow_limb"); CHISEL_HEAD.addMaterial(materialID, unlocalizedName, texture + "_chisel_head"); CHUNK.addMaterial(materialID, unlocalizedName, texture + "_chunk"); @@ -133,6 +132,7 @@ public class BloodArsenalTinkers GameRegistry.registerItem(AXE_HEAD, "axeHead"); GameRegistry.registerItem(BATTLE_SIGN_HEAD, "battleSign"); GameRegistry.registerItem(BINDING, "binding"); + GameRegistry.registerItem(BOLT, "bolt"); GameRegistry.registerItem(BOW_LIMB, "bowLimb"); GameRegistry.registerItem(CHISEL_HEAD, "chiselHead"); GameRegistry.registerItem(CHUNK, "chunk"); @@ -140,7 +140,7 @@ public class BloodArsenalTinkers GameRegistry.registerItem(CROSSBOW_BODY, "crossbowBody"); GameRegistry.registerItem(CROSSBOW_LIMB, "crossbowLimb"); GameRegistry.registerItem(EXCAVATOR_HEAD, "excavatorHead"); - GameRegistry.registerItem(FISHING_ROD, "fishingRod"); +// GameRegistry.registerItem(FISHING_ROD, "fishingRod"); GameRegistry.registerItem(FRYPAN_HEAD, "frypanHead"); GameRegistry.registerItem(FULL_GUARD, "fullGuard"); GameRegistry.registerItem(HAMMER_HEAD, "hammerHead"); diff --git a/src/main/java/com/arc/bloodarsenal/items/tinkers/PartHelper.java b/src/main/java/com/arc/bloodarsenal/items/tinkers/PartHelper.java index 3c4dba4..1733cdc 100644 --- a/src/main/java/com/arc/bloodarsenal/items/tinkers/PartHelper.java +++ b/src/main/java/com/arc/bloodarsenal/items/tinkers/PartHelper.java @@ -1,6 +1,7 @@ package com.arc.bloodarsenal.items.tinkers; import com.arc.bloodarsenal.BloodArsenal; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; @@ -24,7 +25,7 @@ public class PartHelper extends Item implements IToolPart protected HashMap unlocalizedMaterialNames = new HashMap(); protected HashMap textures = new HashMap(); protected HashMap icons = new HashMap(); - protected static final String texturePath = "BloodArsenal".toLowerCase(Locale.ENGLISH) + ":" + "tinkers/parts/"; + protected static final String texturePath = "BloodArsenal".toLowerCase() + ":" + "tinkers/parts/"; public PartHelper(String defaultUnlocalizedPartName, int defaultMaterialID, String defaultTexture) { @@ -39,10 +40,12 @@ public class PartHelper extends Item implements IToolPart this.defaultTexture = (texturePath + defaultTexture); } + @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister icon) { this.itemIcon = icon.registerIcon(this.defaultTexture); + for (Map.Entry texture : this.textures.entrySet()) { int materialID = texture.getKey().intValue(); @@ -50,35 +53,41 @@ public class PartHelper extends Item implements IToolPart IIcon _icon = icon.registerIcon(texturePath + textureName); - this.icons.put(Integer.valueOf(materialID), _icon); + this.icons.put(materialID, _icon); } } + @Override public int getMaterialID(ItemStack itemStack) { int damageValue = itemStack.getItemDamage(); + if (damageValue >= 100) { return itemStack.getItemDamage(); } + return this.defaultMaterialID; } public void addMaterial(int materialId, String unlocalizedName, String texture) { - this.unlocalizedMaterialNames.put(Integer.valueOf(materialId), unlocalizedName); - this.textures.put(Integer.valueOf(materialId), texture); + this.unlocalizedMaterialNames.put(materialId, unlocalizedName); + this.textures.put(materialId, texture); } + @Override public IIcon getIconFromDamage(int damageValue) { - if (this.icons.containsKey(Integer.valueOf(damageValue))) + if (this.icons.containsKey(damageValue)) { - return this.icons.get(Integer.valueOf(damageValue)); + return this.icons.get(damageValue); } + return this.itemIcon; } + @Override public void getSubItems(Item item, CreativeTabs tab, List itemStackList) { if (!this.unlocalizedMaterialNames.isEmpty()) @@ -95,25 +104,27 @@ public class PartHelper extends Item implements IToolPart } } + @Override public String getUnlocalizedName(ItemStack itemStack) { int damageValue = itemStack.getItemDamage(); - if (this.unlocalizedMaterialNames.containsKey(Integer.valueOf(damageValue))) + if (this.unlocalizedMaterialNames.containsKey(damageValue)) { - return "item." + this.unlocalizedMaterialNames.get(Integer.valueOf(damageValue)) + "." + this.unlocalizedPartName; + return "item." + this.unlocalizedMaterialNames.get(damageValue) + "." + this.unlocalizedPartName; } + return getUnlocalizedName(); } + @Override public String getItemStackDisplayName(ItemStack itemStack) { int damageValue = itemStack.getItemDamage(); String displayName; - - if (this.unlocalizedMaterialNames.containsKey(Integer.valueOf(damageValue))) +/* if (this.unlocalizedMaterialNames.containsKey(damageValue)) { - String unlocalizedMaterialName = this.unlocalizedMaterialNames.get(Integer.valueOf(damageValue)); + String unlocalizedMaterialName = this.unlocalizedMaterialNames.get(damageValue); if (StatCollector.canTranslate("part." + this.unlocalizedPartName) && StatCollector.canTranslate("material." + unlocalizedMaterialName)) { String localizedPartName = StatCollector.translateToLocal("part." + this.unlocalizedPartName); @@ -129,6 +140,12 @@ public class PartHelper extends Item implements IToolPart { displayName = getUnlocalizedName() + ".name"; } +*/ + String unlocalizedMaterialName = this.unlocalizedMaterialNames.get(damageValue); + String localizedMaterialName = StatCollector.translateToLocal("material." + unlocalizedMaterialName); + String partName = StatCollector.translateToLocal("part." + this.unlocalizedPartName); + displayName = partName.replaceAll("@material@", localizedMaterialName); + return displayName; } } diff --git a/src/main/java/com/arc/bloodarsenal/items/tinkers/RecipeHelper.java b/src/main/java/com/arc/bloodarsenal/items/tinkers/RecipeHelper.java index ab7de3e..4ecd9c2 100644 --- a/src/main/java/com/arc/bloodarsenal/items/tinkers/RecipeHelper.java +++ b/src/main/java/com/arc/bloodarsenal/items/tinkers/RecipeHelper.java @@ -2,6 +2,7 @@ package com.arc.bloodarsenal.items.tinkers; import com.arc.bloodarsenal.BloodArsenal; import com.arc.bloodarsenal.items.ModItems; +import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -11,6 +12,7 @@ import net.minecraftforge.oredict.OreDictionary; import tconstruct.library.TConstructRegistry; import tconstruct.library.crafting.PatternBuilder; import tconstruct.tools.TinkerTools; +import tconstruct.weaponry.TinkerWeaponry; import java.util.ArrayList; import java.util.List; @@ -18,6 +20,7 @@ import java.util.List; public class RecipeHelper { private static Item pattern = TConstructRegistry.getItem("woodPattern"); + private static Item weaponPattern = TinkerWeaponry.woodPattern; private static final ItemStack toolRodPattern = TConstructRegistry.getItemStack("toolRodPattern"); private static final ItemStack pickaxeHeadPattern = TConstructRegistry.getItemStack("pickaxeHeadPattern"); @@ -41,13 +44,16 @@ public class RecipeHelper private static final ItemStack largeBladePattern = TConstructRegistry.getItemStack("largeBladePattern"); private static final ItemStack hammerHeadPattern = TConstructRegistry.getItemStack("hammerHeadPattern"); private static final ItemStack fullGuardPattern = TConstructRegistry.getItemStack("fullGuardPattern"); - private static final ItemStack crossbowBodyPattern = TConstructRegistry.getItemStack("crossbowBodyPattern"); private static final ItemStack arrowHeadPattern = new ItemStack(pattern, 1, 25); + private static final ItemStack crossbowBodyPattern = new ItemStack(weaponPattern, 1, 2); + private static final ItemStack crossbowLimbPattern = new ItemStack(weaponPattern, 1, 1); + private static final ItemStack shurikenPattern = new ItemStack(weaponPattern); private static PartHelper _ARROWHEAD = BloodArsenalTinkers.ARROWHEAD; private static PartHelper _AXE_HEAD = BloodArsenalTinkers.AXE_HEAD; private static PartHelper _BATTLE_SIGN_HEAD = BloodArsenalTinkers.BATTLE_SIGN_HEAD; private static PartHelper _BINDING = BloodArsenalTinkers.BINDING; + private static PartHelper _BOLT = BloodArsenalTinkers.BOLT; private static PartHelper _BOW_LIMB = BloodArsenalTinkers.BOW_LIMB; private static PartHelper _CHISEL_HEAD = BloodArsenalTinkers.CHISEL_HEAD; private static PartHelper _CHUNK = BloodArsenalTinkers.CHUNK; @@ -85,25 +91,23 @@ public class RecipeHelper public static void addPartRecipes() { - if (BloodArsenal.isTinkersConstructLoaded) + Item bloodIron = GameRegistry.findItem("BloodArsenal", "blood_infused_iron"); + + if (bloodIron != null) { - Item bloodIron = GameRegistry.findItem("BloodArsenal", "blood_infused_iron"); + ItemStack _bloodIron = new ItemStack(bloodIron); - if (bloodIron != null) - { - ItemStack _bloodIron = new ItemStack(bloodIron); - - addPartBuilding(250); - unregisterMaterial(_bloodIron); -// registerWithStation(new ItemStack(ModItems.blood_infused_iron, 1), "Blood Infused Iron", 250, new ItemStack(_CHUNK, 1, 250)); - registerWithStation("Blood Infused Iron", "Blood Infused Iron", 250); - } + addPartBuilding(250); + unregisterMaterial(_bloodIron); + registerWithStation(new ItemStack(ModItems.blood_infused_iron, 1), "Blood Infused Iron", 250, new ItemStack(_CHUNK, 1, 250)); +// registerWithStation("Blood Infused Iron", "Blood Infused Iron", 250); } } private static void registerWithStation(String ingotName, String materialName, int materialID) { ArrayList ingots = OreDictionary.getOres(ingotName); + if (!ingots.isEmpty()) { for (ItemStack ingot : ingots) @@ -121,6 +125,7 @@ public class RecipeHelper private static void unregisterMaterial(ItemStack material) { List materials = PatternBuilder.instance.materials; + for (int i = 0; i < materials.size(); i++) { PatternBuilder.ItemKey itemKey = materials.get(i); @@ -136,6 +141,7 @@ public class RecipeHelper List list = CraftingManager.getInstance().getRecipeList(); ItemStack itemStack = null; + for (int i = 0; i < list.size(); i++) { IRecipe recipe = (IRecipe)list.get(i); @@ -187,31 +193,40 @@ public class RecipeHelper addItemStackPartBuilding(hammerHeadPattern, materialID, new ItemStack(_HAMMER_HEAD, 1, materialID)); addItemStackPartBuilding(fullGuardPattern, materialID, new ItemStack(_FULL_GUARD, 1, materialID)); addItemStackPartBuilding(arrowHeadPattern, materialID, new ItemStack(_ARROWHEAD, 1, materialID)); + addItemStackPartBuilding(crossbowBodyPattern, materialID, new ItemStack(_CROSSBOW_BODY, 1, materialID)); + addItemStackPartBuilding(crossbowLimbPattern, materialID, new ItemStack(_CROSSBOW_LIMB, 1, materialID)); + addItemStackPartBuilding(shurikenPattern, materialID, new ItemStack(_SHURIKEN, 1, materialID)); } public static void addToolRecipes() { - TConstructRegistry.addToolRecipe(TinkerTools.arrow, new Item[] { _ARROWHEAD, _TOOLROD, TinkerTools.fletching }); - TConstructRegistry.addToolRecipe(TinkerTools.battleaxe, new Item[] { _LUMBERAXE_HEAD, _TOUGHROD, _LUMBERAXE_HEAD, _TOUGHBIND }); - TConstructRegistry.addToolRecipe(TinkerTools.battlesign, new Item[] { _BATTLE_SIGN_HEAD, _TOOLROD }); - TConstructRegistry.addToolRecipe(TinkerTools.broadsword, new Item[] { _SWORD_BLADE, _TOOLROD, _LARGE_GUARD }); - TConstructRegistry.addToolRecipe(TinkerTools.chisel, new Item[] { _CHISEL_HEAD, _TOOLROD }); - TConstructRegistry.addToolRecipe(TinkerTools.cleaver, new Item[] { _LARGE_SWORD_BLADE, _TOUGHROD, _LARGEPLATE, _TOUGHROD }); - TConstructRegistry.addToolRecipe(TinkerTools.cutlass, new Item[] { _SWORD_BLADE, _TOOLROD, _FULL_GUARD }); - TConstructRegistry.addToolRecipe(TinkerTools.dagger, new Item[] { _KNIFE_BLADE, _TOOLROD, _CROSSBAR }); - TConstructRegistry.addToolRecipe(TinkerTools.excavator, new Item[] { _EXCAVATOR_HEAD, _TOUGHROD, _LARGEPLATE, _TOUGHBIND }); - TConstructRegistry.addToolRecipe(TinkerTools.frypan, new Item[] { _FRYPAN_HEAD, _TOOLROD }); - TConstructRegistry.addToolRecipe(TinkerTools.hammer, new Item[] { _HAMMER_HEAD, _TOUGHROD, _LARGEPLATE, _LARGEPLATE }); - TConstructRegistry.addToolRecipe(TinkerTools.hatchet, new Item[] { _AXE_HEAD, _TOOLROD }); - TConstructRegistry.addToolRecipe(TinkerTools.longsword, new Item[] { _SWORD_BLADE, _TOOLROD, _MEDIUM_GUARD }); - TConstructRegistry.addToolRecipe(TinkerTools.lumberaxe, new Item[] { _LUMBERAXE_HEAD, _TOUGHROD, _LARGEPLATE, _TOUGHBIND }); - TConstructRegistry.addToolRecipe(TinkerTools.mattock, new Item[] { _AXE_HEAD, _TOOLROD, _SHOVEL_HEAD }); - TConstructRegistry.addToolRecipe(TinkerTools.pickaxe, new Item[] { _PICKAXE_HEAD, _TOOLROD, _BINDING }); - TConstructRegistry.addToolRecipe(TinkerTools.rapier, new Item[] { _SWORD_BLADE, _TOOLROD, _CROSSBAR }); - TConstructRegistry.addToolRecipe(TinkerTools.scythe, new Item[] { _SCYTHE_HEAD, _TOUGHROD, _TOUGHBIND, _TOUGHROD }); - TConstructRegistry.addToolRecipe(TinkerTools.shortbow, new Item[] { _TOOLROD, TinkerTools.bowstring, _TOOLROD }); - TConstructRegistry.addToolRecipe(TinkerTools.shortbow, new Item[] { TinkerTools.toolRod, TinkerTools.bowstring, _TOOLROD }); - TConstructRegistry.addToolRecipe(TinkerTools.shortbow, new Item[] { _TOOLROD, TinkerTools.bowstring, TinkerTools.toolRod }); - TConstructRegistry.addToolRecipe(TinkerTools.shovel, new Item[] { _SHOVEL_HEAD, _TOOLROD }); + TConstructRegistry.addToolRecipe(TinkerTools.battleaxe, _LUMBERAXE_HEAD, _TOUGHROD, _LUMBERAXE_HEAD, _TOUGHBIND); + TConstructRegistry.addToolRecipe(TinkerTools.battlesign, _BATTLE_SIGN_HEAD, _TOOLROD); + TConstructRegistry.addToolRecipe(TinkerTools.broadsword, _SWORD_BLADE, _TOOLROD, _LARGE_GUARD); + TConstructRegistry.addToolRecipe(TinkerTools.chisel, _CHISEL_HEAD, _TOOLROD); + TConstructRegistry.addToolRecipe(TinkerTools.cleaver, _LARGE_SWORD_BLADE, _TOUGHROD, _LARGEPLATE, _TOUGHROD); + TConstructRegistry.addToolRecipe(TinkerTools.cutlass, _SWORD_BLADE, _TOOLROD, _FULL_GUARD); + TConstructRegistry.addToolRecipe(TinkerTools.dagger, _KNIFE_BLADE, _TOOLROD, _CROSSBAR); + TConstructRegistry.addToolRecipe(TinkerTools.excavator, _EXCAVATOR_HEAD, _TOUGHROD, _LARGEPLATE, _TOUGHBIND); + TConstructRegistry.addToolRecipe(TinkerTools.frypan, _FRYPAN_HEAD, _TOOLROD); + TConstructRegistry.addToolRecipe(TinkerTools.hammer, _HAMMER_HEAD, _TOUGHROD, _LARGEPLATE, _LARGEPLATE); + TConstructRegistry.addToolRecipe(TinkerTools.hatchet, _AXE_HEAD, _TOOLROD); + TConstructRegistry.addToolRecipe(TinkerTools.longsword, _SWORD_BLADE, _TOOLROD, _MEDIUM_GUARD); + TConstructRegistry.addToolRecipe(TinkerTools.lumberaxe, _LUMBERAXE_HEAD, _TOUGHROD, _LARGEPLATE, _TOUGHBIND); + TConstructRegistry.addToolRecipe(TinkerTools.mattock, _AXE_HEAD, _TOOLROD, _SHOVEL_HEAD); + TConstructRegistry.addToolRecipe(TinkerTools.pickaxe, _PICKAXE_HEAD, _TOOLROD, _BINDING); + TConstructRegistry.addToolRecipe(TinkerTools.rapier, _SWORD_BLADE, _TOOLROD, _CROSSBAR); + TConstructRegistry.addToolRecipe(TinkerTools.scythe, _SCYTHE_HEAD, _TOUGHROD, _TOUGHBIND, _TOUGHROD); + TConstructRegistry.addToolRecipe(TinkerTools.shovel, _SHOVEL_HEAD, _TOOLROD); + TConstructRegistry.addToolRecipe(TinkerWeaponry.arrowAmmo, _ARROWHEAD, _TOOLROD, TinkerWeaponry.fletching); + TConstructRegistry.addToolRecipe(TinkerWeaponry.boltAmmo, _BOLT, TinkerWeaponry.fletching); + TConstructRegistry.addToolRecipe(TinkerWeaponry.crossbow, _TOUGHBIND, _CROSSBOW_LIMB, _CROSSBOW_BODY, TinkerWeaponry.bowstring); + TConstructRegistry.addToolRecipe(TinkerWeaponry.javelin, _ARROWHEAD, _TOUGHROD, _TOUGHROD); + TConstructRegistry.addToolRecipe(TinkerWeaponry.longbow, _BOW_LIMB, _LARGEPLATE, _BOW_LIMB, TinkerWeaponry.bowstring); + TConstructRegistry.addToolRecipe(TinkerWeaponry.shortbow, _TOOLROD, TinkerWeaponry.bowstring, _TOOLROD); + TConstructRegistry.addToolRecipe(TinkerWeaponry.shortbow, TinkerTools.toolRod, TinkerWeaponry.bowstring, _TOOLROD); + TConstructRegistry.addToolRecipe(TinkerWeaponry.shortbow, _TOOLROD, TinkerWeaponry.bowstring, TinkerTools.toolRod); + TConstructRegistry.addToolRecipe(TinkerWeaponry.shuriken, _SHURIKEN, _SHURIKEN, _SHURIKEN, _SHURIKEN); + TConstructRegistry.addToolRecipe(TinkerWeaponry.throwingknife, _KNIFE_BLADE, _TOOLROD); } } diff --git a/src/main/java/com/arc/bloodarsenal/items/tool/BoundIgniter.java b/src/main/java/com/arc/bloodarsenal/items/tool/BoundIgniter.java index 58a3294..382886b 100644 --- a/src/main/java/com/arc/bloodarsenal/items/tool/BoundIgniter.java +++ b/src/main/java/com/arc/bloodarsenal/items/tool/BoundIgniter.java @@ -248,8 +248,8 @@ public class BoundIgniter extends Item implements IBindable @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { - itemIcon = iconRegister.registerIcon("BloodArsenal:bound_flint_and_steel"); - active = iconRegister.registerIcon("BloodArsenal:bound_flint_and_steel"); + itemIcon = iconRegister.registerIcon("BloodArsenal:bound_igniter"); + active = iconRegister.registerIcon("BloodArsenal:bound_igniter"); passive = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); } } diff --git a/src/main/java/com/arc/bloodarsenal/items/tool/InfusedDiamond.java b/src/main/java/com/arc/bloodarsenal/items/tool/InfusedDiamond.java index 66d08c5..8f6e0c6 100644 --- a/src/main/java/com/arc/bloodarsenal/items/tool/InfusedDiamond.java +++ b/src/main/java/com/arc/bloodarsenal/items/tool/InfusedDiamond.java @@ -60,8 +60,8 @@ public class InfusedDiamond extends Item { if (equals(ModItems.blood_infused_diamond_unactive)) { - par3List.add(StatCollector.translateToLocal("tooltip.tool.blood_diamond_inactive1")); - par3List.add(StatCollector.translateToLocal("tooltip.tool.blood_diamond_inactive2")); + par3List.add(StatCollector.translateToLocal("tooltip.tool.blood_diamond_unactive1")); + par3List.add(StatCollector.translateToLocal("tooltip.tool.blood_diamond_unactive2")); } if (equals(ModItems.blood_infused_diamond_active)) { diff --git a/src/main/java/com/arc/bloodarsenal/renderer/block/TileLifeInfuserRenderer.java b/src/main/java/com/arc/bloodarsenal/renderer/block/TileLifeInfuserRenderer.java index 5f63376..dd337ea 100644 --- a/src/main/java/com/arc/bloodarsenal/renderer/block/TileLifeInfuserRenderer.java +++ b/src/main/java/com/arc/bloodarsenal/renderer/block/TileLifeInfuserRenderer.java @@ -3,6 +3,7 @@ package com.arc.bloodarsenal.renderer.block; import com.arc.bloodarsenal.renderer.model.ModelLifeInfuser; import com.arc.bloodarsenal.tileentity.TileLifeInfuser; import cpw.mods.fml.client.FMLClientHandler; +import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; @@ -67,6 +68,7 @@ public class TileLifeInfuserRenderer extends TileEntitySpecialRenderer { GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.25F, (float) d2 + 0.5F); } + GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F); customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0); @@ -82,12 +84,28 @@ public class TileLifeInfuserRenderer extends TileEntitySpecialRenderer GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glPopMatrix(); GL11.glPopMatrix(); + + GL11.glPushMatrix(); + GL11.glTranslated(d0, d1, d2); + + GL11.glRotated(90F, 1F, 0F, 0F); + GL11.glTranslatef(-2F, -2F, -0.001F); + + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1F, 1F, 1F, 1F); + GL11.glDisable(GL11.GL_ALPHA_TEST); + + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_BLEND); + GL11.glColor4f(1F, 1F, 1F, 1F); + GL11.glPopMatrix(); } } private float getGhostItemScaleFactor(ItemStack itemStack) { - float scaleFactor = 1.0F; + float scaleFactor = 5F; if (itemStack != null) { @@ -193,7 +211,7 @@ public class TileLifeInfuserRenderer extends TileEntitySpecialRenderer return; } } - } + } else { switch (forgeDirection) diff --git a/src/main/java/com/arc/bloodarsenal/rituals/RitualEffectEnchant.java b/src/main/java/com/arc/bloodarsenal/rituals/RitualEffectEnchant.java new file mode 100644 index 0000000..f36896d --- /dev/null +++ b/src/main/java/com/arc/bloodarsenal/rituals/RitualEffectEnchant.java @@ -0,0 +1,470 @@ +package com.arc.bloodarsenal.rituals; + +import WayofTime.alchemicalWizardry.ModBlocks; +import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; +import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; +import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; +import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; +import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal; +import net.minecraft.block.Block; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.World; + +import java.util.ArrayList; +import java.util.List; + +public class RitualEffectEnchant extends RitualEffect +{ + private static int[][] PEDESTAL_LOCATIONS = new int[][] {{3, 1, 0}, {-3, 1, 0}, {0, 1, 3}, {0, 1, -3}}; + + public int stage = 0; + public int stageTicks = 0; + public int stage3EndTicks = 0; + + int lpRequired = -1; + + public ItemStack enchantItem = null; + public List enchants = new ArrayList(); +// public List itemList = new ArrayList(); + + @Override + public void performEffect(IMasterRitualStone ritualStone) + { + String owner = ritualStone.getOwner(); + World worldSave = MinecraftServer.getServer().worldServers[0]; + LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner); + + if (data == null) + { + data = new LifeEssenceNetwork(owner); + worldSave.setItemData(owner, data); + } + + int currentEssence = data.currentEssence; + World world = ritualStone.getWorld(); + int x = ritualStone.getXCoord(); + int y = ritualStone.getYCoord(); + int z = ritualStone.getZCoord(); + EntityPlayer player = world.getPlayerEntityByName(owner); + + if (currentEssence < getCostPerRefresh()) + { + SoulNetworkHandler.causeNauseaToPlayer(owner); + } + else + { + TileEntity topEntity = world.getTileEntity(x, y + 1, z); + + if (!(topEntity instanceof TEAltar)) + { + sendPlayerInformation(player, 1); + return; + } + + if (!canActivate(world, x, y, z)) + { + sendPlayerInformation(player, 2); + return; + } + + TEAltar tileAltar = (TEAltar) topEntity; + ItemStack targetStack = tileAltar.getStackInSlot(0); + + if (targetStack == null) + { +// sendPlayerInformation(player, 3); + return; + } + else + { + enchantItem = targetStack; + } + + if (stage == 0) + { + advanceStage(); + } + + switch (stage) + { + case 1: + { + if (stageTicks % 20 == 0) + { + ItemStack[] pedestalStack = getItemsInPedestals(world, x, y, z, true); + +// if (pedestalStack.length > 0) + { + int count = pedestalStack.length; + boolean addedEnchantment = false; + + if (count > 0 && !world.isRemote) + { + for (ItemStack itemStack : pedestalStack) + { + if (itemStack.getItem() == Items.enchanted_book) + { + NBTTagList enchants = Items.enchanted_book.func_92110_g(itemStack); + + if (enchants != null && enchants.tagCount() > 0) + { + NBTTagCompound enchant = enchants.getCompoundTagAt(0); + short id = enchant.getShort("id"); + short lvl = enchant.getShort("lvl"); + + if (!hasEnchantAlready(id) && isEnchantmentValid(id)) + { + this.enchants.add(new EnchantmentData(id, lvl)); + addedEnchantment = true; + break; + } + } + else + { + stage = 0; + break; + } + } +// else + { + stage = 0; + break; + } + } + } + + if (!addedEnchantment) + { + if (enchants.isEmpty()) + { + stage = 0; + } + else + { + advanceStage(); + world.markBlockForUpdate(x, y, z); + } + } + } + // else + { +// sendPlayerInformation(player, 4); + } + } + + break; + } + + case 2: + { + if (lpRequired == -1) + { + lpRequired = 0; + + for (EnchantmentData d : enchants) + { + Enchantment ench = Enchantment.enchantmentsList[d.enchant]; + lpRequired += (int) (5000F * ((15 - Math.min(15, ench.getWeight())) * 1.05F) * ((3F + d.level * d.level) * 0.25F) * (0.9F + enchants.size() * 0.05F)); + SoulNetworkHandler.syphonFromNetwork(owner, lpRequired); + } + } + else if (SoulNetworkHandler.getCurrentEssence(owner) >= lpRequired) + { + lpRequired = 0; + advanceStage(); + world.markBlockForUpdate(x, y, z); + } + + break; + } + + case 3: + { + if (stageTicks >= 100) + { + for (EnchantmentData d : enchants) + { + if (EnchantmentHelper.getEnchantmentLevel(d.enchant, enchantItem) == 0) + { + enchantItem.addEnchantment(Enchantment.enchantmentsList[d.enchant], d.level); + } + } + + enchants.clear(); + lpRequired = -1; + advanceStage(); + world.markBlockForUpdate(x, y, z); + } + + break; + } + + case 4: + { + if (stageTicks >= 20) + { + advanceStage(); + world.markBlockForUpdate(x, y, z); + ritualStone.setActive(false); + } + + break; + } + } + + if (stage != 0) + { + stageTicks++; + } + } + } + + public void advanceStage() + { + stage++; + + if (stage == 4) + { + stage3EndTicks = stageTicks; + } + else if (stage == 5) + { + stage = 0; + stage3EndTicks = 0; + } + + stageTicks = 0; + } + + @Override + public int getCostPerRefresh() + { + return 0; + } + + @Override + public List getRitualComponentList() + { + ArrayList enchantRitual = new ArrayList(); + enchantRitual.add(new RitualComponent(2, 0, 0, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(3, 0, 0, RitualComponent.DUSK)); + enchantRitual.add(new RitualComponent(3, 0, -1, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(3, 0, 1, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(4, 0, 0, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(-2, 0, 0, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(-3, 0, 0, RitualComponent.DUSK)); + enchantRitual.add(new RitualComponent(-3, 0, -1, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(-3, 0, 1, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(-4, 0, 0, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(0, 0, 2, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(0, 0, 3, RitualComponent.DUSK)); + enchantRitual.add(new RitualComponent(-1, 0, 3, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(1, 0, 3, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(0, 0, 4, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(0, 0, -2, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(0, 0, -3, RitualComponent.DUSK)); + enchantRitual.add(new RitualComponent(-1, 0, -3, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(1, 0, -3, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(0, 0, -4, RitualComponent.EARTH)); + enchantRitual.add(new RitualComponent(3, -1, 3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(3, -1, -3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(-3, -1, 3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(-3, -1, -3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(3, 0, 3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(3, 0, -3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(-3, 0, 3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(-3, 0, -3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(3, 1, 3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(3, 1, -3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(-3, 1, 3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(-3, 1, -3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(3, 2, 3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(3, 2, -3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(-3, 2, 3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(-3, 2, -3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(3, 3, 3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(3, 3, -3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(-3, 3, 3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(-3, 3, -3, RitualComponent.WATER)); + enchantRitual.add(new RitualComponent(3, 4, 3, RitualComponent.FIRE)); + enchantRitual.add(new RitualComponent(3, 4, -3, RitualComponent.FIRE)); + enchantRitual.add(new RitualComponent(-3, 4, 3, RitualComponent.FIRE)); + enchantRitual.add(new RitualComponent(-3, 4, -3, RitualComponent.FIRE)); + enchantRitual.add(new RitualComponent(3, 3, 2, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(3, 3, -2, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(-3, 3, 2, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(-3, 3, -2, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(2, 3, 3, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(2, 3, -3, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(-2, 3, 3, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(-2, 3, -3, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(3, 4, 1, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(3, 4, -1, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(-3, 4, 1, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(-3, 4, -1, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(1, 4, 3, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(1, 4, -3, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(-1, 4, 3, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(-1, 4, -3, RitualComponent.AIR)); + enchantRitual.add(new RitualComponent(2, 5, 2, RitualComponent.FIRE)); + enchantRitual.add(new RitualComponent(2, 5, -2, RitualComponent.FIRE)); + enchantRitual.add(new RitualComponent(-2, 5, 2, RitualComponent.FIRE)); + enchantRitual.add(new RitualComponent(-2, 5, -2, RitualComponent.FIRE)); + enchantRitual.add(new RitualComponent(1, 6, 1, RitualComponent.DUSK)); + enchantRitual.add(new RitualComponent(1, 6, -1, RitualComponent.DUSK)); + enchantRitual.add(new RitualComponent(-1, 6, 1, RitualComponent.DUSK)); + enchantRitual.add(new RitualComponent(-1, 6, -1, RitualComponent.DUSK)); + + return enchantRitual; + } + + public ItemStack[] getItemsInPedestals(World world, int x, int y, int z, boolean yes) + { + ItemStack[] items = new ItemStack[4]; +// itemList.clear(); + + if (yes) + { + int i = 0; + + for (int[] pedestals : PEDESTAL_LOCATIONS) + { + if (i < 4) + { + TileEntity tileEntity = world.getTileEntity(pedestals[0] + x, pedestals[1] + y, pedestals[2] + z); + + if (tileEntity instanceof TEPedestal) + { + items[i] = ((TEPedestal) tileEntity).getStackInSlot(0); +// itemList.add(items[i]); + i++; + } + } + } + } + else + { + int i = 0; + + for (int[] pedestals : PEDESTAL_LOCATIONS) + { + if (i < 4) + { + TileEntity tileEntity = world.getTileEntity(pedestals[0] + x, pedestals[1] + y, pedestals[2] + z); + + if (tileEntity instanceof TEPedestal) + { + items[i] = ((TEPedestal) tileEntity).getStackInSlot(0); +// itemList.add(items[i]); + i++; + } + } + } + } + + return items; + } + + private static boolean canActivate(World world, int x, int y, int z) + { + for (int[] pedestals : PEDESTAL_LOCATIONS) + { + if (world.getBlock(pedestals[0] + x, pedestals[1] + y, pedestals[2] + z) != ModBlocks.blockPedestal) + { + return false; + } + } + + return true; + } + + private boolean hasEnchantAlready(int enchant) + { + for (EnchantmentData data : enchants) + { + if (data.enchant == enchant) + { + return true; + } + } + + return false; + } + + public boolean isEnchantmentValid(short id) + { + Enchantment ench = Enchantment.enchantmentsList[id]; + + if (!ench.canApply(enchantItem) || !ench.type.canEnchantItem(enchantItem.getItem())) + { + return false; + } + + for (EnchantmentData data : enchants) + { + Enchantment otherEnch = Enchantment.enchantmentsList[data.enchant]; + + if (!otherEnch.canApplyTogether(ench) || !ench.canApplyTogether(otherEnch)) + { + return false; + } + } + + return true; + } + + private static void sendPlayerInformation(EntityPlayer player, int number) + { + switch (number) + { + case 1: + player.addChatComponentMessage(new ChatComponentText("There is no altar!")); + break; + case 2: + player.addChatComponentMessage(new ChatComponentText("There are no pedestals!")); + break; + case 3: + player.addChatComponentMessage(new ChatComponentText("There is no item to enchant!")); + break; + case 4: + player.addChatComponentMessage(new ChatComponentText("There are no enchantments to apply!")); + break; + } + } + + private static class EnchantmentData + { + public int enchant, level; + + public EnchantmentData(int enchant, int level) + { + this.enchant = enchant; + this.level = level; + } + } + + private static class PedestalLocations + { + public int xOffset; + public int yOffset; + public int zOffset; + + public PedestalLocations(int xOffset, int yOffset, int zOffset) + { + this.xOffset = xOffset; + this.yOffset = yOffset; + this.zOffset = zOffset; + } + } +} diff --git a/src/main/java/com/arc/bloodarsenal/rituals/RitualEffectMidas.java b/src/main/java/com/arc/bloodarsenal/rituals/RitualEffectMidas.java index 891df92..ea4b711 100644 --- a/src/main/java/com/arc/bloodarsenal/rituals/RitualEffectMidas.java +++ b/src/main/java/com/arc/bloodarsenal/rituals/RitualEffectMidas.java @@ -8,7 +8,9 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.item.EntityItem; +import net.minecraft.init.Blocks; import net.minecraft.init.Items; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.util.AxisAlignedBB; @@ -20,7 +22,7 @@ import java.util.List; public class RitualEffectMidas extends RitualEffect { - public static double rand; + private static double rand; @Override public void performEffect(IMasterRitualStone ritualStone) diff --git a/src/main/java/com/arc/bloodarsenal/rituals/RitualRegistry.java b/src/main/java/com/arc/bloodarsenal/rituals/RitualRegistry.java index 95591ee..6533b25 100644 --- a/src/main/java/com/arc/bloodarsenal/rituals/RitualRegistry.java +++ b/src/main/java/com/arc/bloodarsenal/rituals/RitualRegistry.java @@ -10,8 +10,13 @@ public class RitualRegistry { public static void initRituals() { - Rituals.registerRitual("ARC001Wither", 1, 75000, new RitualEffectWithering(), "Ritual of Withering", new AlchemyCircleRenderer(new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 1.5, false)); - Rituals.registerRitual("ARC002Midas", 1, 5000, new RitualEffectMidas(), "Midas Touch", new AlchemyCircleRenderer(new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 2.5, false)); + String resource = "alchemicalwizardry:textures/models/SimpleTransCircle.png"; + + Rituals.registerRitual("ARC001Wither", 1, 75000, new RitualEffectWithering(), "Ritual of Withering", new AlchemyCircleRenderer(new ResourceLocation(resource), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 1.5, false)); + Rituals.registerRitual("ARC002Midas", 1, 5000, new RitualEffectMidas(), "Midas Touch", new AlchemyCircleRenderer(new ResourceLocation(resource), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 2.5, false)); + Rituals.registerRitual("ARC003Enchant", 2, 50000, new RitualEffectEnchant(), "The Enchantress's Spell", new AlchemyCircleRenderer(new ResourceLocation(resource), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 1.5, false)); + + blacklistRituals(); } public static void blacklistRituals() diff --git a/src/main/java/com/arc/bloodarsenal/tileentity/FluidTankRestricted.java b/src/main/java/com/arc/bloodarsenal/tileentity/FluidTankRestricted.java new file mode 100644 index 0000000..b66786e --- /dev/null +++ b/src/main/java/com/arc/bloodarsenal/tileentity/FluidTankRestricted.java @@ -0,0 +1,33 @@ +package com.arc.bloodarsenal.tileentity; + +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTank; + +public class FluidTankRestricted extends FluidTank +{ + String[] name; + + public FluidTankRestricted(int capacity, String... name) + { + super(capacity); + this.name = name; + } + + public int fill(FluidStack resource, boolean doFill) + { + if (this.fluid == null) + { + String str = FluidRegistry.getFluidName(resource); + for (String aName : this.name) + { + if (aName.equals(str)) + { + return super.fill(resource, doFill); + } + } + return 0; + } + return super.fill(resource, doFill); + } +} diff --git a/src/main/java/com/arc/bloodarsenal/tileentity/PacketHandler.java b/src/main/java/com/arc/bloodarsenal/tileentity/PacketHandler.java index ccb1f2a..f294d02 100644 --- a/src/main/java/com/arc/bloodarsenal/tileentity/PacketHandler.java +++ b/src/main/java/com/arc/bloodarsenal/tileentity/PacketHandler.java @@ -9,6 +9,7 @@ import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import net.minecraft.entity.player.EntityPlayerMP; @@ -24,15 +25,18 @@ public enum PacketHandler private EnumMap channels; - private PacketHandler() + PacketHandler() { - // request a channel pair for IronChest from the network registry - // Add the IronChestCodec as a member of both channel pipelines - this.channels = NetworkRegistry.INSTANCE.newChannel("BloodArsenal", new TilePortableAltarCodec()); + this.channels = NetworkRegistry.INSTANCE.newChannel("BloodArsenal", new BATileCodec()); if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { addClientHandler(); } + if (FMLCommonHandler.instance().getSide() == Side.SERVER) + { + System.out.println("Server sided~"); + addServerHandler(); + } } @SideOnly(Side.CLIENT) @@ -40,9 +44,19 @@ public enum PacketHandler { FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT); - String tileCodec = clientChannel.findChannelHandlerNameForType(TilePortableAltarCodec.class); + String tileCodec = clientChannel.findChannelHandlerNameForType(BATileCodec.class); clientChannel.pipeline().addAfter(tileCodec, "TilePortableAltarHandler", new TilePortableAltarMessageHandler()); clientChannel.pipeline().addAfter(tileCodec, "TileLifeInfuserHandler", new TileLifeInfuserMessageHandler()); + clientChannel.pipeline().addAfter(tileCodec, "TileLPMaterializer", new TileLPMaterializerMessageHandler()); + } + + @SideOnly(Side.SERVER) + private void addServerHandler() + { + FMLEmbeddedChannel serverChannel = this.channels.get(Side.SERVER); + + String messageCodec = serverChannel.findChannelHandlerNameForType(BATileCodec.class); + serverChannel.pipeline().addAfter(messageCodec, "KeyboardMessageHandler", new KeyboardMessageHandler()); } private static class TilePortableAltarMessageHandler extends SimpleChannelInboundHandler @@ -52,6 +66,7 @@ public enum PacketHandler { World world = BloodArsenal.proxy.getClientWorld(); TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); + if (te instanceof TilePortableAltar) { TilePortableAltar altar = (TilePortableAltar) te; @@ -68,6 +83,7 @@ public enum PacketHandler { World world = BloodArsenal.proxy.getClientWorld(); TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); + if (te instanceof TileLifeInfuser) { TileLifeInfuser tile = (TileLifeInfuser) te; @@ -77,6 +93,38 @@ public enum PacketHandler } } + private static class TileLPMaterializerMessageHandler extends SimpleChannelInboundHandler + { + @Override + protected void channelRead0(ChannelHandlerContext ctx, TileLPMaterializerMessage msg) throws Exception + { + World world = BloodArsenal.proxy.getClientWorld(); + TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); + + if (te instanceof TileLPMaterializer) + { + TileLPMaterializer tile = (TileLPMaterializer) te; + + tile.handlePacketData(msg.items, msg.fluids, msg.capacity); + } + } + } + + private static class KeyboardMessageHandler extends SimpleChannelInboundHandler + { + public KeyboardMessageHandler() + { + System.out.println("I am being created"); + } + + @Override + protected void channelRead0(ChannelHandlerContext ctx, KeyboardMessage msg) throws Exception + { + System.out.println("Hmmm"); + + } + } + public static class BAMessage { int index; @@ -104,12 +152,50 @@ public enum PacketHandler int capacity; } - private class TilePortableAltarCodec extends FMLIndexedMessageToMessageCodec + public static class TileLPMaterializerMessage extends BAMessage { - public TilePortableAltarCodec() + int x; + int y; + int z; + + int[] items; + int[] fluids; + int capacity; + } + + public static class KeyboardMessage extends BAMessage + { + byte keyPressed; + } + + private class ClientToServerCodec extends FMLIndexedMessageToMessageCodec + { + public ClientToServerCodec() + { + } + + @Override + public void encodeInto(ChannelHandlerContext ctx, BAMessage msg, ByteBuf target) throws Exception + { + target.writeInt(msg.index); + } + + @Override + public void decodeInto(ChannelHandlerContext ctx, ByteBuf source, BAMessage msg) + { +// int index = source.readInt(); + + System.out.println("Packet is recieved and being decoded"); + } + } + + private class BATileCodec extends FMLIndexedMessageToMessageCodec + { + public BATileCodec() { addDiscriminator(0, TilePortableAltarMessage.class); addDiscriminator(1, TileLifeInfuserMessage.class); + addDiscriminator(2, TileLPMaterializerMessage.class); } @Override @@ -125,9 +211,11 @@ public enum PacketHandler target.writeInt(((TilePortableAltarMessage) msg).z); target.writeBoolean(((TilePortableAltarMessage) msg).items != null); + if (((TilePortableAltarMessage) msg).items != null) { int[] items = ((TilePortableAltarMessage) msg).items; + for (int j = 0; j < items.length; j++) { int i = items[j]; @@ -136,9 +224,11 @@ public enum PacketHandler } target.writeBoolean(((TilePortableAltarMessage) msg).fluids != null); + if (((TilePortableAltarMessage) msg).fluids != null) { int[] fluids = ((TilePortableAltarMessage) msg).fluids; + for (int j = 0; j < fluids.length; j++) { int i = fluids[j]; @@ -156,9 +246,11 @@ public enum PacketHandler target.writeInt(((TileLifeInfuserMessage) msg).z); target.writeBoolean(((TileLifeInfuserMessage) msg).items != null); + if (((TileLifeInfuserMessage) msg).items != null) { int[] items = ((TileLifeInfuserMessage) msg).items; + for (int j = 0; j < items.length; j++) { int i = items[j]; @@ -167,9 +259,11 @@ public enum PacketHandler } target.writeBoolean(((TileLifeInfuserMessage) msg).fluids != null); + if (((TileLifeInfuserMessage) msg).fluids != null) { int[] fluids = ((TileLifeInfuserMessage) msg).fluids; + for (int j = 0; j < fluids.length; j++) { int i = fluids[j]; @@ -179,6 +273,41 @@ public enum PacketHandler target.writeInt(((TileLifeInfuserMessage) msg).capacity); + break; + + case 2: + target.writeInt(((TileLPMaterializerMessage) msg).x); + target.writeInt(((TileLPMaterializerMessage) msg).y); + target.writeInt(((TileLPMaterializerMessage) msg).z); + + target.writeBoolean(((TileLPMaterializerMessage) msg).items != null); + + if (((TileLPMaterializerMessage) msg).items != null) + { + int[] items = ((TileLPMaterializerMessage) msg).items; + + for (int j = 0; j < items.length; j++) + { + int i = items[j]; + target.writeInt(i); + } + } + + target.writeBoolean(((TileLPMaterializerMessage) msg).fluids != null); + + if (((TileLPMaterializerMessage) msg).fluids != null) + { + int[] fluids = ((TileLPMaterializerMessage) msg).fluids; + + for (int j = 0; j < fluids.length; j++) + { + int i = fluids[j]; + target.writeInt(i); + } + } + + target.writeInt(((TileLPMaterializerMessage) msg).capacity); + break; } } @@ -197,9 +326,11 @@ public enum PacketHandler boolean hasStacks = dat.readBoolean(); ((TilePortableAltarMessage) msg).items = new int[TilePortableAltar.sizeInv * 3]; + if (hasStacks) { ((TilePortableAltarMessage) msg).items = new int[TilePortableAltar.sizeInv * 3]; + for (int i = 0; i < ((TilePortableAltarMessage) msg).items.length; i++) { ((TilePortableAltarMessage) msg).items[i] = dat.readInt(); @@ -208,6 +339,7 @@ public enum PacketHandler boolean hasFluids = dat.readBoolean(); ((TilePortableAltarMessage) msg).fluids = new int[6]; + if (hasFluids) { for (int i = 0; i < ((TilePortableAltarMessage) msg).fluids.length; i++) @@ -227,9 +359,11 @@ public enum PacketHandler boolean hasStacks2 = dat.readBoolean(); ((TileLifeInfuserMessage) msg).items = new int[TileLifeInfuser.sizeInv * 3]; + if (hasStacks2) { ((TileLifeInfuserMessage) msg).items = new int[TileLifeInfuser.sizeInv * 3]; + for (int i = 0; i < ((TileLifeInfuserMessage) msg).items.length; i++) { ((TileLifeInfuserMessage) msg).items[i] = dat.readInt(); @@ -237,7 +371,8 @@ public enum PacketHandler } boolean hasFluids2 = dat.readBoolean(); - ((TileLifeInfuserMessage) msg).fluids = new int[6]; + ((TileLifeInfuserMessage) msg).fluids = new int[4]; + if (hasFluids2) { for (int i = 0; i < ((TileLifeInfuserMessage) msg).fluids.length; i++) @@ -248,6 +383,39 @@ public enum PacketHandler ((TileLifeInfuserMessage) msg).capacity = dat.readInt(); + break; + + case 2: + ((TileLPMaterializerMessage) msg).x = dat.readInt(); + ((TileLPMaterializerMessage) msg).y = dat.readInt(); + ((TileLPMaterializerMessage) msg).z = dat.readInt(); + boolean hasStacks3 = dat.readBoolean(); + + ((TileLPMaterializerMessage) msg).items = new int[TileLifeInfuser.sizeInv * 3]; + + if (hasStacks3) + { + ((TileLPMaterializerMessage) msg).items = new int[TileLifeInfuser.sizeInv * 3]; + + for (int i = 0; i < ((TileLPMaterializerMessage) msg).items.length; i++) + { + ((TileLPMaterializerMessage) msg).items[i] = dat.readInt(); + } + } + + boolean hasFluids3 = dat.readBoolean(); + ((TileLPMaterializerMessage) msg).fluids = new int[4]; + + if (hasFluids3) + { + for (int i = 0; i < ((TileLPMaterializerMessage) msg).fluids.length; i++) + { + ((TileLPMaterializerMessage) msg).fluids[i] = dat.readInt(); + } + } + + ((TileLPMaterializerMessage) msg).capacity = dat.readInt(); + break; } } @@ -281,6 +449,20 @@ public enum PacketHandler return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg); } + public static Packet getPacket(TileLPMaterializer tile) + { + TileLPMaterializerMessage msg = new TileLPMaterializerMessage(); + msg.index = 2; + msg.x = tile.xCoord; + msg.y = tile.yCoord; + msg.z = tile.zCoord; + msg.items = tile.buildIntDataList(); + msg.fluids = tile.buildFluidList(); + msg.capacity = tile.getCapacity(); + + return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg); + } + public void sendTo(Packet message, EntityPlayerMP player) { this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER); @@ -300,4 +482,10 @@ public enum PacketHandler this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point); this.channels.get(Side.SERVER).writeAndFlush(message); } + + public void sendToServer(Packet message) + { + this.channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.TOSERVER); + this.channels.get(Side.CLIENT).writeAndFlush(message).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); + } } diff --git a/src/main/java/com/arc/bloodarsenal/tileentity/TileLPMaterializer.java b/src/main/java/com/arc/bloodarsenal/tileentity/TileLPMaterializer.java new file mode 100644 index 0000000..977fb31 --- /dev/null +++ b/src/main/java/com/arc/bloodarsenal/tileentity/TileLPMaterializer.java @@ -0,0 +1,555 @@ +package com.arc.bloodarsenal.tileentity; + +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.Packet; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.World; +import net.minecraftforge.common.util.Constants; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.*; +import org.lwjgl.Sys; + +public class TileLPMaterializer extends TileEntity implements IInventory, IFluidTank, IFluidHandler +{ + private ItemStack[] inv; + + public boolean isActive; + + protected FluidStack fluid; + public int capacity; + private boolean canBeFilled; + protected FluidStack fluidOutput; + + private int drainRate; + private int bufferCapacity; + + public TileLPMaterializer() + { + this.inv = new ItemStack[1]; + fluid = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 0); + fluidOutput = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 0); + capacity = FluidContainerRegistry.BUCKET_VOLUME * 10; + + bufferCapacity = FluidContainerRegistry.BUCKET_VOLUME; + drainRate = 0; + } + + @Override + public void readFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readFromNBT(par1NBTTagCompound); + NBTTagList tagList = par1NBTTagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND); + + for (int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound tag = tagList.getCompoundTagAt(i); + int slot = tag.getByte("Slot"); + + if (slot >= 0 && slot < inv.length) + { + inv[slot] = ItemStack.loadItemStackFromNBT(tag); + } + } + + if (!par1NBTTagCompound.hasKey("Empty")) + { + FluidStack fluid = this.fluid.loadFluidStackFromNBT(par1NBTTagCompound); + + if (fluid != null) + { + setMainFluid(fluid); + } + + FluidStack fluidOut = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, par1NBTTagCompound.getInteger("outputAmount")); + + if (fluidOut != null) + { + setOutputFluid(fluidOut); + } + } + + isActive = par1NBTTagCompound.getBoolean("isActive"); + canBeFilled = par1NBTTagCompound.getBoolean("canBeFilled"); + capacity = par1NBTTagCompound.getInteger("capacity"); + + bufferCapacity = par1NBTTagCompound.getInteger("bufferCapacity"); + drainRate = par1NBTTagCompound.getInteger("drainRate"); + readCustomNBT(par1NBTTagCompound); + } + + @Override + public void writeToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeToNBT(par1NBTTagCompound); + NBTTagList itemList = new NBTTagList(); + + for (int i = 0; i < inv.length; i++) + { + if (inv[i] != null) + { + NBTTagCompound tag = new NBTTagCompound(); + tag.setByte("Slot", (byte) i); + inv[i].writeToNBT(tag); + itemList.appendTag(tag); + } + } + + if (fluid != null) + { + fluid.writeToNBT(par1NBTTagCompound); + } + else + { + par1NBTTagCompound.setString("Empty", ""); + } + + if (fluidOutput != null) + { + par1NBTTagCompound.setInteger("outputAmount", fluidOutput.amount); + } + + par1NBTTagCompound.setTag("Inventory", itemList); + par1NBTTagCompound.setBoolean("isActive", isActive); + par1NBTTagCompound.setBoolean("canBeFilled", canBeFilled); + par1NBTTagCompound.setInteger("capacity", capacity); + + par1NBTTagCompound.setInteger("drainRate", drainRate); + par1NBTTagCompound.setInteger("bufferCapacity", bufferCapacity); + writeCustomNBT(par1NBTTagCompound); + } + + public void readCustomNBT(NBTTagCompound par1NBTTagCompound) + { + NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND); + + if (nbttaglist.tagCount() > 0) + { + NBTTagCompound tagList = nbttaglist.getCompoundTagAt(0); + inv[0] = ItemStack.loadItemStackFromNBT(tagList); + } + } + + public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) + { + NBTTagList nbttaglist = new NBTTagList(); + NBTTagCompound tagList = new NBTTagCompound(); + + if (inv[0] != null) + { + tagList.setByte("Slot", (byte) 0); + inv[0].writeToNBT(tagList); + nbttaglist.appendTag(tagList); + } + par1NBTTagCompound.setTag("Inventory", nbttaglist); + } + + public int fillMainTank(int amount) //TODO + { + int filledAmount = Math.min(capacity - fluid.amount, amount); + fluid.amount += filledAmount; + + return filledAmount; + } + + @Override + public int getSizeInventory() + { + return 1; + } + + @Override + public ItemStack getStackInSlot(int slot) + { + return inv[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int amt) + { + ItemStack stack = getStackInSlot(slot); + + if (stack != null) + { + if (stack.stackSize <= amt) + { + setInventorySlotContents(slot, null); + } + else + { + stack = stack.splitStack(amt); + + if (stack.stackSize == 0) + { + setInventorySlotContents(slot, null); + } + } + } + + return stack; + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) + { + ItemStack stack = getStackInSlot(slot); + + if (stack != null) + { + setInventorySlotContents(slot, null); + } + + return stack; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack itemStack) + { + inv[slot] = itemStack; + + if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) + { + itemStack.stackSize = getInventoryStackLimit(); + } + } + + @Override + public String getInventoryName() + { + return "TileLPMaterializer"; + } + + @Override + public boolean hasCustomInventoryName() + { + return false; + } + + @Override + public int getInventoryStackLimit() + { + return 1; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer entityPlayer) + { + return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64; + } + + @Override + public void openInventory() {} + + @Override + public void closeInventory() {} + + @Override + public boolean isItemValidForSlot(int slot, ItemStack itemstack) + { + return slot == 0; + } + + public void sendChatInfoToPlayer(EntityPlayer player) + { + player.addChatMessage(new ChatComponentText("Contains: " + this.getFluidAmount() + "LP")); + } + + @Override + public Packet getDescriptionPacket() + { + return PacketHandler.getPacket(this); + } + + public void handlePacketData(int[] intData, int[] fluidData, int capacity) + { + if (intData == null) + { + return; + } + + if (intData.length == 3) + { + for (int i = 0; i < 1; i++) + { + if (intData[i * 3 + 2] != 0) + { + ItemStack is = new ItemStack(Item.getItemById(intData[i * 3]), intData[i * 3 + 2], intData[i * 3 + 1]); + inv[i] = is; + } + else + { + inv[i] = null; + } + } + } + + FluidStack flMain = new FluidStack(fluidData[0], fluidData[1]); + FluidStack flIn = new FluidStack(fluidData[2], fluidData[3]); + + this.setMainFluid(flMain); + this.setOutputFluid(flIn); + + this.capacity = capacity; + } + + public int[] buildIntDataList() + { + int[] sortList = new int[3];//3 ints per stack (1 * 3) + int pos; + + for (ItemStack is : inv) + { + pos = 0; + + if (is != null) + { + sortList[pos++] = Item.getIdFromItem(is.getItem()); + sortList[pos++] = is.getItemDamage(); + sortList[pos++] = is.stackSize; + } + else + { + sortList[pos++] = 0; + sortList[pos++] = 0; + sortList[pos++] = 0; + } + } + + return sortList; + } + + //Actual Stuffs + @Override + public void updateEntity() + { + super.updateEntity(); + materialize(); + + if (worldObj.getWorldTime() % 50 == 0) + { + int syphonMax = 250; + int fluidOutputted; + fluidOutputted = Math.min(syphonMax, this.bufferCapacity - this.fluidOutput.amount); + fluidOutputted = Math.min(this.fluid.amount, fluidOutputted); + this.fluidOutput.amount += fluidOutputted; + this.fluid.amount -= fluidOutputted; + } + + if (worldObj != null) + { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + } + + public void materialize() + { + ItemStack orb = this.getStackInSlot(0); + + if (orb == null) + { + return; + } + + if (fluid.amount <= capacity - 100) + { + if (!SoulNetworkHandler.canSyphonFromOnlyNetwork(orb, 150)) + { + SoulNetworkHandler.causeNauseaToPlayer(orb); + return; + } + + if (!SoulNetworkHandler.syphonFromNetworkWhileInContainer(orb, 150)) + { + return; + } + + if (worldObj.getWorldTime() % 4 == 0) + { + SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); + } + + fluid.amount += 100; + } + } + + //Fluid Stuffs + @Override + public int fill(FluidStack resource, boolean doFill) + { + return 0; + } + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) + { + return 0; + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) + { + if (resource == null) + { + return null; + } + + if (!resource.isFluidEqual(fluidOutput)) + { + return null; + } + + return drain(from, resource.amount, doDrain); + } + + @Override + public FluidStack drain(int maxDrain, boolean doDrain) + { + if (fluidOutput == null) + { + return null; + } + + int drained = maxDrain; + + if (fluidOutput.amount < drained) + { + drained = fluidOutput.amount; + } + + FluidStack stack = new FluidStack(fluidOutput, drained); + + if (doDrain) + { + fluidOutput.amount -= drained; + + if (fluidOutput.amount <= 0) + { + fluidOutput = null; + } + + if (this != null) + { + FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluidOutput, this.worldObj, this.xCoord, this.yCoord, this.zCoord, this)); + } + } + + if (fluidOutput == null) + { + fluidOutput = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 0); + } + + if (worldObj != null) + { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + + return stack; + } + + @Override + public boolean canFill(ForgeDirection from, Fluid fluid) + { + return false; + } + + @Override + public boolean canDrain(ForgeDirection from, Fluid fluid) + { + return true; + } + + @Override + public FluidStack drain(ForgeDirection from, int maxEmpty, boolean doDrain) + { + return this.drain(maxEmpty, doDrain); + } + + public void setMainFluid(FluidStack fluid) + { + this.fluid = fluid; + } + + public void setOutputFluid(FluidStack fluid) + { + this.fluidOutput = fluid; + } + + @Override + public FluidStack getFluid() + { + return fluid; + } + + @Override + public int getFluidAmount() + { + if (fluid == null) + { + return 0; + } + + return fluid.amount; + } + + @Override + public int getCapacity() + { + return capacity; + } + + @Override + public FluidTankInfo getInfo() + { + return new FluidTankInfo(this); + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection from) + { + FluidTank compositeTank = new FluidTank(capacity); + compositeTank.setFluid(fluid); + return new FluidTankInfo[]{compositeTank.getInfo()}; + } + + public int getBufferCapacity() + { + return bufferCapacity; + } + + public int[] buildFluidList() + { + int[] sortList = new int[4]; + + if (this.fluid == null) + { + sortList[0] = AlchemicalWizardry.lifeEssenceFluid.getID(); + sortList[1] = 0; + } + else + { + sortList[0] = this.fluid.fluidID; + sortList[1] = this.fluid.amount; + } + + if (this.fluidOutput == null) + { + sortList[2] = AlchemicalWizardry.lifeEssenceFluid.getID(); + sortList[3] = 0; + } + else + { + sortList[2] = this.fluidOutput.fluidID; + sortList[3] = this.fluidOutput.amount; + } + + return sortList; + } +} diff --git a/src/main/java/com/arc/bloodarsenal/tileentity/TileLifeInfuser.java b/src/main/java/com/arc/bloodarsenal/tileentity/TileLifeInfuser.java index 81ec503..563ec38 100644 --- a/src/main/java/com/arc/bloodarsenal/tileentity/TileLifeInfuser.java +++ b/src/main/java/com/arc/bloodarsenal/tileentity/TileLifeInfuser.java @@ -3,13 +3,16 @@ package com.arc.bloodarsenal.tileentity; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentText; import net.minecraftforge.common.util.Constants; @@ -20,11 +23,10 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan { private ItemStack[] inv; public static final int sizeInv = 1; + public int ticksExisted = 0; public static int damageLastTick = 0; - private static final int rate = 1 / 10; - private boolean isLinked; - private boolean isActive; + public boolean isActive; public boolean tookLastTick = true; protected FluidStack fluid; @@ -32,118 +34,15 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan private boolean canBeFilled; protected FluidStack fluidInput; + public FluidTank[] tanks = {new FluidTankRestricted(4000, new String[] {"Life Essence"})}; + public TileLifeInfuser() { - this.inv = new ItemStack[2]; + this.inv = new ItemStack[1]; isActive = false; fluid = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 0); fluidInput = new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 0); - capacity = FluidContainerRegistry.BUCKET_VOLUME * 10; - } - - public void setMainFluid(FluidStack fluid) - { - this.fluid = fluid; - } - - public void setInputFluid(FluidStack fluid) - { - this.fluidInput = fluid; - } - - public FluidStack getFluid() - { - return fluid; - } - - public int getFluidAmount() - { - if (fluid == null) - { - return 0; - } - - return fluid.amount; - } - - public int getCapacity() - { - return capacity; - } - - @Override - public FluidTankInfo getInfo() - { - return new FluidTankInfo(this); - } - - @Override - public int fill(FluidStack resource, boolean doFill) - { - TileEntity tile = this; - - if (resource == null) - { - return 0; - } - - if (resource.fluidID != (new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 1)).fluidID) - { - return 0; - } - - if (!doFill) - { - if (fluidInput == null) - { - return resource.amount; - } - - if (!fluidInput.isFluidEqual(resource)) - { - return 0; - } - - return Math.min(fluidInput.amount, resource.amount); - } - - if (fluidInput == null) - { - fluidInput = new FluidStack(resource, resource.amount); - - if (tile != null) - { - FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this)); - } - - return fluidInput.amount; - } - - if (!fluidInput.isFluidEqual(resource)) - { - return 0; - } - - int filled = fluidInput.amount; - - if (resource.amount < filled) - { - fluidInput.amount += resource.amount; - filled = resource.amount; - } - - if (tile != null) - { - FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this)); - } - - return filled; - } - - @Override - public FluidStack drain(int maxDrain, boolean doDrain) - { - return null; + this.capacity = FluidContainerRegistry.BUCKET_VOLUME * 10; } @Override @@ -181,9 +80,9 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan } isActive = par1NBTTagCompound.getBoolean("isActive"); - isLinked = par1NBTTagCompound.getBoolean("isLinked"); canBeFilled = par1NBTTagCompound.getBoolean("canBeFilled"); - readCustomNBT(par1NBTTagCompound); + capacity = par1NBTTagCompound.getInteger("capacity"); +// readCustomNBT(par1NBTTagCompound); } @Override @@ -203,6 +102,8 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan } } + par1NBTTagCompound.setTag("Inventory", itemList); + if (fluid != null) { fluid.writeToNBT(par1NBTTagCompound); @@ -219,11 +120,11 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan par1NBTTagCompound.setTag("Inventory", itemList); par1NBTTagCompound.setBoolean("isActive", isActive); - par1NBTTagCompound.setBoolean("isLinked", isLinked); par1NBTTagCompound.setBoolean("canBeFilled", canBeFilled); - writeCustomNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("capacity", capacity); +// writeCustomNBT(par1NBTTagCompound); } - +/* public void readCustomNBT(NBTTagCompound par1NBTTagCompound) { NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND); @@ -232,7 +133,6 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan { NBTTagCompound tagList = nbttaglist.getCompoundTagAt(0); inv[0] = ItemStack.loadItemStackFromNBT(tagList); - inv[1] = ItemStack.loadItemStackFromNBT(tagList); } } @@ -247,22 +147,10 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan inv[0].writeToNBT(tagList); nbttaglist.appendTag(tagList); } - if (inv[1] != null) - { - tagList.setByte("Slot", (byte) 1); - inv[1].writeToNBT(tagList); - nbttaglist.appendTag(tagList); - } + par1NBTTagCompound.setTag("Inventory", nbttaglist); } - - public int fillMainTank(int amount) //TODO STUFFS - { - int filledAmount = Math.min(capacity - fluid.amount, amount); - fluid.amount += filledAmount; - - return filledAmount; - } +*/ @Override public int getSizeInventory() @@ -361,71 +249,66 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan { super.updateEntity(); - if (inv[0] != null && inv[0].getItemDamage() > 0) + if (worldObj.getWorldTime() % 50 == 0) { - int damage = inv[0].getItemDamage(); + int fluidInputted; - if (getFluidAmount() >= 80) - { - takeLPFromTank(); - inv[0].setItemDamage(Math.max(0, damage - rate)); - } - else if (inv[1] != null) - { - takeLPFromSN(); - inv[0].setItemDamage(Math.max(0, damage - rate)); - } - else - { - return; - } - markDirty(); + fluidInputted = Math.min(500, -this.fluid.amount + capacity); + fluidInputted = Math.min(this.fluidInput.amount, fluidInputted); + this.fluid.amount += fluidInputted; + this.fluidInput.amount -= fluidInputted; + } - if (damageLastTick != 0 && damageLastTick != damage) + if (++ticksExisted % 10 == 0) + { + if (inv[0] != null && inv[0].getItemDamage() > 0) { - tookLastTick = true; + int lpCost = 500; + int damage = inv[0].getItemDamage(); + + if (getFluidAmount() >= lpCost) + { + fluid.amount = fluid.amount - lpCost; + inv[0].setItemDamage(Math.max(0, damage - 1)); + } + else + { + return; + } + + processInput(); + markDirty(); + + if (damageLastTick != 0 && damageLastTick != damage) + { + //Insert fancy particles here + SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); + tookLastTick = true; + } + else + { + tookLastTick = false; + } } else { tookLastTick = false; } + + damageLastTick = inv[0] == null ? 0 : inv[0].getItemDamage(); } - else + + if (worldObj != null) { - tookLastTick = false; - } - - damageLastTick = inv[0] == null ? 0 : inv[0].getItemDamage(); - } - - public void takeLPFromSN() - { - int cost = 100; - - ItemStack orbStack = this.getStackInSlot(1); - if (orbStack == null || !(orbStack.getItem() instanceof IBloodOrb)) - { - isLinked = true; - - if (!SoulNetworkHandler.canSyphonFromOnlyNetwork(orbStack, cost)) - { - SoulNetworkHandler.causeNauseaToPlayer(orbStack); - } - else if (!SoulNetworkHandler.syphonFromNetworkWhileInContainer(orbStack, cost)) - { - return; - } + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } - public int takeLPFromTank() + @Override + public void markDirty() { - return getFluidAmount() - 80; - } - - public void setActive() - { - isActive = false; + super.markDirty(); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } public boolean isActive() @@ -433,13 +316,15 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan return isActive; } - public boolean isLinked() {return isLinked;} - - public String linkedTo() + @Override + public boolean isItemValidForSlot(int slot, ItemStack itemstack) { - ItemStack orbStack = this.getStackInSlot(1); + return slot == 0; + } - return SoulNetworkHandler.getOwnerName(orbStack); + public void sendChatInfoToPlayer(EntityPlayer player) + { + player.addChatMessage(new ChatComponentText("Contains: " + this.getFluidAmount() + "LP")); } @Override @@ -506,6 +391,108 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan return sortList; } + //Fluid Stuffs + public FluidTank[] getTanks() + { + return this.tanks; + } + + public int fillMainTank(int amount) //TODO STUFFS + { + int filledAmount = Math.min(capacity - fluid.amount, amount); + fluid.amount += filledAmount; + + return filledAmount; + } + + public boolean processInput() + { + for (int i = 0; i < getTanks().length; i++) + { + int c = getFuelBurn(getTanks()[i].getFluid()); + + if ((c > 0) && (getTanks()[i].getFluidAmount() >= fluidAmmount())) + { + getTanks()[i].drain(fluidAmmount(), true); + return true; + } + } + return false; + } + + public int fluidAmmount() + { + return 100; + } + + public int getFuelBurn(FluidStack fluid) + { + return fluidAmmount(); + } + + @Override + public int fill(FluidStack resource, boolean doFill) + { + TileEntity tile = this; + + if (resource == null) + { + return 0; + } + + if (resource.fluidID != (new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 1)).fluidID) + { + return 0; + } + + if (!doFill) + { + if (fluidInput == null) + { + return Math.min(capacity, resource.amount); + } + + if (!fluidInput.isFluidEqual(resource)) + { + return 0; + } + + return Math.min(capacity - fluidInput.amount, resource.amount); + } + + if (fluidInput == null) + { + fluidInput = new FluidStack(resource, resource.amount); + + if (tile != null) + { + FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this, resource.amount)); + } + + return fluidInput.amount; + } + + if (!fluidInput.isFluidEqual(resource)) + { + return 0; + } + + int filled = capacity - fluidInput.amount; + + if (resource.amount < filled) + { + fluidInput.amount += resource.amount; + filled = resource.amount; + } + + if (tile != null) + { + FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluidInput, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, this, resource.amount)); + } + + return filled; + } + @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { @@ -526,31 +513,68 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan @Override public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - if (resource == null) - { - return null; - } + return null; + } - return drain(from, resource.amount, doDrain); + @Override + public FluidStack drain(int maxDrain, boolean doDrain) + { + return null; } @Override public FluidStack drain(ForgeDirection from, int maxEmpty, boolean doDrain) { - return this.drain(maxEmpty, doDrain); + return null; } @Override public boolean canFill(ForgeDirection from, Fluid fluid) { //I changed this, since fluidstack != fluid... :p dunno if it was a accident? so you might wanna check this //Sure thing! - return this.fluidInput != null && this.fluid.getFluid().equals(fluidInput.getFluid()); + return true; } @Override public boolean canDrain(ForgeDirection from, Fluid fluid) { - return true; + return false; + } + + public void setMainFluid(FluidStack fluid) + { + this.fluid = fluid; + } + + public void setInputFluid(FluidStack fluid) + { + this.fluidInput = fluid; + } + + public FluidStack getFluid() + { + return fluid; + } + + public int getFluidAmount() + { + if (fluid == null) + { + return 0; + } + + return fluid.amount; + } + + public int getCapacity() + { + return capacity; + } + + @Override + public FluidTankInfo getInfo() + { + return new FluidTankInfo(this); } @Override @@ -563,7 +587,7 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan public int[] buildFluidList() { - int[] sortList = new int[6]; + int[] sortList = new int[4]; if (this.fluid == null) { @@ -589,20 +613,4 @@ public class TileLifeInfuser extends TileEntity implements IInventory, IFluidTan return sortList; } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) - { - return slot == 0; - } - - public void sendChatInfoToPlayer(EntityPlayer player) - { - player.addChatMessage(new ChatComponentText("Contains: " + this.getFluidAmount() + "LP")); - - if (isLinked()) - { - player.addChatMessage(new ChatComponentText("Linked to: " + this.linkedTo())); - } - } } diff --git a/src/main/java/com/arc/bloodarsenal/tileentity/TilePortableAltar.java b/src/main/java/com/arc/bloodarsenal/tileentity/TilePortableAltar.java index 73dea7a..0dcca0a 100644 --- a/src/main/java/com/arc/bloodarsenal/tileentity/TilePortableAltar.java +++ b/src/main/java/com/arc/bloodarsenal/tileentity/TilePortableAltar.java @@ -56,6 +56,7 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT protected FluidStack fluidInput; private int progress; private int hasChanged = 0; + private int cooldownAfterCrafting = 500; private int lockdownDuration; private int demonBloodDuration; @@ -124,7 +125,7 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT for (int i = 0; i < tagList.tagCount(); i++) { - NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i); + NBTTagCompound tag = tagList.getCompoundTagAt(i); int slot = tag.getByte("Slot"); if (slot >= 0 && slot < inv.length) @@ -181,6 +182,7 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT lockdownDuration = par1NBTTagCompound.getInteger("lockdownDuration"); accelerationUpgrades = par1NBTTagCompound.getInteger("accelerationUpgrades"); demonBloodDuration = par1NBTTagCompound.getInteger("demonBloodDuration"); + cooldownAfterCrafting = par1NBTTagCompound.getInteger("cooldownAfterCrafting"); } public void setMainFluid(FluidStack fluid) @@ -261,6 +263,7 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT par1NBTTagCompound.setInteger("lockdownDuration", lockdownDuration); par1NBTTagCompound.setInteger("accelerationUpgrades", this.accelerationUpgrades); par1NBTTagCompound.setInteger("demonBloodDuration", demonBloodDuration); + par1NBTTagCompound.setInteger("cooldownAfterCrafting", cooldownAfterCrafting); } @Override @@ -619,7 +622,7 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT } } - if(worldObj.getWorldTime() % Math.max(20 - this.accelerationUpgrades, 1) == 0) + if (worldObj.getWorldTime() % Math.max(20 - this.accelerationUpgrades, 1) == 0) { int syphonMax = (int) (20 * this.dislocationMultiplier); int fluidInputted = 0; @@ -634,13 +637,17 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT this.fluid.amount -= fluidOutputted; } - if (worldObj.getWorldTime() % 100 == 0) + if (worldObj.getWorldTime() % 100 == 0 && (this.isActive || this.cooldownAfterCrafting <= 0)) { startCycle(); } if (!isActive) { + if (cooldownAfterCrafting > 0) + { + cooldownAfterCrafting--; + } return; } @@ -1069,7 +1076,16 @@ public class TilePortableAltar extends TileEntity implements IInventory, IFluidT player.addChatMessage(new ChatComponentText("Consumption rate: " + (int) (consumptionRate * (1 + consumptionMultiplier)) + "LP/t")); } player.addChatMessage(new ChatComponentText("Altar's Current Essence: " + this.fluid.amount + "LP")); - player.addChatMessage(new ChatComponentText(" Input tank: " + this.fluidInput.amount + "LP")); - player.addChatMessage(new ChatComponentText(" Output tank: " + this.fluidOutput.amount + "LP")); + player.addChatMessage(new ChatComponentText("Input tank: " + this.fluidInput.amount + "LP")); + player.addChatMessage(new ChatComponentText("Output tank: " + this.fluidOutput.amount + "LP")); + } + + @Override + public void requestPauseAfterCrafting(int amount) + { + if (this.isActive) + { + this.cooldownAfterCrafting = amount; + } } } diff --git a/src/main/resources/assets/bloodarsenal/lang/en_US.lang b/src/main/resources/assets/bloodarsenal/lang/en_US.lang index 50f6db7..6dd7824 100644 --- a/src/main/resources/assets/bloodarsenal/lang/en_US.lang +++ b/src/main/resources/assets/bloodarsenal/lang/en_US.lang @@ -21,6 +21,9 @@ tile.blood_infused_glowstone.name=Blood Infused Glowstone tile.blood_lamp.name=Blood Lamp tile.blood_infused_diamond_block.name=Blood Infused Diamond Block tile.portable_altar.name=Portable Altar [WIP] +tile.life_infuser.name=Life Infuser +tile.lp_materializer.name=Life Essence Materializer +tile.compacter.name=Soul Compacter [WIP] #Items item.bound_bow.name=Bound Bow @@ -33,7 +36,7 @@ item.blood_infused_sword_wood.name=Blood Infused Wooden Sword item.amorphic_catalyst.name=Amorphic Catalyst item.bound_sickle.name=Bound Sickle item.bound_shears.name=Bound Shears -item.blood_infused_iron.name=Blood Infused Iron +item.blood_infused_iron.name=Blood Infused Iron Ingot item.blood_infused_pickaxe_iron.name=Blood Infused Iron Pickaxe item.blood_infused_axe_iron.name=Blood Infused Iron Axe item.blood_infused_shovel_iron.name=Blood Infused Iron Shovel @@ -70,17 +73,26 @@ item.sigil_of_divinity.name=Sigil of Divinity item.blood_ball.name=Blood Ball item.item_blood_cake.name=Blood Cake item.wolf_hide.name=Wolf Hide +item.blood_money1.name=Blood Money x1 +item.blood_money4.name=Blood Money x4 +item.blood_money16.name=Blood Money x16 +item.blood_money64.name=Blood Money x64 +item.blood_burned_string.name=Blood Burned String #TConstruct Stuffs -material.blood_infused_iron.name=Blood Infused Iron +material.blood.infused.iron=Blood Infused Iron part.arrowhead=@material@ Arrowhead part.axe.head=@material@ Axe Head part.battle.sign=@material@ Battle Sign part.binding=@material@ Binding +part.bolt=@material@ Bolt +part.bow.limb=@material@ Bow Limb part.chisel.head=@material@ Chisel Head part.chunk=@material@ Chunk part.crossbar=@material@ Crossbar +part.crossbow.body=@material@ Crossbow Body +part.crossbow.limb=@material@ Crossbow Limb part.excavator.head=@material@ Excavator Head part.frypan.head=@material@ Pan Head part.full.guard=@material@ Full Guard @@ -94,6 +106,7 @@ part.medium.guard=@material@ Medium Guard part.pickaxe.head=@material@ Pickaxe Head part.scythe.head=@material@ Scythe Head part.shovel.head=@material@ Shovel Head +part.shuriken=@material@ Shuriken part.sword.blade=@material@ Sword Blade part.toolrod=@material@ Tool Rod part.toughbind=@material@ Tough Binding diff --git a/src/main/resources/assets/bloodarsenal/textures/blocks/lp_materializer.png b/src/main/resources/assets/bloodarsenal/textures/blocks/lp_materializer.png new file mode 100644 index 0000000..b2e6e2f Binary files /dev/null and b/src/main/resources/assets/bloodarsenal/textures/blocks/lp_materializer.png differ diff --git a/src/main/resources/assets/bloodarsenal/textures/items/blood_burned_string.png b/src/main/resources/assets/bloodarsenal/textures/items/blood_burned_string.png new file mode 100644 index 0000000..5f20198 Binary files /dev/null and b/src/main/resources/assets/bloodarsenal/textures/items/blood_burned_string.png differ diff --git a/src/main/resources/assets/bloodarsenal/textures/items/blood_money1.png b/src/main/resources/assets/bloodarsenal/textures/items/blood_money1.png new file mode 100644 index 0000000..5b96bd1 Binary files /dev/null and b/src/main/resources/assets/bloodarsenal/textures/items/blood_money1.png differ diff --git a/src/main/resources/assets/bloodarsenal/textures/items/blood_money16.png b/src/main/resources/assets/bloodarsenal/textures/items/blood_money16.png new file mode 100644 index 0000000..78727db Binary files /dev/null and b/src/main/resources/assets/bloodarsenal/textures/items/blood_money16.png differ diff --git a/src/main/resources/assets/bloodarsenal/textures/items/blood_money4.png b/src/main/resources/assets/bloodarsenal/textures/items/blood_money4.png new file mode 100644 index 0000000..749ac78 Binary files /dev/null and b/src/main/resources/assets/bloodarsenal/textures/items/blood_money4.png differ diff --git a/src/main/resources/assets/bloodarsenal/textures/items/blood_money64.png b/src/main/resources/assets/bloodarsenal/textures/items/blood_money64.png new file mode 100644 index 0000000..07b46fe Binary files /dev/null and b/src/main/resources/assets/bloodarsenal/textures/items/blood_money64.png differ diff --git a/src/main/resources/assets/bloodarsenal/textures/items/bound_igniter.png b/src/main/resources/assets/bloodarsenal/textures/items/bound_igniter.png new file mode 100644 index 0000000..d9d8fd2 Binary files /dev/null and b/src/main/resources/assets/bloodarsenal/textures/items/bound_igniter.png differ diff --git a/src/main/resources/assets/bloodarsenal/textures/items/staff_of_transmutation.png b/src/main/resources/assets/bloodarsenal/textures/items/staff_of_transmutation.png new file mode 100644 index 0000000..8673a31 Binary files /dev/null and b/src/main/resources/assets/bloodarsenal/textures/items/staff_of_transmutation.png differ diff --git a/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_bolt.png b/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_bolt.png new file mode 100644 index 0000000..982fbe4 Binary files /dev/null and b/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_bolt.png differ diff --git a/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_bow_limb.png b/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_bow_limb.png new file mode 100644 index 0000000..6dd4369 Binary files /dev/null and b/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_bow_limb.png differ diff --git a/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_crossbow_body.png b/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_crossbow_body.png new file mode 100644 index 0000000..7b1f83e Binary files /dev/null and b/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_crossbow_body.png differ diff --git a/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_crossbow_limb.png b/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_crossbow_limb.png new file mode 100644 index 0000000..46c1aba Binary files /dev/null and b/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_crossbow_limb.png differ diff --git a/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_shuriken.png b/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_shuriken.png new file mode 100644 index 0000000..7d99153 Binary files /dev/null and b/src/main/resources/assets/bloodarsenal/textures/items/tinkers/parts/blood_infused_iron_shuriken.png differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 71c768f..347625e 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "BloodArsenal", "name": "Blood Arsenal", "description": "Blood-themed tools, weapons, armor and much more!", - "version": "1.1.3", + "version": "1.1.4", "mcversion": "1.7.10", "url": "", "updateUrl": "",