Anti-comments sweep!

This commit is contained in:
Tombenpotter 2014-10-13 22:33:20 +02:00
parent e6a10f3f06
commit dea1f87078
454 changed files with 23594 additions and 26739 deletions

View file

@ -1,20 +1,20 @@
package WayofTime.alchemicalWizardry; package WayofTime.alchemicalWizardry;
import WayofTime.alchemicalWizardry.client.renderer.ColourThreshold;
import WayofTime.alchemicalWizardry.client.renderer.RenderHelper;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorParadigm;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraftforge.common.config.Configuration;
import java.io.File; import java.io.File;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraftforge.common.config.Configuration;
import WayofTime.alchemicalWizardry.client.renderer.ColourThreshold;
import WayofTime.alchemicalWizardry.client.renderer.RenderHelper;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorParadigm;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
* User: Pokefenn * User: Pokefenn
@ -23,8 +23,8 @@ import cpw.mods.fml.relauncher.Side;
*/ */
public class BloodMagicConfiguration public class BloodMagicConfiguration
{ {
private static final String DEFAULT_COLOR_LIST = "100,f; 80,7; 60,e; 40,6; 25,c; 10,4"; private static final String DEFAULT_COLOR_LIST = "100,f; 80,7; 60,e; 40,6; 25,c; 10,4";
public static final List<ColourThreshold> colorList = new ArrayList<ColourThreshold>(); public static final List<ColourThreshold> colorList = new ArrayList<ColourThreshold>();
public static Configuration config; public static Configuration config;
public static final String CATEGORY_GAMEPLAY = "gameplay"; public static final String CATEGORY_GAMEPLAY = "gameplay";
@ -32,13 +32,13 @@ public class BloodMagicConfiguration
public static void init(File configFile) public static void init(File configFile)
{ {
for (String s : DEFAULT_COLOR_LIST.split(";")) for (String s : DEFAULT_COLOR_LIST.split(";"))
{ {
String[] ct = s.split(","); String[] ct = s.split(",");
colorList.add(new ColourThreshold(Integer.valueOf(ct[0].trim()), ct[1].trim())); colorList.add(new ColourThreshold(Integer.valueOf(ct[0].trim()), ct[1].trim()));
} }
config = new Configuration(configFile); config = new Configuration(configFile);
try try
@ -59,16 +59,16 @@ public class BloodMagicConfiguration
AlchemicalWizardry.customPotionInhibitID = config.get("Potion ID", "Inhibit", 103).getInt(); AlchemicalWizardry.customPotionInhibitID = config.get("Potion ID", "Inhibit", 103).getInt();
AlchemicalWizardry.customPotionFlightID = config.get("Potion ID", "Flight", 104).getInt(); AlchemicalWizardry.customPotionFlightID = config.get("Potion ID", "Flight", 104).getInt();
AlchemicalWizardry.customPotionReciprocationID = config.get("Potion ID", "Reciprocation", 105).getInt(); AlchemicalWizardry.customPotionReciprocationID = config.get("Potion ID", "Reciprocation", 105).getInt();
AlchemicalWizardry.customPotionFlameCloakID = config.get("Potion ID","FlameCloak",106).getInt(); AlchemicalWizardry.customPotionFlameCloakID = config.get("Potion ID", "FlameCloak", 106).getInt();
AlchemicalWizardry.customPotionIceCloakID = config.get("Potion ID","IceCloak",107).getInt(); AlchemicalWizardry.customPotionIceCloakID = config.get("Potion ID", "IceCloak", 107).getInt();
AlchemicalWizardry.customPotionHeavyHeartID = config.get("Potion ID","HeavyHeart",108).getInt(); AlchemicalWizardry.customPotionHeavyHeartID = config.get("Potion ID", "HeavyHeart", 108).getInt();
AlchemicalWizardry.customPotionFireFuseID = config.get("Potion ID","FireFuse",109).getInt(); AlchemicalWizardry.customPotionFireFuseID = config.get("Potion ID", "FireFuse", 109).getInt();
AlchemicalWizardry.customPotionPlanarBindingID = config.get("Potion ID","PlanarBinding",110).getInt(); AlchemicalWizardry.customPotionPlanarBindingID = config.get("Potion ID", "PlanarBinding", 110).getInt();
AlchemicalWizardry.customPotionSoulFrayID = config.get("Potion ID","SoulFray",111).getInt(); AlchemicalWizardry.customPotionSoulFrayID = config.get("Potion ID", "SoulFray", 111).getInt();
AlchemicalWizardry.customPotionSoulHardenID = config.get("Potion ID", "SoulHarden", 112).getInt(); AlchemicalWizardry.customPotionSoulHardenID = config.get("Potion ID", "SoulHarden", 112).getInt();
AlchemicalWizardry.customPotionDeafID = config.get("Potion ID", "Deaf", 113).getInt(); AlchemicalWizardry.customPotionDeafID = config.get("Potion ID", "Deaf", 113).getInt();
AlchemicalWizardry.customPotionFeatherFallID = config.get("Potion ID", "FeatherFall", 114).getInt(); AlchemicalWizardry.customPotionFeatherFallID = config.get("Potion ID", "FeatherFall", 114).getInt();
MeteorParadigm.maxChance = config.get("meteor", "maxChance", 1000).getInt(); MeteorParadigm.maxChance = config.get("meteor", "maxChance", 1000).getInt();
AlchemicalWizardry.doMeteorsDestroyBlocks = config.get("meteor", "doMeteorsDestroyBlocks", true).getBoolean(true); AlchemicalWizardry.doMeteorsDestroyBlocks = config.get("meteor", "doMeteorsDestroyBlocks", true).getBoolean(true);
AlchemicalWizardry.diamondMeteorArray = config.get("meteor", "diamondMeteor", new String[]{"oreDiamond", "100", "oreEmerald", "75", "oreCinnabar", "200", "oreAmber", "200"}).getStringList(); AlchemicalWizardry.diamondMeteorArray = config.get("meteor", "diamondMeteor", new String[]{"oreDiamond", "100", "oreEmerald", "75", "oreCinnabar", "200", "oreAmber", "200"}).getStringList();
@ -80,27 +80,27 @@ public class BloodMagicConfiguration
AlchemicalWizardry.netherStarMeteorArray = config.get("meteor", "netherStarMeteor", new String[]{"oreDiamond", "150", "oreEmerald", "100", "oreQuartz", "250", "oreSunstone", "5", "oreMoonstone", "50", "oreIridium", "5", "oreCertusQuartz", "150"}).getStringList(); AlchemicalWizardry.netherStarMeteorArray = config.get("meteor", "netherStarMeteor", new String[]{"oreDiamond", "150", "oreEmerald", "100", "oreQuartz", "250", "oreSunstone", "5", "oreMoonstone", "50", "oreIridium", "5", "oreCertusQuartz", "150"}).getStringList();
AlchemicalWizardry.netherStarMeteorRadius = config.get("meteor", "netherStarMeteorRadius", 3).getInt(); AlchemicalWizardry.netherStarMeteorRadius = config.get("meteor", "netherStarMeteorRadius", 3).getInt();
AlchemicalWizardry.allowedCrushedOresArray = config.get("oreCrushing", "allowedOres", new String[]{"iron","gold","copper","tin","lead","silver","osmium"}).getStringList(); AlchemicalWizardry.allowedCrushedOresArray = config.get("oreCrushing", "allowedOres", new String[]{"iron", "gold", "copper", "tin", "lead", "silver", "osmium"}).getStringList();
AlchemicalWizardry.wimpySettings = config.get("WimpySettings","IDontLikeFun",false).getBoolean(false); AlchemicalWizardry.wimpySettings = config.get("WimpySettings", "IDontLikeFun", false).getBoolean(false);
AlchemicalWizardry.respawnWithDebuff = config.get("WimpySettings", "RespawnWithDebuff", true).getBoolean(); AlchemicalWizardry.respawnWithDebuff = config.get("WimpySettings", "RespawnWithDebuff", true).getBoolean();
AlchemicalWizardry.causeHungerWithRegen = config.get("WimpySettings", "causeHungerWithRegen", true).getBoolean(); AlchemicalWizardry.causeHungerWithRegen = config.get("WimpySettings", "causeHungerWithRegen", true).getBoolean();
// AlchemicalWizardry.lockdownAltar = config.get("WimpySettings", "LockdownAltarWithRegen", true).getBoolean(); // AlchemicalWizardry.lockdownAltar = config.get("WimpySettings", "LockdownAltarWithRegen", true).getBoolean();
AlchemicalWizardry.lockdownAltar = false; AlchemicalWizardry.lockdownAltar = false;
Side side = FMLCommonHandler.instance().getSide(); Side side = FMLCommonHandler.instance().getSide();
if(side == Side.CLIENT) if (side == Side.CLIENT)
{ {
RenderHelper.xOffset = config.get("ClientSettings", "AlchemyHUDxOffset", 50).getInt(); RenderHelper.xOffset = config.get("ClientSettings", "AlchemyHUDxOffset", 50).getInt();
RenderHelper.yOffset = config.get("ClientSettings", "AlchemyHUDyOffset", 2).getInt(); RenderHelper.yOffset = config.get("ClientSettings", "AlchemyHUDyOffset", 2).getInt();
} }
} catch (Exception e) } catch (Exception e)
{ {
//TODO Log //TODO Log
//FMLLog.log(Level.SEVERE, e, "Blood Magic" + " has had a problem loading its configuration, go ask on the forums :p"); //FMLLog.log(Level.SEVERE, e, "Blood Magic" + " has had a problem loading its configuration, go ask on the forums :p");
} finally } finally
{ {
@ -123,25 +123,25 @@ public class BloodMagicConfiguration
} }
public static void loadBlacklist() public static void loadBlacklist()
{ {
AlchemicalWizardry.wellBlacklist=new ArrayList<Class>(); AlchemicalWizardry.wellBlacklist = new ArrayList<Class>();
for( Object o : EntityList.stringToClassMapping.entrySet()) for (Object o : EntityList.stringToClassMapping.entrySet())
{ {
Entry entry=(Entry) o; Entry entry = (Entry) o;
Class curClass=(Class)entry.getValue(); Class curClass = (Class) entry.getValue();
boolean valid=EntityLivingBase.class.isAssignableFrom(curClass) && !Modifier.isAbstract(curClass.getModifiers()); boolean valid = EntityLivingBase.class.isAssignableFrom(curClass) && !Modifier.isAbstract(curClass.getModifiers());
if(valid) if (valid)
{ {
boolean blacklisted=config.get("wellOfSufferingBlackList", entry.getKey().toString(), false).getBoolean(); boolean blacklisted = config.get("wellOfSufferingBlackList", entry.getKey().toString(), false).getBoolean();
if(blacklisted) if (blacklisted)
AlchemicalWizardry.wellBlacklist.add(curClass); AlchemicalWizardry.wellBlacklist.add(curClass);
} }
} }
config.save(); config.save();
} }
} }

View file

@ -1,46 +1,9 @@
package WayofTime.alchemicalWizardry; package WayofTime.alchemicalWizardry;
import net.minecraft.block.Block; import WayofTime.alchemicalWizardry.common.block.*;
import WayofTime.alchemicalWizardry.common.block.ArmourForge; import WayofTime.alchemicalWizardry.common.items.*;
import WayofTime.alchemicalWizardry.common.block.BlockAlchemicCalcinator;
import WayofTime.alchemicalWizardry.common.block.BlockAltar;
import WayofTime.alchemicalWizardry.common.block.BlockBelljar;
import WayofTime.alchemicalWizardry.common.block.BlockBloodLightSource;
import WayofTime.alchemicalWizardry.common.block.BlockConduit;
import WayofTime.alchemicalWizardry.common.block.BlockDemonPortal;
import WayofTime.alchemicalWizardry.common.block.BlockHomHeart;
import WayofTime.alchemicalWizardry.common.block.BlockMasterStone;
import WayofTime.alchemicalWizardry.common.block.BlockPedestal;
import WayofTime.alchemicalWizardry.common.block.BlockPlinth;
import WayofTime.alchemicalWizardry.common.block.BlockReagentConduit;
import WayofTime.alchemicalWizardry.common.block.BlockSchematicSaver;
import WayofTime.alchemicalWizardry.common.block.BlockSocket;
import WayofTime.alchemicalWizardry.common.block.BlockSpectralContainer;
import WayofTime.alchemicalWizardry.common.block.BlockSpellEffect;
import WayofTime.alchemicalWizardry.common.block.BlockSpellEnhancement;
import WayofTime.alchemicalWizardry.common.block.BlockSpellModifier;
import WayofTime.alchemicalWizardry.common.block.BlockSpellParadigm;
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
import WayofTime.alchemicalWizardry.common.block.BlockWritingTable;
import WayofTime.alchemicalWizardry.common.block.BloodRune;
import WayofTime.alchemicalWizardry.common.block.BloodStoneBrick;
import WayofTime.alchemicalWizardry.common.block.EfficiencyRune;
import WayofTime.alchemicalWizardry.common.block.EmptySocket;
import WayofTime.alchemicalWizardry.common.block.ImperfectRitualStone;
import WayofTime.alchemicalWizardry.common.block.LargeBloodStoneBrick;
import WayofTime.alchemicalWizardry.common.block.LifeEssenceBlock;
import WayofTime.alchemicalWizardry.common.block.RitualStone;
import WayofTime.alchemicalWizardry.common.block.RuneOfSacrifice;
import WayofTime.alchemicalWizardry.common.block.RuneOfSelfSacrifice;
import WayofTime.alchemicalWizardry.common.block.SpectralBlock;
import WayofTime.alchemicalWizardry.common.block.SpeedRune;
import WayofTime.alchemicalWizardry.common.items.ItemBlockCrystalBelljar;
import WayofTime.alchemicalWizardry.common.items.ItemBloodRuneBlock;
import WayofTime.alchemicalWizardry.common.items.ItemSpellEffectBlock;
import WayofTime.alchemicalWizardry.common.items.ItemSpellEnhancementBlock;
import WayofTime.alchemicalWizardry.common.items.ItemSpellModifierBlock;
import WayofTime.alchemicalWizardry.common.items.ItemSpellParadigmBlock;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -54,8 +17,6 @@ public class ModBlocks
public static Block testingBlock; public static Block testingBlock;
public static Block bloodStoneBrick; public static Block bloodStoneBrick;
public static Block largeBloodStoneBrick; public static Block largeBloodStoneBrick;
// public static Block lifeEssenceStill;
// public static Block lifeEssenceFlowing;
public static BlockAltar blockAltar; public static BlockAltar blockAltar;
public static BloodRune bloodRune; public static BloodRune bloodRune;
public static SpeedRune speedRune; public static SpeedRune speedRune;
@ -96,7 +57,6 @@ public class ModBlocks
efficiencyRune = new EfficiencyRune(); efficiencyRune = new EfficiencyRune();
runeOfSacrifice = new RuneOfSacrifice(); runeOfSacrifice = new RuneOfSacrifice();
runeOfSelfSacrifice = new RuneOfSelfSacrifice(); runeOfSelfSacrifice = new RuneOfSelfSacrifice();
blockTeleposer = new BlockTeleposer(); blockTeleposer = new BlockTeleposer();
spectralBlock = new SpectralBlock(); spectralBlock = new SpectralBlock();
ritualStone = new RitualStone(); ritualStone = new RitualStone();
@ -123,14 +83,14 @@ public class ModBlocks
blockReagentConduit = new BlockReagentConduit(); blockReagentConduit = new BlockReagentConduit();
blockAlchemicCalcinator = new BlockAlchemicCalcinator(); blockAlchemicCalcinator = new BlockAlchemicCalcinator();
blockCrystalBelljar = new BlockBelljar(); blockCrystalBelljar = new BlockBelljar();
blockLifeEssence = new LifeEssenceBlock(); blockLifeEssence = new LifeEssenceBlock();
} }
public static void registerBlocksInPre() public static void registerBlocksInPre()
{ {
GameRegistry.registerBlock(ModBlocks.blockAltar, "Altar"); GameRegistry.registerBlock(ModBlocks.blockAltar, "Altar");
GameRegistry.registerBlock(ModBlocks.bloodRune, ItemBloodRuneBlock.class, "AlchemicalWizardry" + (ModBlocks.bloodRune.getUnlocalizedName().substring(5))); GameRegistry.registerBlock(ModBlocks.bloodRune, ItemBloodRuneBlock.class, "AlchemicalWizardry" + (ModBlocks.bloodRune.getUnlocalizedName().substring(5)));
GameRegistry.registerBlock(ModBlocks.blockLifeEssence, "lifeEssence"); GameRegistry.registerBlock(ModBlocks.blockLifeEssence, "lifeEssence");
GameRegistry.registerBlock(ModBlocks.speedRune, "speedRune"); GameRegistry.registerBlock(ModBlocks.speedRune, "speedRune");
GameRegistry.registerBlock(ModBlocks.efficiencyRune, "efficiencyRune"); GameRegistry.registerBlock(ModBlocks.efficiencyRune, "efficiencyRune");
@ -139,9 +99,9 @@ public class ModBlocks
GameRegistry.registerBlock(ModBlocks.ritualStone, "ritualStone"); GameRegistry.registerBlock(ModBlocks.ritualStone, "ritualStone");
GameRegistry.registerBlock(ModBlocks.blockMasterStone, "masterStone"); GameRegistry.registerBlock(ModBlocks.blockMasterStone, "masterStone");
GameRegistry.registerBlock(ModBlocks.bloodSocket, "bloodSocket"); GameRegistry.registerBlock(ModBlocks.bloodSocket, "bloodSocket");
GameRegistry.registerBlock(ModBlocks.imperfectRitualStone, "imperfectRitualStone"); GameRegistry.registerBlock(ModBlocks.imperfectRitualStone, "imperfectRitualStone");
GameRegistry.registerBlock(ModBlocks.armourForge, "armourForge"); GameRegistry.registerBlock(ModBlocks.armourForge, "armourForge");
GameRegistry.registerBlock(ModBlocks.emptySocket, "emptySocket"); GameRegistry.registerBlock(ModBlocks.emptySocket, "emptySocket");
GameRegistry.registerBlock(ModBlocks.bloodStoneBrick, "bloodStoneBrick"); GameRegistry.registerBlock(ModBlocks.bloodStoneBrick, "bloodStoneBrick");
GameRegistry.registerBlock(ModBlocks.largeBloodStoneBrick, "largeBloodStoneBrick"); GameRegistry.registerBlock(ModBlocks.largeBloodStoneBrick, "largeBloodStoneBrick");
@ -152,23 +112,22 @@ public class ModBlocks
GameRegistry.registerBlock(ModBlocks.blockTeleposer, "blockTeleposer"); GameRegistry.registerBlock(ModBlocks.blockTeleposer, "blockTeleposer");
GameRegistry.registerBlock(ModBlocks.spectralBlock, "spectralBlock"); GameRegistry.registerBlock(ModBlocks.spectralBlock, "spectralBlock");
GameRegistry.registerBlock(ModBlocks.blockBloodLight, "bloodLight"); GameRegistry.registerBlock(ModBlocks.blockBloodLight, "bloodLight");
GameRegistry.registerBlock(ModBlocks.blockConduit,"blockConduit"); GameRegistry.registerBlock(ModBlocks.blockConduit, "blockConduit");
GameRegistry.registerBlock(ModBlocks.blockSpellParadigm, ItemSpellParadigmBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellParadigm.getUnlocalizedName())); GameRegistry.registerBlock(ModBlocks.blockSpellParadigm, ItemSpellParadigmBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellParadigm.getUnlocalizedName()));
GameRegistry.registerBlock(ModBlocks.blockSpellEnhancement, ItemSpellEnhancementBlock.class,"AlchemicalWizardry" + (ModBlocks.blockSpellEnhancement.getUnlocalizedName())); GameRegistry.registerBlock(ModBlocks.blockSpellEnhancement, ItemSpellEnhancementBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellEnhancement.getUnlocalizedName()));
GameRegistry.registerBlock(ModBlocks.blockSpellModifier, ItemSpellModifierBlock.class,"AlchemicalWizardry" + (ModBlocks.blockSpellModifier.getUnlocalizedName())); GameRegistry.registerBlock(ModBlocks.blockSpellModifier, ItemSpellModifierBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellModifier.getUnlocalizedName()));
GameRegistry.registerBlock(ModBlocks.blockSpellEffect, ItemSpellEffectBlock.class,"AlchemicalWizardry" + (ModBlocks.blockSpellEffect.getUnlocalizedName())); GameRegistry.registerBlock(ModBlocks.blockSpellEffect, ItemSpellEffectBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellEffect.getUnlocalizedName()));
GameRegistry.registerBlock(ModBlocks.blockSpectralContainer, "spectralContainer"); GameRegistry.registerBlock(ModBlocks.blockSpectralContainer, "spectralContainer");
GameRegistry.registerBlock(ModBlocks.blockDemonPortal, "demonPortalMain"); GameRegistry.registerBlock(ModBlocks.blockDemonPortal, "demonPortalMain");
GameRegistry.registerBlock(ModBlocks.blockBuildingSchematicSaver, "blockSchemSaver"); GameRegistry.registerBlock(ModBlocks.blockBuildingSchematicSaver, "blockSchemSaver");
GameRegistry.registerBlock(ModBlocks.blockReagentConduit, "blockReagentConduit"); GameRegistry.registerBlock(ModBlocks.blockReagentConduit, "blockReagentConduit");
GameRegistry.registerBlock(ModBlocks.blockAlchemicCalcinator, "blockAlchemicCalcinator"); GameRegistry.registerBlock(ModBlocks.blockAlchemicCalcinator, "blockAlchemicCalcinator");
GameRegistry.registerBlock(ModBlocks.blockCrystalBelljar, ItemBlockCrystalBelljar.class, "blockCrystalBelljar"); GameRegistry.registerBlock(ModBlocks.blockCrystalBelljar, ItemBlockCrystalBelljar.class, "blockCrystalBelljar");
} }
public static void registerBlocksInInit() public static void registerBlocksInInit()
{ {
//GameRegistry.registerBlock(ModBlocks.blockLifeEssence, "lifeEssence");
} }
} }

View file

@ -1,82 +1,16 @@
package WayofTime.alchemicalWizardry; package WayofTime.alchemicalWizardry;
import net.minecraft.creativetab.CreativeTabs; import WayofTime.alchemicalWizardry.common.items.*;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import WayofTime.alchemicalWizardry.common.items.AWBaseItems;
import WayofTime.alchemicalWizardry.common.items.ActivationCrystal;
import WayofTime.alchemicalWizardry.common.items.AirScribeTool;
import WayofTime.alchemicalWizardry.common.items.ApprenticeBloodOrb;
import WayofTime.alchemicalWizardry.common.items.ArchmageBloodOrb;
import WayofTime.alchemicalWizardry.common.items.ArmourInhibitor;
import WayofTime.alchemicalWizardry.common.items.BlankSpell;
import WayofTime.alchemicalWizardry.common.items.BloodShard;
import WayofTime.alchemicalWizardry.common.items.BoundArmour;
import WayofTime.alchemicalWizardry.common.items.BoundAxe;
import WayofTime.alchemicalWizardry.common.items.BoundPickaxe;
import WayofTime.alchemicalWizardry.common.items.BoundShovel;
import WayofTime.alchemicalWizardry.common.items.CheatyItem;
import WayofTime.alchemicalWizardry.common.items.DaggerOfSacrifice;
import WayofTime.alchemicalWizardry.common.items.DemonPlacer;
import WayofTime.alchemicalWizardry.common.items.DemonicTelepositionFocus;
import WayofTime.alchemicalWizardry.common.items.DuskScribeTool;
import WayofTime.alchemicalWizardry.common.items.EarthScribeTool;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.items.EnergyBazooka;
import WayofTime.alchemicalWizardry.common.items.EnergyBlast;
import WayofTime.alchemicalWizardry.common.items.EnergySword;
import WayofTime.alchemicalWizardry.common.items.EnhancedTelepositionFocus;
import WayofTime.alchemicalWizardry.common.items.FireScribeTool;
import WayofTime.alchemicalWizardry.common.items.ItemAlchemyBase;
import WayofTime.alchemicalWizardry.common.items.ItemComplexSpellCrystal;
import WayofTime.alchemicalWizardry.common.items.ItemComponents;
import WayofTime.alchemicalWizardry.common.items.ItemDiabloKey;
import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner;
import WayofTime.alchemicalWizardry.common.items.LavaCrystal;
import WayofTime.alchemicalWizardry.common.items.LifeBucket;
import WayofTime.alchemicalWizardry.common.items.MagicianBloodOrb;
import WayofTime.alchemicalWizardry.common.items.MasterBloodOrb;
import WayofTime.alchemicalWizardry.common.items.ReinforcedTelepositionFocus;
import WayofTime.alchemicalWizardry.common.items.SacrificialDagger;
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
import WayofTime.alchemicalWizardry.common.items.WaterScribeTool;
import WayofTime.alchemicalWizardry.common.items.energy.ItemAttunedCrystal; import WayofTime.alchemicalWizardry.common.items.energy.ItemAttunedCrystal;
import WayofTime.alchemicalWizardry.common.items.energy.ItemDestinationClearer; import WayofTime.alchemicalWizardry.common.items.energy.ItemDestinationClearer;
import WayofTime.alchemicalWizardry.common.items.energy.ItemTankSegmenter; import WayofTime.alchemicalWizardry.common.items.energy.ItemTankSegmenter;
import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask; import WayofTime.alchemicalWizardry.common.items.potion.*;
import WayofTime.alchemicalWizardry.common.items.potion.AlchemyReagent; import WayofTime.alchemicalWizardry.common.items.sigil.*;
import WayofTime.alchemicalWizardry.common.items.potion.AverageLengtheningCatalyst;
import WayofTime.alchemicalWizardry.common.items.potion.AveragePowerCatalyst;
import WayofTime.alchemicalWizardry.common.items.potion.CombinationalCatalyst;
import WayofTime.alchemicalWizardry.common.items.potion.EnhancedFillingAgent;
import WayofTime.alchemicalWizardry.common.items.potion.GreaterLengtheningCatalyst;
import WayofTime.alchemicalWizardry.common.items.potion.GreaterPowerCatalyst;
import WayofTime.alchemicalWizardry.common.items.potion.MundaneLengtheningCatalyst;
import WayofTime.alchemicalWizardry.common.items.potion.MundanePowerCatalyst;
import WayofTime.alchemicalWizardry.common.items.potion.StandardBindingAgent;
import WayofTime.alchemicalWizardry.common.items.potion.StandardFillingAgent;
import WayofTime.alchemicalWizardry.common.items.potion.WeakBindingAgent;
import WayofTime.alchemicalWizardry.common.items.potion.WeakFillingAgent;
import WayofTime.alchemicalWizardry.common.items.sigil.AirSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.DivinationSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemBloodLightSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemFluidSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemSeerSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemSigilOfEnderSeverance;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemSigilOfSupression;
import WayofTime.alchemicalWizardry.common.items.sigil.LavaSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfElementalAffinity;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfGrowth;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHaste;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfMagnetism;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfTheBridge;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfTheFastMiner;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfWind;
import WayofTime.alchemicalWizardry.common.items.sigil.VoidSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.WaterSigil;
import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool; import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -153,7 +87,7 @@ public class ModItems
public static Item armourInhibitor; public static Item armourInhibitor;
public static Item creativeFiller; public static Item creativeFiller;
public static Item demonPlacer; public static Item demonPlacer;
public static Item baseItems; public static Item baseItems;
public static Item baseAlchemyItems; public static Item baseAlchemyItems;
@ -174,19 +108,19 @@ public class ModItems
public static Item itemBloodLightSigil; public static Item itemBloodLightSigil;
public static Item itemComplexSpellCrystal; public static Item itemComplexSpellCrystal;
public static Item itemBloodFrame; public static Item itemBloodFrame;
public static Item itemSigilOfEnderSeverance; public static Item itemSigilOfEnderSeverance;
public static Item itemSigilOfSupression; public static Item itemSigilOfSupression;
public static Item itemFluidSigil; public static Item itemFluidSigil;
public static Item itemSeerSigil; public static Item itemSeerSigil;
public static Item itemCombinationalCatalyst; public static Item itemCombinationalCatalyst;
public static Item customTool; public static Item customTool;
public static Item itemAttunedCrystal; public static Item itemAttunedCrystal;
public static Item itemTankSegmenter; public static Item itemTankSegmenter;
public static Item itemDestinationClearer; public static Item itemDestinationClearer;
public static Item bucketLife; public static Item bucketLife;
public static void init() public static void init()
@ -281,15 +215,15 @@ public class ModItems
itemTankSegmenter = new ItemTankSegmenter().setUnlocalizedName("itemTankSegmenter"); itemTankSegmenter = new ItemTankSegmenter().setUnlocalizedName("itemTankSegmenter");
itemDestinationClearer = new ItemDestinationClearer().setUnlocalizedName("destinationClearer"); itemDestinationClearer = new ItemDestinationClearer().setUnlocalizedName("destinationClearer");
} }
public static void registerItems() public static void registerItems()
{ {
GameRegistry.registerItem(ModItems.weakBloodOrb, "weakBloodOrb"); GameRegistry.registerItem(ModItems.weakBloodOrb, "weakBloodOrb");
GameRegistry.registerItem(ModItems.apprenticeBloodOrb, "apprenticeBloodOrb"); GameRegistry.registerItem(ModItems.apprenticeBloodOrb, "apprenticeBloodOrb");
GameRegistry.registerItem(ModItems.magicianBloodOrb, "magicianBloodOrb"); GameRegistry.registerItem(ModItems.magicianBloodOrb, "magicianBloodOrb");
GameRegistry.registerItem(ModItems.energyBlaster, "energyBlaster"); GameRegistry.registerItem(ModItems.energyBlaster, "energyBlaster");
GameRegistry.registerItem(ModItems.energySword, "energySword"); GameRegistry.registerItem(ModItems.energySword, "energySword");
GameRegistry.registerItem(ModItems.lavaCrystal, "lavaCrystal"); GameRegistry.registerItem(ModItems.lavaCrystal, "lavaCrystal");
GameRegistry.registerItem(ModItems.waterSigil, "waterSigil"); GameRegistry.registerItem(ModItems.waterSigil, "waterSigil");
GameRegistry.registerItem(ModItems.lavaSigil, "lavaSigil"); GameRegistry.registerItem(ModItems.lavaSigil, "lavaSigil");
@ -367,16 +301,16 @@ public class ModItems
GameRegistry.registerItem(ModItems.itemSigilOfEnderSeverance, "sigilOfEnderSeverance"); GameRegistry.registerItem(ModItems.itemSigilOfEnderSeverance, "sigilOfEnderSeverance");
GameRegistry.registerItem(ModItems.itemFluidSigil, "fluidSigil"); GameRegistry.registerItem(ModItems.itemFluidSigil, "fluidSigil");
GameRegistry.registerItem(ModItems.itemSeerSigil, "seerSigil"); GameRegistry.registerItem(ModItems.itemSeerSigil, "seerSigil");
GameRegistry.registerItem(ModItems.customTool, "customTool"); GameRegistry.registerItem(ModItems.customTool, "customTool");
GameRegistry.registerItem(ModItems.bucketLife, "bucketLife"); GameRegistry.registerItem(ModItems.bucketLife, "bucketLife");
GameRegistry.registerItem(ModItems.itemCombinationalCatalyst, "itemCombinationalCatalyst"); GameRegistry.registerItem(ModItems.itemCombinationalCatalyst, "itemCombinationalCatalyst");
GameRegistry.registerItem(ModItems.itemAttunedCrystal, "itemAttunedCrystal"); GameRegistry.registerItem(ModItems.itemAttunedCrystal, "itemAttunedCrystal");
GameRegistry.registerItem(ModItems.itemTankSegmenter, "itemTankSegmenter"); GameRegistry.registerItem(ModItems.itemTankSegmenter, "itemTankSegmenter");
GameRegistry.registerItem(ModItems.itemDestinationClearer, "itemDestinationClearer"); GameRegistry.registerItem(ModItems.itemDestinationClearer, "itemDestinationClearer");
GameRegistry.registerItem(ModItems.baseItems, "bloodMagicBaseItems"); GameRegistry.registerItem(ModItems.baseItems, "bloodMagicBaseItems");
GameRegistry.registerItem(ModItems.baseAlchemyItems, "bloodMagicBaseAlchemyItems"); GameRegistry.registerItem(ModItems.baseAlchemyItems, "bloodMagicBaseAlchemyItems");
//GameRegistry.registerItem(ModItems.itemBloodFrame, "itemBloodFrame"); //GameRegistry.registerItem(ModItems.itemBloodFrame, "itemBloodFrame");

View file

@ -2,44 +2,44 @@ package WayofTime.alchemicalWizardry.api;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
public class ColourAndCoords public class ColourAndCoords
{ {
public int colourRed; public int colourRed;
public int colourGreen; public int colourGreen;
public int colourBlue; public int colourBlue;
public int colourIntensity; public int colourIntensity;
public int xCoord; public int xCoord;
public int yCoord; public int yCoord;
public int zCoord; public int zCoord;
public ColourAndCoords(int red, int green, int blue, int intensity, int x, int y, int z) public ColourAndCoords(int red, int green, int blue, int intensity, int x, int y, int z)
{ {
this.colourRed = red; this.colourRed = red;
this.colourGreen = green; this.colourGreen = green;
this.colourBlue = blue; this.colourBlue = blue;
this.colourIntensity = intensity; this.colourIntensity = intensity;
this.xCoord = x; this.xCoord = x;
this.yCoord = y; this.yCoord = y;
this.zCoord = z; this.zCoord = z;
} }
public static ColourAndCoords readFromNBT(NBTTagCompound tag) public static ColourAndCoords readFromNBT(NBTTagCompound tag)
{ {
return new ColourAndCoords(tag.getInteger("colourRed"), tag.getInteger("colourGreen"), tag.getInteger("colourBlue"), tag.getInteger("colourIntensity"), tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord")); return new ColourAndCoords(tag.getInteger("colourRed"), tag.getInteger("colourGreen"), tag.getInteger("colourBlue"), tag.getInteger("colourIntensity"), tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord"));
} }
public NBTTagCompound writeToNBT(NBTTagCompound tag) public NBTTagCompound writeToNBT(NBTTagCompound tag)
{ {
tag.setInteger("colourRed", colourRed); tag.setInteger("colourRed", colourRed);
tag.setInteger("colourGreen", colourGreen); tag.setInteger("colourGreen", colourGreen);
tag.setInteger("colourBlue", colourBlue); tag.setInteger("colourBlue", colourBlue);
tag.setInteger("colourIntensity", colourIntensity); tag.setInteger("colourIntensity", colourIntensity);
tag.setInteger("xCoord", xCoord); tag.setInteger("xCoord", xCoord);
tag.setInteger("yCoord", yCoord); tag.setInteger("yCoord", yCoord);
tag.setInteger("zCoord", zCoord); tag.setInteger("zCoord", zCoord);
return tag; return tag;
} }
} }

View file

@ -1,9 +1,9 @@
package WayofTime.alchemicalWizardry.api.alchemy; package WayofTime.alchemicalWizardry.api.alchemy;
import java.util.ArrayList;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import java.util.ArrayList;
public class AlchemicalPotionCreationHandler public class AlchemicalPotionCreationHandler
{ {
public static ArrayList<AlchemyPotionHandlerComponent> registeredPotionEffects = new ArrayList(); public static ArrayList<AlchemyPotionHandlerComponent> registeredPotionEffects = new ArrayList();

View file

@ -104,7 +104,7 @@ public class AlchemyRecipe
continue; continue;
} }
if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) && checkedItemStack.getItem()==recipeItemStack.getItem()) if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) && checkedItemStack.getItem() == recipeItemStack.getItem())
{ {
test = true; test = true;
checkList[j] = true; checkList[j] = true;
@ -135,9 +135,9 @@ public class AlchemyRecipe
{ {
return this.recipe; return this.recipe;
} }
public int getOrbLevel() public int getOrbLevel()
{ {
return this.bloodOrbLevel; return this.bloodOrbLevel;
} }
} }

View file

@ -1,11 +1,11 @@
package WayofTime.alchemicalWizardry.api.alchemy; package WayofTime.alchemicalWizardry.api.alchemy;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import net.minecraft.item.ItemStack;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.item.ItemStack;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
public class AlchemyRecipeRegistry public class AlchemyRecipeRegistry
{ {
public static List<AlchemyRecipe> recipes = new ArrayList(); public static List<AlchemyRecipe> recipes = new ArrayList();

View file

@ -4,7 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
public interface IAlchemyGoggles public interface IAlchemyGoggles
{ {
public boolean showIngameHUD(World world, ItemStack stack, EntityPlayer player); public boolean showIngameHUD(World world, ItemStack stack, EntityPlayer player);
} }

View file

@ -1,10 +1,8 @@
package WayofTime.alchemicalWizardry.api.alchemy.energy; package WayofTime.alchemicalWizardry.api.alchemy.energy;
import net.minecraftforge.fluids.FluidTankInfo; public interface IReagentContainer
public interface IReagentContainer
{ {
public ReagentStack getReagent(); public ReagentStack getReagent();
public int getReagentStackAmount(); public int getReagentStackAmount();
@ -13,6 +11,6 @@ public interface IReagentContainer
public int fill(ReagentStack resource, boolean doFill); public int fill(ReagentStack resource, boolean doFill);
public ReagentStack drain(int maxDrain, boolean doDrain); public ReagentStack drain(int maxDrain, boolean doDrain);
public ReagentContainerInfo getInfo(); public ReagentContainerInfo getInfo();
} }

View file

@ -2,7 +2,7 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public interface IReagentHandler public interface IReagentHandler
{ {
int fill(ForgeDirection from, ReagentStack resource, boolean doFill); int fill(ForgeDirection from, ReagentStack resource, boolean doFill);

View file

@ -4,11 +4,11 @@ import java.util.Map;
public interface ISegmentedReagentHandler extends IReagentHandler public interface ISegmentedReagentHandler extends IReagentHandler
{ {
public int getNumberOfTanks(); public int getNumberOfTanks();
public int getTanksTunedToReagent(Reagent reagent); public int getTanksTunedToReagent(Reagent reagent);
public void setTanksTunedToReagent(Reagent reagent, int total); public void setTanksTunedToReagent(Reagent reagent, int total);
public Map<Reagent, Integer> getAttunedTankMap(); public Map<Reagent, Integer> getAttunedTankMap();
} }

View file

@ -1,54 +1,52 @@
package WayofTime.alchemicalWizardry.api.alchemy.energy; package WayofTime.alchemicalWizardry.api.alchemy.energy;
import net.minecraft.item.ItemStack; public class Reagent
public class Reagent
{ {
public final String name; public final String name;
public static final int REAGENT_SIZE = 1000; public static final int REAGENT_SIZE = 1000;
private int colourRed = 0; private int colourRed = 0;
private int colourGreen = 0; private int colourGreen = 0;
private int colourBlue = 0; private int colourBlue = 0;
private int colourIntensity = 255; private int colourIntensity = 255;
public Reagent(String name) public Reagent(String name)
{ {
this.name = name; this.name = name;
} }
public void setColour(int red, int green, int blue, int intensity) public void setColour(int red, int green, int blue, int intensity)
{ {
this.colourRed = red; this.colourRed = red;
this.colourGreen = green; this.colourGreen = green;
this.colourBlue = blue; this.colourBlue = blue;
this.colourIntensity = intensity; this.colourIntensity = intensity;
} }
public int getColourRed() public int getColourRed()
{ {
return colourRed; return colourRed;
} }
public int getColourGreen() public int getColourGreen()
{ {
return colourGreen; return colourGreen;
} }
public int getColourBlue() public int getColourBlue()
{ {
return colourBlue; return colourBlue;
} }
public int getColourIntensity() public int getColourIntensity()
{ {
return colourIntensity; return colourIntensity;
} }
@Override @Override
public boolean equals(Object o) public boolean equals(Object o)
{ {
return o instanceof Reagent ? this == o && name.equals(((Reagent)o).name) : false; return o instanceof Reagent ? this == o && name.equals(((Reagent) o).name) : false;
} }
} }

View file

@ -1,17 +1,13 @@
package WayofTime.alchemicalWizardry.api.alchemy.energy; package WayofTime.alchemicalWizardry.api.alchemy.energy;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
public class ReagentContainer implements IReagentContainer public class ReagentContainer implements IReagentContainer
{ {
protected ReagentStack reagentStack; protected ReagentStack reagentStack;
protected int capacity; protected int capacity;
public ReagentContainer(int capacity) public ReagentContainer(int capacity)
{ {
this(null, capacity); this(null, capacity);
} }
@ -31,13 +27,13 @@ public class ReagentContainer implements IReagentContainer
{ {
ReagentStack reagent = ReagentStack.loadReagentStackFromNBT(nbt); ReagentStack reagent = ReagentStack.loadReagentStackFromNBT(nbt);
int capacity = nbt.getInteger("capacity"); int capacity = nbt.getInteger("capacity");
if (reagent != null) if (reagent != null)
{ {
return new ReagentContainer(reagent, capacity); return new ReagentContainer(reagent, capacity);
}else } else
{ {
return new ReagentContainer(null, capacity); return new ReagentContainer(null, capacity);
} }
} }
@ -47,12 +43,12 @@ public class ReagentContainer implements IReagentContainer
{ {
reagentStack.writeToNBT(nbt); reagentStack.writeToNBT(nbt);
} }
nbt.setInteger("capacity", capacity); nbt.setInteger("capacity", capacity);
return nbt; return nbt;
} }
@Override @Override
public ReagentStack getReagent() public ReagentStack getReagent()
{ {
@ -115,8 +111,7 @@ public class ReagentContainer implements IReagentContainer
{ {
reagentStack.amount += resource.amount; reagentStack.amount += resource.amount;
filled = resource.amount; filled = resource.amount;
} } else
else
{ {
reagentStack.amount = capacity; reagentStack.amount = capacity;
} }
@ -150,9 +145,9 @@ public class ReagentContainer implements IReagentContainer
return stack; return stack;
} }
@Override @Override
public ReagentContainerInfo getInfo() public ReagentContainerInfo getInfo()
{ {
return new ReagentContainerInfo(this); return new ReagentContainerInfo(this);
} }
} }

View file

@ -1,8 +1,5 @@
package WayofTime.alchemicalWizardry.api.alchemy.energy; package WayofTime.alchemicalWizardry.api.alchemy.energy;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank;
public final class ReagentContainerInfo public final class ReagentContainerInfo
{ {
public final ReagentStack reagent; public final ReagentStack reagent;

View file

@ -1,191 +1,191 @@
package WayofTime.alchemicalWizardry.api.alchemy.energy; package WayofTime.alchemicalWizardry.api.alchemy.energy;
import WayofTime.alchemicalWizardry.ModItems;
import net.minecraft.item.ItemStack;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import net.minecraft.item.ItemStack; public class ReagentRegistry
import WayofTime.alchemicalWizardry.ModItems;
public class ReagentRegistry
{ {
public static Map<String, Reagent> reagentList = new HashMap(); public static Map<String, Reagent> reagentList = new HashMap();
public static Map<ItemStack, ReagentStack> itemToReagentMap = new HashMap(); public static Map<ItemStack, ReagentStack> itemToReagentMap = new HashMap();
public static Reagent sanctusReagent; public static Reagent sanctusReagent;
public static Reagent incendiumReagent; public static Reagent incendiumReagent;
public static Reagent aquasalusReagent; public static Reagent aquasalusReagent;
public static Reagent magicalesReagent; public static Reagent magicalesReagent;
public static Reagent aetherReagent; public static Reagent aetherReagent;
public static Reagent crepitousReagent; public static Reagent crepitousReagent;
public static Reagent crystallosReagent; public static Reagent crystallosReagent;
public static Reagent terraeReagent; public static Reagent terraeReagent;
public static Reagent tenebraeReagent; public static Reagent tenebraeReagent;
public static Reagent offensaReagent; public static Reagent offensaReagent;
public static Reagent praesidiumReagent; public static Reagent praesidiumReagent;
public static Reagent orbisTerraeReagent; public static Reagent orbisTerraeReagent;
public static Reagent virtusReagent; public static Reagent virtusReagent;
public static Reagent reductusReagent; public static Reagent reductusReagent;
public static Reagent potentiaReagent; public static Reagent potentiaReagent;
public static void initReagents() public static void initReagents()
{ {
sanctusReagent = new Reagent("sanctus"); sanctusReagent = new Reagent("sanctus");
incendiumReagent = new Reagent("incendium"); incendiumReagent = new Reagent("incendium");
aquasalusReagent = new Reagent("aquasalus"); aquasalusReagent = new Reagent("aquasalus");
magicalesReagent = new Reagent("magicales"); magicalesReagent = new Reagent("magicales");
aetherReagent = new Reagent("aether"); aetherReagent = new Reagent("aether");
crepitousReagent = new Reagent("crepitous"); crepitousReagent = new Reagent("crepitous");
crystallosReagent = new Reagent("crystallos"); crystallosReagent = new Reagent("crystallos");
terraeReagent = new Reagent("terrae"); terraeReagent = new Reagent("terrae");
tenebraeReagent = new Reagent("tenebrae"); tenebraeReagent = new Reagent("tenebrae");
offensaReagent = new Reagent("offensa"); offensaReagent = new Reagent("offensa");
praesidiumReagent = new Reagent("praesidium"); praesidiumReagent = new Reagent("praesidium");
orbisTerraeReagent = new Reagent("orbisTerrae"); orbisTerraeReagent = new Reagent("orbisTerrae");
virtusReagent = new Reagent("virtus"); virtusReagent = new Reagent("virtus");
reductusReagent = new Reagent("reductus"); reductusReagent = new Reagent("reductus");
potentiaReagent = new Reagent("potentia"); potentiaReagent = new Reagent("potentia");
sanctusReagent.setColour(255, 255, 0, 255); sanctusReagent.setColour(255, 255, 0, 255);
incendiumReagent.setColour(255, 0, 0, 255); incendiumReagent.setColour(255, 0, 0, 255);
aquasalusReagent.setColour(47, 0, 196, 255); aquasalusReagent.setColour(47, 0, 196, 255);
magicalesReagent.setColour(150, 0, 146, 255); magicalesReagent.setColour(150, 0, 146, 255);
aetherReagent.setColour(105, 223, 86, 255); aetherReagent.setColour(105, 223, 86, 255);
crepitousReagent.setColour(145, 145, 145, 255); crepitousReagent.setColour(145, 145, 145, 255);
crystallosReagent.setColour(135, 255, 231, 255); crystallosReagent.setColour(135, 255, 231, 255);
terraeReagent.setColour(147, 48, 13, 255); terraeReagent.setColour(147, 48, 13, 255);
tenebraeReagent.setColour(86, 86, 86, 255); tenebraeReagent.setColour(86, 86, 86, 255);
offensaReagent.setColour(126, 0, 0, 255); offensaReagent.setColour(126, 0, 0, 255);
praesidiumReagent.setColour(135, 135, 135, 255); praesidiumReagent.setColour(135, 135, 135, 255);
orbisTerraeReagent.setColour(32, 94, 14, 255); orbisTerraeReagent.setColour(32, 94, 14, 255);
virtusReagent.setColour(180, 0, 0, 255); virtusReagent.setColour(180, 0, 0, 255);
reductusReagent.setColour(20, 93, 2, 255); reductusReagent.setColour(20, 93, 2, 255);
potentiaReagent.setColour(64, 81, 208, 255); potentiaReagent.setColour(64, 81, 208, 255);
registerReagent("sanctus", sanctusReagent); registerReagent("sanctus", sanctusReagent);
registerReagent("incendium", incendiumReagent); registerReagent("incendium", incendiumReagent);
registerReagent("aquasalus", aquasalusReagent); registerReagent("aquasalus", aquasalusReagent);
registerReagent("magicales", magicalesReagent); registerReagent("magicales", magicalesReagent);
registerReagent("aether", aetherReagent); registerReagent("aether", aetherReagent);
registerReagent("crepitous", crepitousReagent); registerReagent("crepitous", crepitousReagent);
registerReagent("crystallos", crystallosReagent); registerReagent("crystallos", crystallosReagent);
registerReagent("terrae", terraeReagent); registerReagent("terrae", terraeReagent);
registerReagent("tenebrae", tenebraeReagent); registerReagent("tenebrae", tenebraeReagent);
registerReagent("offensa", offensaReagent); registerReagent("offensa", offensaReagent);
registerReagent("praesidium", praesidiumReagent); registerReagent("praesidium", praesidiumReagent);
registerReagent("orbisTerrae", orbisTerraeReagent); registerReagent("orbisTerrae", orbisTerraeReagent);
registerReagent("virtus", virtusReagent); registerReagent("virtus", virtusReagent);
registerReagent("reductus", reductusReagent); registerReagent("reductus", reductusReagent);
registerReagent("potentia", potentiaReagent); registerReagent("potentia", potentiaReagent);
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.sanctus), new ReagentStack(sanctusReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.sanctus), new ReagentStack(sanctusReagent, 1000));
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.incendium), new ReagentStack(incendiumReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.incendium), new ReagentStack(incendiumReagent, 1000));
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.aquasalus), new ReagentStack(aquasalusReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.aquasalus), new ReagentStack(aquasalusReagent, 1000));
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.magicales), new ReagentStack(magicalesReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.magicales), new ReagentStack(magicalesReagent, 1000));
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.aether), new ReagentStack(aetherReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.aether), new ReagentStack(aetherReagent, 1000));
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.crepitous), new ReagentStack(crepitousReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.crepitous), new ReagentStack(crepitousReagent, 1000));
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.crystallos), new ReagentStack(crystallosReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.crystallos), new ReagentStack(crystallosReagent, 1000));
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.terrae), new ReagentStack(terraeReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.terrae), new ReagentStack(terraeReagent, 1000));
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.tennebrae), new ReagentStack(tenebraeReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.tennebrae), new ReagentStack(tenebraeReagent, 1000));
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.baseAlchemyItems,1,0), new ReagentStack(offensaReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.baseAlchemyItems, 1, 0), new ReagentStack(offensaReagent, 1000));
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.baseAlchemyItems,1,1), new ReagentStack(praesidiumReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.baseAlchemyItems, 1, 1), new ReagentStack(praesidiumReagent, 1000));
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.baseAlchemyItems,1,2), new ReagentStack(orbisTerraeReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.baseAlchemyItems, 1, 2), new ReagentStack(orbisTerraeReagent, 1000));
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.baseAlchemyItems,1,6), new ReagentStack(virtusReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.baseAlchemyItems, 1, 6), new ReagentStack(virtusReagent, 1000));
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.baseAlchemyItems,1,7), new ReagentStack(reductusReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.baseAlchemyItems, 1, 7), new ReagentStack(reductusReagent, 1000));
ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.baseAlchemyItems,1,8), new ReagentStack(potentiaReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.baseAlchemyItems, 1, 8), new ReagentStack(potentiaReagent, 1000));
} }
public static boolean registerReagent(String key, Reagent reagent) public static boolean registerReagent(String key, Reagent reagent)
{ {
if(reagentList.containsKey(key) || reagent == null) if (reagentList.containsKey(key) || reagent == null)
{ {
return false; return false;
} }
reagentList.put(key, reagent); reagentList.put(key, reagent);
return true; return true;
} }
public static Reagent getReagentForKey(String key) public static Reagent getReagentForKey(String key)
{ {
if(reagentList.containsKey(key)) if (reagentList.containsKey(key))
{ {
return reagentList.get(key); return reagentList.get(key);
} }
return null; return null;
} }
public static String getKeyForReagent(Reagent reagent) public static String getKeyForReagent(Reagent reagent)
{ {
if(reagentList.containsValue(reagent)) if (reagentList.containsValue(reagent))
{ {
Set<Entry<String, Reagent>> set = reagentList.entrySet(); Set<Entry<String, Reagent>> set = reagentList.entrySet();
for(Entry<String, Reagent> entry : set) for (Entry<String, Reagent> entry : set)
{ {
if(entry.getValue().equals(reagent)) if (entry.getValue().equals(reagent))
{ {
return entry.getKey(); return entry.getKey();
} }
} }
} }
return ""; return "";
} }
public static void registerItemAndReagent(ItemStack stack, ReagentStack reagentStack) public static void registerItemAndReagent(ItemStack stack, ReagentStack reagentStack)
{ {
itemToReagentMap.put(stack, reagentStack); itemToReagentMap.put(stack, reagentStack);
} }
public static ReagentStack getReagentStackForItem(ItemStack stack) public static ReagentStack getReagentStackForItem(ItemStack stack)
{ {
if(stack == null) if (stack == null)
{ {
return null; return null;
} }
for(Entry<ItemStack, ReagentStack> entry : itemToReagentMap.entrySet()) for (Entry<ItemStack, ReagentStack> entry : itemToReagentMap.entrySet())
{ {
if(entry.getKey() != null && entry.getKey().isItemEqual(stack)) if (entry.getKey() != null && entry.getKey().isItemEqual(stack))
{ {
if(entry.getValue() == null) if (entry.getValue() == null)
{ {
return null; return null;
}else } else
{ {
return entry.getValue().copy(); return entry.getValue().copy();
} }
} }
} }
return null; return null;
} }
public static ItemStack getItemForReagent(Reagent reagent) public static ItemStack getItemForReagent(Reagent reagent)
{ {
if(reagent == null) if (reagent == null)
{ {
return null; return null;
} }
for(Entry<ItemStack, ReagentStack> entry : itemToReagentMap.entrySet()) for (Entry<ItemStack, ReagentStack> entry : itemToReagentMap.entrySet())
{ {
if(entry.getValue() != null && entry.getValue().reagent == reagent) if (entry.getValue() != null && entry.getValue().reagent == reagent)
{ {
if(entry.getKey() == null) if (entry.getKey() == null)
{ {
return null; return null;
}else } else
{ {
return entry.getKey().copy(); return entry.getKey().copy();
} }
} }
} }
return null; return null;
} }
} }

View file

@ -1,63 +1,62 @@
package WayofTime.alchemicalWizardry.api.alchemy.energy; package WayofTime.alchemicalWizardry.api.alchemy.energy;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
public class ReagentStack public class ReagentStack
{ {
public Reagent reagent; public Reagent reagent;
public int amount; public int amount;
public ReagentStack(Reagent reagent, int amount)
{
this.reagent = reagent;
this.amount = amount;
}
public ReagentStack(ReagentStack reagentStack, int amount) public ReagentStack(Reagent reagent, int amount)
{ {
this(reagentStack.reagent,amount); this.reagent = reagent;
} this.amount = amount;
}
public static ReagentStack loadReagentStackFromNBT(NBTTagCompound tag) public ReagentStack(ReagentStack reagentStack, int amount)
{ {
Reagent reagent = ReagentRegistry.getReagentForKey(tag.getString("Reagent")); this(reagentStack.reagent, amount);
}
if(reagent == null)
{ public static ReagentStack loadReagentStackFromNBT(NBTTagCompound tag)
return null; {
} Reagent reagent = ReagentRegistry.getReagentForKey(tag.getString("Reagent"));
int amount = tag.getInteger("amount"); if (reagent == null)
ReagentStack stack = new ReagentStack(reagent, amount); {
return null;
return stack; }
}
int amount = tag.getInteger("amount");
public NBTTagCompound writeToNBT(NBTTagCompound tag) ReagentStack stack = new ReagentStack(reagent, amount);
{
tag.setString("Reagent", ReagentRegistry.getKeyForReagent(this.reagent)); return stack;
tag.setInteger("amount", this.amount); }
return tag; public NBTTagCompound writeToNBT(NBTTagCompound tag)
} {
tag.setString("Reagent", ReagentRegistry.getKeyForReagent(this.reagent));
public ReagentStack splitStack(int amount) tag.setInteger("amount", this.amount);
{
ReagentStack copyStack = this.copy(); return tag;
int splitAmount = Math.min(amount, this.amount); }
copyStack.amount = splitAmount;
this.amount -= splitAmount; public ReagentStack splitStack(int amount)
{
return copyStack; ReagentStack copyStack = this.copy();
} int splitAmount = Math.min(amount, this.amount);
copyStack.amount = splitAmount;
public ReagentStack copy() this.amount -= splitAmount;
{
return new ReagentStack(this.reagent, this.amount); return copyStack;
} }
public boolean isReagentEqual(ReagentStack other) public ReagentStack copy()
{
return new ReagentStack(this.reagent, this.amount);
}
public boolean isReagentEqual(ReagentStack other)
{ {
return other != null && this.reagent == other.reagent; return other != null && this.reagent == other.reagent;
} }

View file

@ -4,8 +4,6 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.IFluidHandler;
public class TileReagentHandler extends TileEntity implements IReagentHandler public class TileReagentHandler extends TileEntity implements IReagentHandler
{ {
@ -63,6 +61,6 @@ public class TileReagentHandler extends TileEntity implements IReagentHandler
@Override @Override
public ReagentContainerInfo[] getContainerInfo(ForgeDirection from) public ReagentContainerInfo[] getContainerInfo(ForgeDirection from)
{ {
return new ReagentContainerInfo[] {tank.getInfo()}; return new ReagentContainerInfo[]{tank.getInfo()};
} }
} }

View file

@ -1,16 +1,16 @@
package WayofTime.alchemicalWizardry.api.alchemy.energy; package WayofTime.alchemicalWizardry.api.alchemy.energy;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class TileSegmentedReagentHandler extends TileEntity implements ISegmentedReagentHandler public class TileSegmentedReagentHandler extends TileEntity implements ISegmentedReagentHandler
{ {
protected ReagentContainer[] tanks; protected ReagentContainer[] tanks;
@ -18,49 +18,49 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
public TileSegmentedReagentHandler() public TileSegmentedReagentHandler()
{ {
this(1); this(1);
} }
public TileSegmentedReagentHandler(int numberOfTanks) public TileSegmentedReagentHandler(int numberOfTanks)
{ {
this(numberOfTanks, 1000); this(numberOfTanks, 1000);
} }
public TileSegmentedReagentHandler(int numberOfTanks, int tankSize) public TileSegmentedReagentHandler(int numberOfTanks, int tankSize)
{ {
super(); super();
this.attunedTankMap = new HashMap(); this.attunedTankMap = new HashMap();
this.tanks = new ReagentContainer[numberOfTanks]; this.tanks = new ReagentContainer[numberOfTanks];
for(int i=0; i<numberOfTanks; i++) for (int i = 0; i < numberOfTanks; i++)
{ {
this.tanks[i] = new ReagentContainer(tankSize); this.tanks[i] = new ReagentContainer(tankSize);
} }
} }
@Override @Override
public void readFromNBT(NBTTagCompound tag) public void readFromNBT(NBTTagCompound tag)
{ {
super.readFromNBT(tag); super.readFromNBT(tag);
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND); NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
int size = tagList.tagCount(); int size = tagList.tagCount();
this.tanks = new ReagentContainer[size]; this.tanks = new ReagentContainer[size];
for(int i=0; i<size; i++) for (int i = 0; i < size; i++)
{ {
NBTTagCompound savedTag = tagList.getCompoundTagAt(i); NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
this.tanks[i] = ReagentContainer.readFromNBT(savedTag); this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
} }
NBTTagList attunedTagList = tag.getTagList("attunedTankMap", Constants.NBT.TAG_COMPOUND); NBTTagList attunedTagList = tag.getTagList("attunedTankMap", Constants.NBT.TAG_COMPOUND);
for(int i=0; i<attunedTagList.tagCount(); i++) for (int i = 0; i < attunedTagList.tagCount(); i++)
{ {
NBTTagCompound savedTag = attunedTagList.getCompoundTagAt(i); NBTTagCompound savedTag = attunedTagList.getCompoundTagAt(i);
Reagent reagent = ReagentRegistry.getReagentForKey(savedTag.getString("reagent")); Reagent reagent = ReagentRegistry.getReagentForKey(savedTag.getString("reagent"));
this.attunedTankMap.put(reagent, savedTag.getInteger("amount")); this.attunedTankMap.put(reagent, savedTag.getInteger("amount"));
} }
} }
@ -70,29 +70,29 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
super.writeToNBT(tag); super.writeToNBT(tag);
NBTTagList tagList = new NBTTagList(); NBTTagList tagList = new NBTTagList();
for(int i=0; i<this.tanks.length; i++) for (int i = 0; i < this.tanks.length; i++)
{ {
NBTTagCompound savedTag = new NBTTagCompound(); NBTTagCompound savedTag = new NBTTagCompound();
if(this.tanks[i] != null) if (this.tanks[i] != null)
{ {
this.tanks[i].writeToNBT(savedTag); this.tanks[i].writeToNBT(savedTag);
} }
tagList.appendTag(savedTag); tagList.appendTag(savedTag);
} }
tag.setTag("reagentTanks", tagList); tag.setTag("reagentTanks", tagList);
NBTTagList attunedTagList = new NBTTagList(); NBTTagList attunedTagList = new NBTTagList();
for(Entry<Reagent, Integer> entry : this.attunedTankMap.entrySet()) for (Entry<Reagent, Integer> entry : this.attunedTankMap.entrySet())
{ {
NBTTagCompound savedTag = new NBTTagCompound(); NBTTagCompound savedTag = new NBTTagCompound();
savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey())); savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey()));
savedTag.setInteger("amount", entry.getValue()); savedTag.setInteger("amount", entry.getValue());
attunedTagList.appendTag(savedTag); attunedTagList.appendTag(savedTag);
} }
tag.setTag("attunedTankMap", attunedTagList); tag.setTag("attunedTankMap", attunedTagList);
} }
@ -100,98 +100,98 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
@Override @Override
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
{ {
int totalFill = 0; int totalFill = 0;
boolean useTankLimit = !this.attunedTankMap.isEmpty();
if(resource != null)
{
int totalTanksFillable = useTankLimit ? this.getTanksTunedToReagent(resource.reagent) : this.tanks.length;
int tanksFilled = 0;
int maxFill = resource.amount; boolean useTankLimit = !this.attunedTankMap.isEmpty();
for(int i=this.tanks.length-1; i>=0; i--) if (resource != null)
{ {
ReagentStack remainingStack = resource.copy(); int totalTanksFillable = useTankLimit ? this.getTanksTunedToReagent(resource.reagent) : this.tanks.length;
remainingStack.amount = maxFill - totalFill; int tanksFilled = 0;
boolean doesReagentMatch = tanks[i].getReagent() == null ? false : tanks[i].getReagent().isReagentEqual(remainingStack); int maxFill = resource.amount;
if(doesReagentMatch) for (int i = this.tanks.length - 1; i >= 0; i--)
{ {
totalFill += tanks[i].fill(remainingStack, doFill); ReagentStack remainingStack = resource.copy();
tanksFilled++; remainingStack.amount = maxFill - totalFill;
}else
{ boolean doesReagentMatch = tanks[i].getReagent() == null ? false : tanks[i].getReagent().isReagentEqual(remainingStack);
continue;
} if (doesReagentMatch)
{
if(totalFill >= maxFill || tanksFilled >= totalTanksFillable) totalFill += tanks[i].fill(remainingStack, doFill);
{ tanksFilled++;
return totalFill; } else
} {
} continue;
}
if(tanksFilled >= totalTanksFillable)
{ if (totalFill >= maxFill || tanksFilled >= totalTanksFillable)
return totalFill; {
} return totalFill;
}
for(int i=this.tanks.length-1; i>=0; i--) }
{
ReagentStack remainingStack = resource.copy(); if (tanksFilled >= totalTanksFillable)
remainingStack.amount = maxFill - totalFill; {
return totalFill;
boolean isTankEmpty = tanks[i].getReagent() == null; }
if(isTankEmpty) for (int i = this.tanks.length - 1; i >= 0; i--)
{ {
totalFill += tanks[i].fill(remainingStack, doFill); ReagentStack remainingStack = resource.copy();
tanksFilled++; remainingStack.amount = maxFill - totalFill;
}else
{ boolean isTankEmpty = tanks[i].getReagent() == null;
continue;
} if (isTankEmpty)
{
if(totalFill >= maxFill || tanksFilled >= totalTanksFillable) totalFill += tanks[i].fill(remainingStack, doFill);
{ tanksFilled++;
return totalFill; } else
} {
} continue;
} }
if (totalFill >= maxFill || tanksFilled >= totalTanksFillable)
{
return totalFill;
}
}
}
return totalFill; return totalFill;
} }
@Override @Override
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain) public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
{ {
if(resource == null) if (resource == null)
{ {
return null; return null;
} }
int maxDrain = resource.amount; int maxDrain = resource.amount;
Reagent reagent = resource.reagent; Reagent reagent = resource.reagent;
int drained = 0; int drained = 0;
for(int i=0; i<tanks.length; i++) for (int i = 0; i < tanks.length; i++)
{ {
if(drained >= maxDrain) if (drained >= maxDrain)
{
break;
}
if(resource.isReagentEqual(tanks[i].getReagent()))
{ {
ReagentStack drainStack = tanks[i].drain(maxDrain-drained, doDrain); break;
if(drainStack != null)
{
drained += drainStack.amount;
}
} }
}
if (resource.isReagentEqual(tanks[i].getReagent()))
{
ReagentStack drainStack = tanks[i].drain(maxDrain - drained, doDrain);
if (drainStack != null)
{
drained += drainStack.amount;
}
}
}
return new ReagentStack(reagent, drained); return new ReagentStack(reagent, drained);
} }
@ -199,16 +199,16 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
@Override @Override
public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain) public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{ {
for(int i=0; i<tanks.length; i++) for (int i = 0; i < tanks.length; i++)
{ {
ReagentStack stack = tanks[i].drain(maxDrain, doDrain); ReagentStack stack = tanks[i].drain(maxDrain, doDrain);
if(stack != null) if (stack != null)
{ {
return stack; return stack;
} }
} }
return null; return null;
} }
@Override @Override
@ -226,58 +226,58 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
@Override @Override
public ReagentContainerInfo[] getContainerInfo(ForgeDirection from) public ReagentContainerInfo[] getContainerInfo(ForgeDirection from)
{ {
ReagentContainerInfo[] info = new ReagentContainerInfo[this.getNumberOfTanks()]; ReagentContainerInfo[] info = new ReagentContainerInfo[this.getNumberOfTanks()];
for(int i=0; i<this.getNumberOfTanks(); i++) for (int i = 0; i < this.getNumberOfTanks(); i++)
{ {
info[i] = tanks[i].getInfo(); info[i] = tanks[i].getInfo();
} }
return info; return info;
} }
@Override @Override
public int getNumberOfTanks() public int getNumberOfTanks()
{ {
return tanks.length; return tanks.length;
} }
@Override @Override
public int getTanksTunedToReagent(Reagent reagent) public int getTanksTunedToReagent(Reagent reagent)
{ {
if(this.attunedTankMap.containsKey(reagent) && this.attunedTankMap.get(reagent) != null) if (this.attunedTankMap.containsKey(reagent) && this.attunedTankMap.get(reagent) != null)
{ {
return this.attunedTankMap.get(reagent); return this.attunedTankMap.get(reagent);
} }
return 0; return 0;
} }
@Override @Override
public void setTanksTunedToReagent(Reagent reagent, int total) public void setTanksTunedToReagent(Reagent reagent, int total)
{ {
if(total == 0 && this.attunedTankMap.containsKey(reagent)) if (total == 0 && this.attunedTankMap.containsKey(reagent))
{ {
this.attunedTankMap.remove(reagent); this.attunedTankMap.remove(reagent);
return; return;
} }
this.attunedTankMap.put(reagent, new Integer(total));
}
@Override this.attunedTankMap.put(reagent, new Integer(total));
public Map<Reagent, Integer> getAttunedTankMap() }
{
return this.attunedTankMap; @Override
} public Map<Reagent, Integer> getAttunedTankMap()
{
public boolean areTanksEmpty() return this.attunedTankMap;
{ }
for(int i=0; i<this.tanks.length; i++)
{ public boolean areTanksEmpty()
if(tanks[i] != null && tanks[i].reagentStack != null) {
{ for (int i = 0; i < this.tanks.length; i++)
return false; {
} if (tanks[i] != null && tanks[i].reagentStack != null)
} {
return false;
return true; }
} }
return true;
}
} }

View file

@ -2,69 +2,69 @@ package WayofTime.alchemicalWizardry.api.altarRecipeRegistry;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class AltarRecipe public class AltarRecipe
{ {
public int minTier; public int minTier;
public int liquidRequired; public int liquidRequired;
public boolean canBeFilled; //Tells the system that the item is an orb public boolean canBeFilled; //Tells the system that the item is an orb
public int consumptionRate; public int consumptionRate;
public int drainRate; public int drainRate;
public ItemStack requiredItem; public ItemStack requiredItem;
public ItemStack result; public ItemStack result;
public AltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled) public AltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled)
{ {
this.result = result; this.result = result;
this.requiredItem = requiredItem; this.requiredItem = requiredItem;
this.minTier = minTier; this.minTier = minTier;
this.liquidRequired = liquidRequired; this.liquidRequired = liquidRequired;
this.consumptionRate = consumptionRate; this.consumptionRate = consumptionRate;
this.drainRate = drainRate; this.drainRate = drainRate;
this.canBeFilled = canBeFilled; this.canBeFilled = canBeFilled;
} }
public ItemStack getResult() public ItemStack getResult()
{ {
return this.result; return this.result;
} }
public ItemStack getRequiredItem() public ItemStack getRequiredItem()
{ {
return this.requiredItem; return this.requiredItem;
} }
public boolean doesRequiredItemMatch(ItemStack comparedStack, int tierCheck) public boolean doesRequiredItemMatch(ItemStack comparedStack, int tierCheck)
{ {
if(comparedStack == null || this.requiredItem == null) if (comparedStack == null || this.requiredItem == null)
{ {
return false; return false;
} }
return tierCheck>=minTier && this.requiredItem.isItemEqual(comparedStack); return tierCheck >= minTier && this.requiredItem.isItemEqual(comparedStack);
} }
public int getMinTier() public int getMinTier()
{ {
return this.minTier; return this.minTier;
} }
public int getLiquidRequired() public int getLiquidRequired()
{ {
return this.liquidRequired; return this.liquidRequired;
} }
public int getConsumptionRate() public int getConsumptionRate()
{ {
return this.consumptionRate; return this.consumptionRate;
} }
public int getDrainRate() public int getDrainRate()
{ {
return this.drainRate; return this.drainRate;
} }
public boolean getCanBeFilled() public boolean getCanBeFilled()
{ {
return this.canBeFilled; return this.canBeFilled;
} }
} }

View file

@ -1,60 +1,60 @@
package WayofTime.alchemicalWizardry.api.altarRecipeRegistry; package WayofTime.alchemicalWizardry.api.altarRecipeRegistry;
import net.minecraft.item.ItemStack;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import net.minecraft.item.ItemStack; public class AltarRecipeRegistry
public class AltarRecipeRegistry
{ {
public static List<AltarRecipe> altarRecipes = new LinkedList(); public static List<AltarRecipe> altarRecipes = new LinkedList();
public static void registerAltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled) public static void registerAltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled)
{ {
altarRecipes.add(new AltarRecipe(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled)); altarRecipes.add(new AltarRecipe(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled));
} }
public static void registerAltarOrbRecipe(ItemStack orbStack, int minTier, int consumptionRate) public static void registerAltarOrbRecipe(ItemStack orbStack, int minTier, int consumptionRate)
{ {
registerAltarRecipe(null, orbStack, minTier, 0, consumptionRate, 0, true); registerAltarRecipe(null, orbStack, minTier, 0, consumptionRate, 0, true);
} }
public static boolean isRequiredItemValid(ItemStack testItem, int currentTierAltar) public static boolean isRequiredItemValid(ItemStack testItem, int currentTierAltar)
{ {
for(AltarRecipe recipe : altarRecipes) for (AltarRecipe recipe : altarRecipes)
{ {
if(recipe.doesRequiredItemMatch(testItem, currentTierAltar)) if (recipe.doesRequiredItemMatch(testItem, currentTierAltar))
{ {
return true; return true;
} }
} }
return false; return false;
} }
public static ItemStack getItemForItemAndTier(ItemStack testItem, int currentTierAltar) public static ItemStack getItemForItemAndTier(ItemStack testItem, int currentTierAltar)
{ {
for(AltarRecipe recipe : altarRecipes) for (AltarRecipe recipe : altarRecipes)
{ {
if(recipe.doesRequiredItemMatch(testItem, currentTierAltar)) if (recipe.doesRequiredItemMatch(testItem, currentTierAltar))
{ {
return ItemStack.copyItemStack(recipe.getResult()); return ItemStack.copyItemStack(recipe.getResult());
} }
} }
return null; return null;
} }
public static AltarRecipe getAltarRecipeForItemAndTier(ItemStack testItem, int currentTierAltar) public static AltarRecipe getAltarRecipeForItemAndTier(ItemStack testItem, int currentTierAltar)
{ {
for(AltarRecipe recipe : altarRecipes) for (AltarRecipe recipe : altarRecipes)
{ {
if(recipe.doesRequiredItemMatch(testItem, currentTierAltar)) if (recipe.doesRequiredItemMatch(testItem, currentTierAltar))
{ {
return recipe; return recipe;
} }
} }
return null; return null;
} }
} }

View file

@ -2,34 +2,34 @@ package WayofTime.alchemicalWizardry.api.bindingRegistry;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class BindingRecipe public class BindingRecipe
{ {
public ItemStack requiredItem; public ItemStack requiredItem;
public ItemStack outputItem; public ItemStack outputItem;
public BindingRecipe(ItemStack outputItem, ItemStack requiredItem) public BindingRecipe(ItemStack outputItem, ItemStack requiredItem)
{ {
this.requiredItem = requiredItem; this.requiredItem = requiredItem;
this.outputItem = outputItem; this.outputItem = outputItem;
} }
public boolean doesRequiredItemMatch(ItemStack testStack) public boolean doesRequiredItemMatch(ItemStack testStack)
{ {
if(testStack == null || this.requiredItem == null) if (testStack == null || this.requiredItem == null)
{ {
return false; return false;
} }
return this.requiredItem.isItemEqual(testStack); return this.requiredItem.isItemEqual(testStack);
} }
public ItemStack getResult(ItemStack inputItem) public ItemStack getResult(ItemStack inputItem)
{ {
return this.getResult(); return this.getResult();
} }
public ItemStack getResult() public ItemStack getResult()
{ {
return this.outputItem; return this.outputItem;
} }
} }

View file

@ -1,67 +1,67 @@
package WayofTime.alchemicalWizardry.api.bindingRegistry; package WayofTime.alchemicalWizardry.api.bindingRegistry;
import net.minecraft.item.ItemStack;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import net.minecraft.item.ItemStack; public class BindingRegistry
public class BindingRegistry
{ {
public static List<BindingRecipe> bindingRecipes = new LinkedList(); public static List<BindingRecipe> bindingRecipes = new LinkedList();
public static void registerRecipe(ItemStack output, ItemStack input) public static void registerRecipe(ItemStack output, ItemStack input)
{ {
bindingRecipes.add(new BindingRecipe(output, input)); bindingRecipes.add(new BindingRecipe(output, input));
} }
public static boolean isRequiredItemValid(ItemStack testItem) public static boolean isRequiredItemValid(ItemStack testItem)
{ {
for(BindingRecipe recipe : bindingRecipes) for (BindingRecipe recipe : bindingRecipes)
{ {
if(recipe.doesRequiredItemMatch(testItem)) if (recipe.doesRequiredItemMatch(testItem))
{ {
return true; return true;
} }
} }
return false; return false;
} }
public static ItemStack getItemForItemAndTier(ItemStack testItem) public static ItemStack getItemForItemAndTier(ItemStack testItem)
{ {
for(BindingRecipe recipe : bindingRecipes) for (BindingRecipe recipe : bindingRecipes)
{ {
if(recipe.doesRequiredItemMatch(testItem)) if (recipe.doesRequiredItemMatch(testItem))
{ {
return recipe.getResult(testItem).copy(); return recipe.getResult(testItem).copy();
} }
} }
return null; return null;
} }
public static int getIndexForItem(ItemStack testItem) public static int getIndexForItem(ItemStack testItem)
{ {
int i=0; int i = 0;
for(BindingRecipe recipe : bindingRecipes) for (BindingRecipe recipe : bindingRecipes)
{ {
if(recipe.doesRequiredItemMatch(testItem)) if (recipe.doesRequiredItemMatch(testItem))
{ {
return i; return i;
} }
i++; i++;
} }
return -1; return -1;
} }
public static ItemStack getOutputForIndex(int index) public static ItemStack getOutputForIndex(int index)
{ {
if(bindingRecipes.size()<=index) if (bindingRecipes.size() <= index)
{ {
return null; return null;
} }
return bindingRecipes.get(index).getResult(); return bindingRecipes.get(index).getResult();
} }
} }

View file

@ -1,33 +1,33 @@
package WayofTime.alchemicalWizardry.api.harvest; package WayofTime.alchemicalWizardry.api.harvest;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.world.World; import net.minecraft.world.World;
public class HarvestRegistry import java.util.ArrayList;
import java.util.List;
public class HarvestRegistry
{ {
public static List<IHarvestHandler> handlerList = new ArrayList(); public static List<IHarvestHandler> handlerList = new ArrayList();
public static void registerHarvestHandler(IHarvestHandler handler) public static void registerHarvestHandler(IHarvestHandler handler)
{ {
handlerList.add(handler); handlerList.add(handler);
} }
public static boolean harvestBlock(World world, int xCoord, int yCoord, int zCoord) public static boolean harvestBlock(World world, int xCoord, int yCoord, int zCoord)
{ {
Block block = world.getBlock(xCoord, yCoord, zCoord); Block block = world.getBlock(xCoord, yCoord, zCoord);
int meta = world.getBlockMetadata(xCoord, yCoord, zCoord); int meta = world.getBlockMetadata(xCoord, yCoord, zCoord);
for(IHarvestHandler handler : handlerList) for (IHarvestHandler handler : handlerList)
{ {
if(handler.harvestAndPlant(world, xCoord, yCoord, zCoord, block, meta)) if (handler.harvestAndPlant(world, xCoord, yCoord, zCoord, block, meta))
{ {
return true; return true;
} }
} }
return false; return false;
} }
} }

View file

@ -2,20 +2,19 @@ package WayofTime.alchemicalWizardry.api.harvest;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
public interface IHarvestHandler public interface IHarvestHandler
{ {
/** /**
* A handler that is used to harvest and replant the block at the specified location * A handler that is used to harvest and replant the block at the specified location
* *
* @param world * @param world
* @param xCoord * @param xCoord
* @param yCoord * @param yCoord
* @param zCoord * @param zCoord
* @param block block at this given location * @param block block at this given location
* @param meta meta at this given location * @param meta meta at this given location
* @return true if successfully harvested, false if not * @return true if successfully harvested, false if not
*/ */
public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta); public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta);
} }

View file

@ -1,11 +1,6 @@
package WayofTime.alchemicalWizardry.api.items; package WayofTime.alchemicalWizardry.api.items;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -14,214 +9,273 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
/** Shaped Blood Orb Recipe Handler by joshie **/ import java.util.ArrayList;
public class ShapedBloodOrbRecipe implements IRecipe { import java.util.HashMap;
private static final int MAX_CRAFT_GRID_WIDTH = 3; import java.util.Iterator;
private static final int MAX_CRAFT_GRID_HEIGHT = 3; import java.util.Map;
import java.util.Map.Entry;
private ItemStack output = null; /**
private Object[] input = null; * Shaped Blood Orb Recipe Handler by joshie *
public int width = 0; */
public int height = 0; public class ShapedBloodOrbRecipe implements IRecipe
private boolean mirrored = true; {
private static final int MAX_CRAFT_GRID_WIDTH = 3;
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
public ShapedBloodOrbRecipe(Block result, Object... recipe) { private ItemStack output = null;
this(new ItemStack(result), recipe); private Object[] input = null;
} public int width = 0;
public int height = 0;
private boolean mirrored = true;
public ShapedBloodOrbRecipe(Item result, Object... recipe) { public ShapedBloodOrbRecipe(Block result, Object... recipe)
this(new ItemStack(result), recipe); {
} this(new ItemStack(result), recipe);
}
public ShapedBloodOrbRecipe(ItemStack result, Object... recipe) { public ShapedBloodOrbRecipe(Item result, Object... recipe)
output = result.copy(); {
this(new ItemStack(result), recipe);
}
String shape = ""; public ShapedBloodOrbRecipe(ItemStack result, Object... recipe)
int idx = 0; {
output = result.copy();
if (recipe[idx] instanceof Boolean) { String shape = "";
mirrored = (Boolean) recipe[idx]; int idx = 0;
if (recipe[idx + 1] instanceof Object[]) {
recipe = (Object[]) recipe[idx + 1];
} else {
idx = 1;
}
}
if (recipe[idx] instanceof String[]) { if (recipe[idx] instanceof Boolean)
String[] parts = ((String[]) recipe[idx++]); {
mirrored = (Boolean) recipe[idx];
if (recipe[idx + 1] instanceof Object[])
{
recipe = (Object[]) recipe[idx + 1];
} else
{
idx = 1;
}
}
for (String s : parts) { if (recipe[idx] instanceof String[])
width = s.length(); {
shape += s; String[] parts = ((String[]) recipe[idx++]);
}
height = parts.length; for (String s : parts)
} else { {
while (recipe[idx] instanceof String) { width = s.length();
String s = (String) recipe[idx++]; shape += s;
shape += s; }
width = s.length();
height++;
}
}
if (width * height != shape.length()) { height = parts.length;
String ret = "Invalid shaped ore recipe: "; } else
for (Object tmp : recipe) { {
ret += tmp + ", "; while (recipe[idx] instanceof String)
} {
ret += output; String s = (String) recipe[idx++];
throw new RuntimeException(ret); shape += s;
} width = s.length();
height++;
}
}
HashMap<Character, Object> itemMap = new HashMap<Character, Object>(); if (width * height != shape.length())
{
String ret = "Invalid shaped ore recipe: ";
for (Object tmp : recipe)
{
ret += tmp + ", ";
}
ret += output;
throw new RuntimeException(ret);
}
for (; idx < recipe.length; idx += 2) { HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
Character chr = (Character) recipe[idx];
Object in = recipe[idx + 1];
if (in instanceof IBloodOrb || (in instanceof ItemStack && ((ItemStack)in).getItem() instanceof IBloodOrb)) { //If the item is an instanceof IBloodOrb then save the level of the orb for (; idx < recipe.length; idx += 2)
if(in instanceof ItemStack) itemMap.put(chr, (Integer)(((IBloodOrb)((ItemStack)in).getItem()).getOrbLevel())); {
else itemMap.put(chr, (Integer)(((IBloodOrb)in).getOrbLevel())); Character chr = (Character) recipe[idx];
} else if (in instanceof ItemStack) { Object in = recipe[idx + 1];
itemMap.put(chr, ((ItemStack) in).copy());
} else if (in instanceof Item) {
itemMap.put(chr, new ItemStack((Item) in));
} else if (in instanceof Block) {
itemMap.put(chr, new ItemStack((Block) in, 1, OreDictionary.WILDCARD_VALUE));
} else if (in instanceof String) {
itemMap.put(chr, OreDictionary.getOres((String) in));
} else {
String ret = "Invalid shaped ore recipe: ";
for (Object tmp : recipe) {
ret += tmp + ", ";
}
ret += output;
throw new RuntimeException(ret);
}
}
input = new Object[width * height]; if (in instanceof IBloodOrb || (in instanceof ItemStack && ((ItemStack) in).getItem() instanceof IBloodOrb))
int x = 0; { //If the item is an instanceof IBloodOrb then save the level of the orb
for (char chr : shape.toCharArray()) { if (in instanceof ItemStack)
input[x++] = itemMap.get(chr); itemMap.put(chr, (Integer) (((IBloodOrb) ((ItemStack) in).getItem()).getOrbLevel()));
} else itemMap.put(chr, (Integer) (((IBloodOrb) in).getOrbLevel()));
} } else if (in instanceof ItemStack)
{
itemMap.put(chr, ((ItemStack) in).copy());
} else if (in instanceof Item)
{
itemMap.put(chr, new ItemStack((Item) in));
} else if (in instanceof Block)
{
itemMap.put(chr, new ItemStack((Block) in, 1, OreDictionary.WILDCARD_VALUE));
} else if (in instanceof String)
{
itemMap.put(chr, OreDictionary.getOres((String) in));
} else
{
String ret = "Invalid shaped ore recipe: ";
for (Object tmp : recipe)
{
ret += tmp + ", ";
}
ret += output;
throw new RuntimeException(ret);
}
}
ShapedBloodOrbRecipe(ShapedRecipes recipe, Map<ItemStack, String> replacements) { input = new Object[width * height];
output = recipe.getRecipeOutput(); int x = 0;
width = recipe.recipeWidth; for (char chr : shape.toCharArray())
height = recipe.recipeHeight; {
input[x++] = itemMap.get(chr);
}
}
input = new Object[recipe.recipeItems.length]; ShapedBloodOrbRecipe(ShapedRecipes recipe, Map<ItemStack, String> replacements)
{
output = recipe.getRecipeOutput();
width = recipe.recipeWidth;
height = recipe.recipeHeight;
for (int i = 0; i < input.length; i++) { input = new Object[recipe.recipeItems.length];
ItemStack ingred = recipe.recipeItems[i];
if (ingred == null) for (int i = 0; i < input.length; i++)
continue; {
ItemStack ingred = recipe.recipeItems[i];
input[i] = recipe.recipeItems[i]; if (ingred == null)
continue;
for (Entry<ItemStack, String> replace : replacements.entrySet()) { input[i] = recipe.recipeItems[i];
if (OreDictionary.itemMatches(replace.getKey(), ingred, true)) {
input[i] = OreDictionary.getOres(replace.getValue());
break;
}
}
}
}
@Override for (Entry<ItemStack, String> replace : replacements.entrySet())
public ItemStack getCraftingResult(InventoryCrafting var1) { {
return output.copy(); if (OreDictionary.itemMatches(replace.getKey(), ingred, true))
} {
input[i] = OreDictionary.getOres(replace.getValue());
break;
}
}
}
}
@Override @Override
public int getRecipeSize() { public ItemStack getCraftingResult(InventoryCrafting var1)
return input.length; {
} return output.copy();
}
@Override @Override
public ItemStack getRecipeOutput() { public int getRecipeSize()
return output; {
} return input.length;
}
@Override @Override
public boolean matches(InventoryCrafting inv, World world) { public ItemStack getRecipeOutput()
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++) { {
for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y) { return output;
if (checkMatch(inv, x, y, false)) { }
return true;
}
if (mirrored && checkMatch(inv, x, y, true)) { @Override
return true; public boolean matches(InventoryCrafting inv, World world)
} {
} for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++)
} {
for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y)
{
if (checkMatch(inv, x, y, false))
{
return true;
}
return false; if (mirrored && checkMatch(inv, x, y, true))
} {
return true;
}
}
}
@SuppressWarnings("unchecked") return false;
private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror) { }
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++) {
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++) {
int subX = x - startX;
int subY = y - startY;
Object target = null;
if (subX >= 0 && subY >= 0 && subX < width && subY < height) { @SuppressWarnings("unchecked")
if (mirror) { private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror)
target = input[width - subX - 1 + subY * width]; {
} else { for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++)
target = input[subX + subY * width]; {
} for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++)
} {
int subX = x - startX;
ItemStack slot = inv.getStackInRowAndColumn(x, y); int subY = y - startY;
//If target is integer, then we should be check the blood orb value of the item instead Object target = null;
if(target instanceof Integer) {
if(slot != null && slot.getItem() instanceof IBloodOrb) {
IBloodOrb orb = (IBloodOrb) slot.getItem();
if(orb.getOrbLevel() < (Integer)target) {
return false;
}
} else return false;
} else if (target instanceof ItemStack) {
if (!OreDictionary.itemMatches((ItemStack) target, slot, false)) {
return false;
}
} else if (target instanceof ArrayList) {
boolean matched = false;
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) target).iterator(); if (subX >= 0 && subY >= 0 && subX < width && subY < height)
while (itr.hasNext() && !matched) { {
matched = OreDictionary.itemMatches(itr.next(), slot, false); if (mirror)
} {
target = input[width - subX - 1 + subY * width];
} else
{
target = input[subX + subY * width];
}
}
if (!matched) { ItemStack slot = inv.getStackInRowAndColumn(x, y);
return false; //If target is integer, then we should be check the blood orb value of the item instead
} if (target instanceof Integer)
} else if (target == null && slot != null) { {
return false; if (slot != null && slot.getItem() instanceof IBloodOrb)
} {
} IBloodOrb orb = (IBloodOrb) slot.getItem();
} if (orb.getOrbLevel() < (Integer) target)
{
return false;
}
} else return false;
} else if (target instanceof ItemStack)
{
if (!OreDictionary.itemMatches((ItemStack) target, slot, false))
{
return false;
}
} else if (target instanceof ArrayList)
{
boolean matched = false;
return true; Iterator<ItemStack> itr = ((ArrayList<ItemStack>) target).iterator();
} while (itr.hasNext() && !matched)
{
matched = OreDictionary.itemMatches(itr.next(), slot, false);
}
public ShapedBloodOrbRecipe setMirrored(boolean mirror) { if (!matched)
mirrored = mirror; {
return this; return false;
} }
} else if (target == null && slot != null)
{
return false;
}
}
}
public Object[] getInput() { return true;
return this.input; }
}
public ShapedBloodOrbRecipe setMirrored(boolean mirror)
{
mirrored = mirror;
return this;
}
public Object[] getInput()
{
return this.input;
}
} }

View file

@ -1,11 +1,6 @@
package WayofTime.alchemicalWizardry.api.items; package WayofTime.alchemicalWizardry.api.items;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -14,127 +9,166 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
/** Shapeless Blood Orb Recipe Handler by joshie **/ import java.util.ArrayList;
public class ShapelessBloodOrbRecipe implements IRecipe { import java.util.Iterator;
private ItemStack output = null; import java.util.List;
private ArrayList<Object> input = new ArrayList<Object>(); import java.util.Map;
import java.util.Map.Entry;
public ShapelessBloodOrbRecipe(Block result, Object... recipe) { /**
this(new ItemStack(result), recipe); * Shapeless Blood Orb Recipe Handler by joshie *
} */
public class ShapelessBloodOrbRecipe implements IRecipe
{
private ItemStack output = null;
private ArrayList<Object> input = new ArrayList<Object>();
public ShapelessBloodOrbRecipe(Item result, Object... recipe) { public ShapelessBloodOrbRecipe(Block result, Object... recipe)
this(new ItemStack(result), recipe); {
} this(new ItemStack(result), recipe);
}
public ShapelessBloodOrbRecipe(ItemStack result, Object... recipe) { public ShapelessBloodOrbRecipe(Item result, Object... recipe)
output = result.copy(); {
for (Object in : recipe) { this(new ItemStack(result), recipe);
if (in instanceof ItemStack) { }
input.add(((ItemStack) in).copy());
} else if (in instanceof IBloodOrb) { //If the item is an instanceof IBloodOrb then save the level of the orb
input.add((Integer)(((IBloodOrb)in).getOrbLevel()));
} else if (in instanceof Item) {
input.add(new ItemStack((Item) in));
} else if (in instanceof Block) {
input.add(new ItemStack((Block) in));
} else if (in instanceof String) {
input.add(OreDictionary.getOres((String) in));
} else {
String ret = "Invalid shapeless ore recipe: ";
for (Object tmp : recipe) {
ret += tmp + ", ";
}
ret += output;
throw new RuntimeException(ret);
}
}
}
@SuppressWarnings("unchecked") public ShapelessBloodOrbRecipe(ItemStack result, Object... recipe)
ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements) { {
output = recipe.getRecipeOutput(); output = result.copy();
for (Object in : recipe)
{
if (in instanceof ItemStack)
{
input.add(((ItemStack) in).copy());
} else if (in instanceof IBloodOrb)
{ //If the item is an instanceof IBloodOrb then save the level of the orb
input.add((Integer) (((IBloodOrb) in).getOrbLevel()));
} else if (in instanceof Item)
{
input.add(new ItemStack((Item) in));
} else if (in instanceof Block)
{
input.add(new ItemStack((Block) in));
} else if (in instanceof String)
{
input.add(OreDictionary.getOres((String) in));
} else
{
String ret = "Invalid shapeless ore recipe: ";
for (Object tmp : recipe)
{
ret += tmp + ", ";
}
ret += output;
throw new RuntimeException(ret);
}
}
}
for (ItemStack ingred : ((List<ItemStack>) recipe.recipeItems)) { @SuppressWarnings("unchecked")
Object finalObj = ingred; ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements)
for (Entry<ItemStack, String> replace : replacements.entrySet()) { {
if (OreDictionary.itemMatches(replace.getKey(), ingred, false)) { output = recipe.getRecipeOutput();
finalObj = OreDictionary.getOres(replace.getValue());
break;
}
}
input.add(finalObj);
}
}
@Override for (ItemStack ingred : ((List<ItemStack>) recipe.recipeItems))
public int getRecipeSize() { {
return input.size(); Object finalObj = ingred;
} for (Entry<ItemStack, String> replace : replacements.entrySet())
{
if (OreDictionary.itemMatches(replace.getKey(), ingred, false))
{
finalObj = OreDictionary.getOres(replace.getValue());
break;
}
}
input.add(finalObj);
}
}
@Override @Override
public ItemStack getRecipeOutput() { public int getRecipeSize()
return output; {
} return input.size();
}
@Override @Override
public ItemStack getCraftingResult(InventoryCrafting var1) { public ItemStack getRecipeOutput()
return output.copy(); {
} return output;
}
@SuppressWarnings("unchecked") @Override
@Override public ItemStack getCraftingResult(InventoryCrafting var1)
public boolean matches(InventoryCrafting var1, World world) { {
ArrayList<Object> required = new ArrayList<Object>(input); return output.copy();
}
for (int x = 0; x < var1.getSizeInventory(); x++) { @SuppressWarnings("unchecked")
ItemStack slot = var1.getStackInSlot(x); @Override
public boolean matches(InventoryCrafting var1, World world)
{
ArrayList<Object> required = new ArrayList<Object>(input);
if (slot != null) { for (int x = 0; x < var1.getSizeInventory(); x++)
boolean inRecipe = false; {
Iterator<Object> req = required.iterator(); ItemStack slot = var1.getStackInSlot(x);
while (req.hasNext()) { if (slot != null)
boolean match = false; {
boolean inRecipe = false;
Iterator<Object> req = required.iterator();
Object next = req.next(); while (req.hasNext())
{
boolean match = false;
//If target is integer, then we should be check the blood orb value of the item instead Object next = req.next();
if(next instanceof Integer) {
if(slot != null && slot.getItem() instanceof IBloodOrb) {
IBloodOrb orb = (IBloodOrb) slot.getItem();
if(orb.getOrbLevel() < (Integer)next) {
return false;
}
} else return false;
} else if (next instanceof ItemStack) {
match = OreDictionary.itemMatches((ItemStack) next, slot, false);
} else if (next instanceof ArrayList) {
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) next).iterator();
while (itr.hasNext() && !match) {
match = OreDictionary.itemMatches(itr.next(), slot, false);
}
}
if (match) { //If target is integer, then we should be check the blood orb value of the item instead
inRecipe = true; if (next instanceof Integer)
required.remove(next); {
break; if (slot != null && slot.getItem() instanceof IBloodOrb)
} {
} IBloodOrb orb = (IBloodOrb) slot.getItem();
if (orb.getOrbLevel() < (Integer) next)
{
return false;
}
} else return false;
} else if (next instanceof ItemStack)
{
match = OreDictionary.itemMatches((ItemStack) next, slot, false);
} else if (next instanceof ArrayList)
{
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) next).iterator();
while (itr.hasNext() && !match)
{
match = OreDictionary.itemMatches(itr.next(), slot, false);
}
}
if (!inRecipe) { if (match)
return false; {
} inRecipe = true;
} required.remove(next);
} break;
}
}
return required.isEmpty(); if (!inRecipe)
} {
return false;
}
}
}
public ArrayList<Object> getInput() { return required.isEmpty();
return this.input; }
}
public ArrayList<Object> getInput()
{
return this.input;
}
} }

View file

@ -1,8 +1,8 @@
package WayofTime.alchemicalWizardry.api.items.interfaces; package WayofTime.alchemicalWizardry.api.items.interfaces;
public interface IBloodOrb public interface IBloodOrb
{ {
public int getMaxEssence(); public int getMaxEssence();
public int getOrbLevel(); public int getOrbLevel();
} }

View file

@ -1,6 +1,6 @@
package WayofTime.alchemicalWizardry.api.items.interfaces; package WayofTime.alchemicalWizardry.api.items.interfaces;
public interface IHolding public interface IHolding
{ {
} }

View file

@ -3,7 +3,7 @@ package WayofTime.alchemicalWizardry.api.items.interfaces;
/** /**
* Implement this interface to have reagent blocks return false on activating them, to allow manipulation of said block * Implement this interface to have reagent blocks return false on activating them, to allow manipulation of said block
*/ */
public interface IReagentManipulator public interface IReagentManipulator
{ {
} }

View file

@ -1,13 +1,13 @@
package WayofTime.alchemicalWizardry.api.rituals; package WayofTime.alchemicalWizardry.api.rituals;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ISegmentedReagentHandler;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ISegmentedReagentHandler;
public interface IMasterRitualStone extends ISegmentedReagentHandler public interface IMasterRitualStone extends ISegmentedReagentHandler
{ {
public void performRitual(World world, int x, int y, int z, String ritualID); public void performRitual(World world, int x, int y, int z, String ritualID);
public String getOwner(); public String getOwner();
public void setCooldown(int newCooldown); public void setCooldown(int newCooldown);
@ -21,16 +21,16 @@ public interface IMasterRitualStone extends ISegmentedReagentHandler
public void setActive(boolean active); public void setActive(boolean active);
public int getDirection(); public int getDirection();
public World getWorld(); public World getWorld();
public int getXCoord(); public int getXCoord();
public int getYCoord(); public int getYCoord();
public int getZCoord(); public int getZCoord();
public NBTTagCompound getCustomRitualTag(); public NBTTagCompound getCustomRitualTag();
public void setCustomRitualTag(NBTTagCompound tag); public void setCustomRitualTag(NBTTagCompound tag);
} }

View file

@ -1,6 +1,6 @@
package WayofTime.alchemicalWizardry.api.rituals; package WayofTime.alchemicalWizardry.api.rituals;
public interface IRitualStone public interface IRitualStone
{ {
} }

View file

@ -1,24 +1,24 @@
package WayofTime.alchemicalWizardry.api.rituals; package WayofTime.alchemicalWizardry.api.rituals;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.List;
public abstract class RitualEffect public abstract class RitualEffect
{ {
public abstract void performEffect(IMasterRitualStone ritualStone); public abstract void performEffect(IMasterRitualStone ritualStone);
public boolean startRitual(IMasterRitualStone ritualStone, EntityPlayer player) public boolean startRitual(IMasterRitualStone ritualStone, EntityPlayer player)
{ {
return true; return true;
} }
public void onRitualBroken(IMasterRitualStone ritualStone) public void onRitualBroken(IMasterRitualStone ritualStone)
{ {
} }
public abstract int getCostPerRefresh(); public abstract int getCostPerRefresh();
@ -27,30 +27,30 @@ public abstract class RitualEffect
{ {
return 0; return 0;
} }
public abstract List<RitualComponent> getRitualComponentList(); public abstract List<RitualComponent> getRitualComponentList();
public boolean canDrainReagent(IMasterRitualStone ritualStone, Reagent reagent, int amount, boolean doDrain) public boolean canDrainReagent(IMasterRitualStone ritualStone, Reagent reagent, int amount, boolean doDrain)
{ {
if(ritualStone == null || reagent == null || amount == 0) if (ritualStone == null || reagent == null || amount == 0)
{ {
return false; return false;
} }
ReagentStack reagentStack = new ReagentStack(reagent, amount); ReagentStack reagentStack = new ReagentStack(reagent, amount);
ReagentStack stack = ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, false); ReagentStack stack = ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, false);
if(stack != null && stack.amount >= amount) if (stack != null && stack.amount >= amount)
{ {
if(doDrain) if (doDrain)
{ {
ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, true); ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, true);
} }
return true; return true;
} }
return false; return false;
} }
} }

View file

@ -1,26 +1,26 @@
package WayofTime.alchemicalWizardry.api.rituals; package WayofTime.alchemicalWizardry.api.rituals;
import WayofTime.alchemicalWizardry.common.renderer.MRSRenderer;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.renderer.MRSRenderer;
public class Rituals public class Rituals
{ {
private int crystalLevel; private int crystalLevel;
private int actCost; private int actCost;
private RitualEffect effect; private RitualEffect effect;
private String name; private String name;
private MRSRenderer customRenderer; private MRSRenderer customRenderer;
public static Map<String,Rituals> ritualMap = new HashMap(); public static Map<String, Rituals> ritualMap = new HashMap();
public static List<String> keyList = new LinkedList(); public static List<String> keyList = new LinkedList();
public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer) public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer)
{ {
@ -32,90 +32,89 @@ public class Rituals
ritualMap.put(name, this); ritualMap.put(name, this);
this.customRenderer = renderer; this.customRenderer = renderer;
} }
public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name) public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name)
{ {
this(crystalLevel, actCost, effect, name, null); this(crystalLevel, actCost, effect, name, null);
} }
/** /**
* Static method to register a ritual to the Ritual Registry * Static method to register a ritual to the Ritual Registry
* @param key Unique identification key - must be different from all others to properly register *
* @param crystalLevel Crystal level required to activate * @param key Unique identification key - must be different from all others to properly register
* @param actCost LP amount required to activate * @param crystalLevel Crystal level required to activate
* @param effect The effect that will be ticked * @param actCost LP amount required to activate
* @param name The name of the ritual * @param effect The effect that will be ticked
* @return Returns true if properly registered, or false if the key is already used * @param name The name of the ritual
* @return Returns true if properly registered, or false if the key is already used
*/ */
public static boolean registerRitual(String key, int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer) public static boolean registerRitual(String key, int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer)
{ {
if(ritualMap.containsKey(key)) if (ritualMap.containsKey(key))
{ {
return false; return false;
} } else
else {
{ Rituals ritual = new Rituals(crystalLevel, actCost, effect, name, renderer);
Rituals ritual = new Rituals(crystalLevel, actCost, effect, name, renderer); ritual.removeRitualFromList();
ritual.removeRitualFromList(); ritualMap.put(key, ritual);
ritualMap.put(key, ritual); keyList.add(key);
keyList.add(key); return true;
return true; }
}
} }
public static boolean registerRitual(String key, int crystalLevel, int actCost, RitualEffect effect, String name) public static boolean registerRitual(String key, int crystalLevel, int actCost, RitualEffect effect, String name)
{ {
if(ritualMap.containsKey(key)) if (ritualMap.containsKey(key))
{ {
return false; return false;
} } else
else {
{ Rituals ritual = new Rituals(crystalLevel, actCost, effect, name);
Rituals ritual = new Rituals(crystalLevel, actCost, effect, name); ritual.removeRitualFromList();
ritual.removeRitualFromList(); ritualMap.put(key, ritual);
ritualMap.put(key, ritual); keyList.add(key);
keyList.add(key); return true;
return true; }
}
} }
public void removeRitualFromList() public void removeRitualFromList()
{ {
if(ritualMap.containsValue(this)) if (ritualMap.containsValue(this))
{ {
ritualMap.remove(ritualMap.remove(this.name)); ritualMap.remove(ritualMap.remove(this.name));
} }
if(keyList.contains(this.name)) if (keyList.contains(this.name))
{ {
keyList.remove(this.name); keyList.remove(this.name);
} }
} }
public static String checkValidRitual(World world, int x, int y, int z) public static String checkValidRitual(World world, int x, int y, int z)
{ {
for(String key : ritualMap.keySet()) for (String key : ritualMap.keySet())
{ {
if(checkRitualIsValid(world,x,y,z,key)) if (checkRitualIsValid(world, x, y, z, key))
{ {
return key; return key;
} }
} }
return ""; return "";
} }
public static boolean canCrystalActivate(String ritualID, int crystalLevel) public static boolean canCrystalActivate(String ritualID, int crystalLevel)
{ {
if(ritualMap.containsKey(ritualID)) if (ritualMap.containsKey(ritualID))
{ {
Rituals ritual = ritualMap.get(ritualID); Rituals ritual = ritualMap.get(ritualID);
if(ritual != null) if (ritual != null)
{ {
return ritual.getCrystalLevel() <= crystalLevel; return ritual.getCrystalLevel() <= crystalLevel;
} }
} }
return false; return false;
} }
public static boolean checkRitualIsValid(World world, int x, int y, int z, String ritualID) public static boolean checkRitualIsValid(World world, int x, int y, int z, String ritualID)
@ -170,8 +169,8 @@ public class Rituals
case 2: case 2:
for (RitualComponent rc : ritual) for (RitualComponent rc : ritual)
{ {
test = world.getBlock(x - rc.getZ(), y + rc.getY(), z + rc.getX()); test = world.getBlock(x - rc.getZ(), y + rc.getY(), z + rc.getX());
if (!(test instanceof IRitualStone)) if (!(test instanceof IRitualStone))
{ {
return false; return false;
@ -188,8 +187,8 @@ public class Rituals
case 3: case 3:
for (RitualComponent rc : ritual) for (RitualComponent rc : ritual)
{ {
test = world.getBlock(x - rc.getX(), y + rc.getY(), z - rc.getZ()); test = world.getBlock(x - rc.getX(), y + rc.getY(), z - rc.getZ());
if (!(test instanceof IRitualStone)) if (!(test instanceof IRitualStone))
{ {
return false; return false;
@ -206,9 +205,9 @@ public class Rituals
case 4: case 4:
for (RitualComponent rc : ritual) for (RitualComponent rc : ritual)
{ {
test = world.getBlock(x + rc.getZ(), y + rc.getY(), z - rc.getX()); test = world.getBlock(x + rc.getZ(), y + rc.getY(), z - rc.getX());
if (!(test instanceof IRitualStone)) if (!(test instanceof IRitualStone))
{ {
return false; return false;
} }
@ -240,48 +239,48 @@ public class Rituals
public static int getCostForActivation(String ritualID) public static int getCostForActivation(String ritualID)
{ {
if(ritualMap.containsKey(ritualID)) if (ritualMap.containsKey(ritualID))
{ {
Rituals ritual = ritualMap.get(ritualID); Rituals ritual = ritualMap.get(ritualID);
if(ritual != null) if (ritual != null)
{ {
return ritual.actCost; return ritual.actCost;
} }
} }
return 0; return 0;
} }
public static int getInitialCooldown(String ritualID) public static int getInitialCooldown(String ritualID)
{ {
if(ritualMap.containsKey(ritualID)) if (ritualMap.containsKey(ritualID))
{ {
Rituals ritual = ritualMap.get(ritualID); Rituals ritual = ritualMap.get(ritualID);
if(ritual != null && ritual.effect != null) if (ritual != null && ritual.effect != null)
{ {
return ritual.effect.getInitialCooldown(); return ritual.effect.getInitialCooldown();
} }
} }
return 0; return 0;
} }
public static List<RitualComponent> getRitualList(String ritualID) public static List<RitualComponent> getRitualList(String ritualID)
{ {
if(ritualMap.containsKey(ritualID)) if (ritualMap.containsKey(ritualID))
{ {
Rituals ritual = ritualMap.get(ritualID); Rituals ritual = ritualMap.get(ritualID);
if(ritual != null) if (ritual != null)
{ {
return ritual.obtainComponents(); return ritual.obtainComponents();
}else } else
{ {
return null; return null;
} }
}else } else
{ {
return null; return null;
} }
} }
private List<RitualComponent> obtainComponents() private List<RitualComponent> obtainComponents()
@ -293,53 +292,53 @@ public class Rituals
{ {
return this.crystalLevel; return this.crystalLevel;
} }
private MRSRenderer getRenderer() private MRSRenderer getRenderer()
{ {
return this.customRenderer; return this.customRenderer;
} }
public static void performEffect(IMasterRitualStone ritualStone, String ritualID) public static void performEffect(IMasterRitualStone ritualStone, String ritualID)
{ {
if(ritualMap.containsKey(ritualID)) if (ritualMap.containsKey(ritualID))
{ {
Rituals ritual = ritualMap.get(ritualID); Rituals ritual = ritualMap.get(ritualID);
if(ritual != null && ritual.effect != null) if (ritual != null && ritual.effect != null)
{ {
ritual.effect.performEffect(ritualStone); ritual.effect.performEffect(ritualStone);
} }
} }
} }
public static boolean startRitual(IMasterRitualStone ritualStone, String ritualID, EntityPlayer player) public static boolean startRitual(IMasterRitualStone ritualStone, String ritualID, EntityPlayer player)
{ {
if(ritualMap.containsKey(ritualID)) if (ritualMap.containsKey(ritualID))
{ {
Rituals ritual = ritualMap.get(ritualID); Rituals ritual = ritualMap.get(ritualID);
if(ritual != null && ritual.effect != null) if (ritual != null && ritual.effect != null)
{ {
return ritual.effect.startRitual(ritualStone, player); return ritual.effect.startRitual(ritualStone, player);
} }
} }
return false; return false;
} }
public static void onRitualBroken(IMasterRitualStone ritualStone, String ritualID) public static void onRitualBroken(IMasterRitualStone ritualStone, String ritualID)
{ {
if(ritualMap.containsKey(ritualID)) if (ritualMap.containsKey(ritualID))
{ {
Rituals ritual = ritualMap.get(ritualID); Rituals ritual = ritualMap.get(ritualID);
if(ritual != null && ritual.effect != null) if (ritual != null && ritual.effect != null)
{ {
ritual.effect.onRitualBroken(ritualStone); ritual.effect.onRitualBroken(ritualStone);
} }
} }
} }
public static int getNumberOfRituals() public static int getNumberOfRituals()
{ {
return ritualMap.size(); return ritualMap.size();
} }
public String getRitualName() public String getRitualName()
@ -349,54 +348,54 @@ public class Rituals
public static String getNameOfRitual(String id) public static String getNameOfRitual(String id)
{ {
if(ritualMap.containsKey(id)) if (ritualMap.containsKey(id))
{ {
Rituals ritual = ritualMap.get(id); Rituals ritual = ritualMap.get(id);
if(ritual != null) if (ritual != null)
{ {
return ritual.getRitualName(); return ritual.getRitualName();
} }
} }
return ""; return "";
} }
public static String getNextRitualKey(String key) public static String getNextRitualKey(String key)
{ {
boolean hasSpotted = false; boolean hasSpotted = false;
String firstKey = ""; String firstKey = "";
for(String str : keyList) for (String str : keyList)
{ {
if(firstKey.equals("")) if (firstKey.equals(""))
{ {
firstKey = str; firstKey = str;
} }
if(hasSpotted) if (hasSpotted)
{ {
return str; return str;
} }
if(str.equals(key)) if (str.equals(key))
{ {
hasSpotted = true; hasSpotted = true;
} }
} }
return firstKey; return firstKey;
} }
public static String getPreviousRitualKey(String key) public static String getPreviousRitualKey(String key)
{ {
boolean hasSpotted = false; boolean hasSpotted = false;
String lastKey = keyList.get(keyList.size()-1); String lastKey = keyList.get(keyList.size() - 1);
for(String str : keyList) for (String str : keyList)
{ {
if(str.equals(key)) if (str.equals(key))
{ {
hasSpotted = true; hasSpotted = true;
} }
if(hasSpotted) if (hasSpotted)
{ {
return lastKey; return lastKey;
} }
@ -405,18 +404,18 @@ public class Rituals
return lastKey; return lastKey;
} }
public static MRSRenderer getRendererForKey(String ritualID) public static MRSRenderer getRendererForKey(String ritualID)
{ {
if(ritualMap.containsKey(ritualID)) if (ritualMap.containsKey(ritualID))
{ {
Rituals ritual = ritualMap.get(ritualID); Rituals ritual = ritualMap.get(ritualID);
if(ritual != null) if (ritual != null)
{ {
return ritual.getRenderer(); return ritual.getRenderer();
} }
} }
return null; return null;
} }
} }

View file

@ -1,7 +1,6 @@
package WayofTime.alchemicalWizardry.api.soulNetwork; package WayofTime.alchemicalWizardry.api.soulNetwork;
import java.util.UUID; import com.mojang.authlib.GameProfile;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -11,38 +10,36 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.world.World; import net.minecraft.world.World;
import com.mojang.authlib.GameProfile; import java.util.UUID;
public class SoulNetworkHandler public class SoulNetworkHandler
{ {
public static UUID getUUIDFromPlayer(EntityPlayer player) public static UUID getUUIDFromPlayer(EntityPlayer player)
{ {
return player.getPersistentID(); return player.getPersistentID();
} }
public static EntityPlayer getPlayerFromUUID(UUID uuid) public static EntityPlayer getPlayerFromUUID(UUID uuid)
{ {
MinecraftServer server = MinecraftServer.getServer(); MinecraftServer server = MinecraftServer.getServer();
GameProfile gameProfile; GameProfile gameProfile;
gameProfile = server.func_152358_ax().func_152652_a(uuid); gameProfile = server.func_152358_ax().func_152652_a(uuid);
// LogHelper.info("player is " + gameProfile.getName() + " : " + gameProfile.getId()); return null;
}
return null;
} public static int syphonFromNetwork(ItemStack ist, int damageToBeDone)
{
public static int syphonFromNetwork(ItemStack ist, int damageToBeDone) if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
{
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
{ {
String ownerName = ist.getTagCompound().getString("ownerName"); String ownerName = ist.getTagCompound().getString("ownerName");
return syphonFromNetwork(ownerName, damageToBeDone); return syphonFromNetwork(ownerName, damageToBeDone);
} }
return 0; return 0;
} }
public static int syphonFromNetwork(String ownerName, int damageToBeDone) public static int syphonFromNetwork(String ownerName, int damageToBeDone)
{ {
if (MinecraftServer.getServer() == null) if (MinecraftServer.getServer() == null)
{ {
return 0; return 0;
@ -63,34 +60,34 @@ public class SoulNetworkHandler
data.markDirty(); data.markDirty();
return damageToBeDone; return damageToBeDone;
} }
return 0; return 0;
} }
/** /**
* Master method used to syphon from the player's network, and will damage them accordingly if they do not have enough LP. * Master method used to syphon from the player's network, and will damage them accordingly if they do not have enough LP.
* Does not drain on the client side. * Does not drain on the client side.
* *
* @param ist Owned itemStack * @param ist Owned itemStack
* @param player Player using the item * @param player Player using the item
* @param damageToBeDone * @param damageToBeDone
* @return True if server-sided, false if client-sided * @return True if server-sided, false if client-sided
*/ */
public static boolean syphonAndDamageFromNetwork(ItemStack ist, EntityPlayer player, int damageToBeDone) public static boolean syphonAndDamageFromNetwork(ItemStack ist, EntityPlayer player, int damageToBeDone)
{ {
if(player.worldObj.isRemote) if (player.worldObj.isRemote)
{ {
return false; return false;
} }
int amount = SoulNetworkHandler.syphonFromNetwork(ist, damageToBeDone); int amount = SoulNetworkHandler.syphonFromNetwork(ist, damageToBeDone);
hurtPlayer(player, damageToBeDone-amount); hurtPlayer(player, damageToBeDone - amount);
return true; return true;
} }
public static boolean canSyphonFromOnlyNetwork(ItemStack ist, int damageToBeDone) public static boolean canSyphonFromOnlyNetwork(ItemStack ist, int damageToBeDone)
{ {
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
{ {
@ -101,8 +98,8 @@ public class SoulNetworkHandler
return false; return false;
} }
public static boolean canSyphonFromOnlyNetwork(String ownerName, int damageToBeDone) public static boolean canSyphonFromOnlyNetwork(String ownerName, int damageToBeDone)
{ {
if (MinecraftServer.getServer() == null) if (MinecraftServer.getServer() == null)
{ {
@ -120,10 +117,10 @@ public class SoulNetworkHandler
return data.currentEssence >= damageToBeDone; return data.currentEssence >= damageToBeDone;
} }
public static int getCurrentEssence(String ownerName) public static int getCurrentEssence(String ownerName)
{ {
if (MinecraftServer.getServer() == null) if (MinecraftServer.getServer() == null)
{ {
return 0; return 0;
} }
@ -136,13 +133,13 @@ public class SoulNetworkHandler
data = new LifeEssenceNetwork(ownerName); data = new LifeEssenceNetwork(ownerName);
world.setItemData(ownerName, data); world.setItemData(ownerName, data);
} }
return data.currentEssence; return data.currentEssence;
} }
public static void setCurrentEssence(String ownerName, int essence) public static void setCurrentEssence(String ownerName, int essence)
{ {
if (MinecraftServer.getServer() == null) if (MinecraftServer.getServer() == null)
{ {
return; return;
} }
@ -155,22 +152,22 @@ public class SoulNetworkHandler
data = new LifeEssenceNetwork(ownerName); data = new LifeEssenceNetwork(ownerName);
world.setItemData(ownerName, data); world.setItemData(ownerName, data);
} }
data.currentEssence = essence; data.currentEssence = essence;
data.markDirty(); data.markDirty();
} }
/** /**
* A method to add to an owner's network up to a maximum value. * A method to add to an owner's network up to a maximum value.
* *
* @param ownerName * @param ownerName
* @param addedEssence * @param addedEssence
* @param maximum * @param maximum
* @return amount added to the network * @return amount added to the network
*/ */
public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence, int maximum) public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence, int maximum)
{ {
if (MinecraftServer.getServer() == null) if (MinecraftServer.getServer() == null)
{ {
return 0; return 0;
} }
@ -183,21 +180,21 @@ public class SoulNetworkHandler
data = new LifeEssenceNetwork(ownerName); data = new LifeEssenceNetwork(ownerName);
world.setItemData(ownerName, data); world.setItemData(ownerName, data);
} }
int currEss = data.currentEssence; int currEss = data.currentEssence;
if(currEss>=maximum) if (currEss >= maximum)
{ {
return 0; return 0;
} }
int newEss = Math.min(maximum, currEss+addedEssence); int newEss = Math.min(maximum, currEss + addedEssence);
data.currentEssence = newEss; data.currentEssence = newEss;
return newEss-currEss; return newEss - currEss;
} }
public static void hurtPlayer(EntityPlayer user, int energySyphoned) public static void hurtPlayer(EntityPlayer user, int energySyphoned)
{ {
if (energySyphoned < 100 && energySyphoned > 0) if (energySyphoned < 100 && energySyphoned > 0)
{ {
@ -227,8 +224,8 @@ public class SoulNetworkHandler
} }
} }
} }
public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player) public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player)
{ {
if (item.stackTagCompound == null) if (item.stackTagCompound == null)
{ {
@ -253,34 +250,34 @@ public class SoulNetworkHandler
item.stackTagCompound.setString("ownerName", ownerName); item.stackTagCompound.setString("ownerName", ownerName);
} }
} }
public static String getUsername(EntityPlayer player) public static String getUsername(EntityPlayer player)
{ {
return player.getDisplayName(); return player.getDisplayName();
} }
public static EntityPlayer getPlayerForUsername(String str) public static EntityPlayer getPlayerForUsername(String str)
{ {
if(MinecraftServer.getServer() == null) if (MinecraftServer.getServer() == null)
{ {
return null; return null;
} }
return MinecraftServer.getServer().getConfigurationManager().func_152612_a(str); return MinecraftServer.getServer().getConfigurationManager().func_152612_a(str);
} }
public static void causeNauseaToPlayer(ItemStack stack) public static void causeNauseaToPlayer(ItemStack stack)
{ {
if (stack.getTagCompound() != null && !(stack.getTagCompound().getString("ownerName").equals(""))) if (stack.getTagCompound() != null && !(stack.getTagCompound().getString("ownerName").equals("")))
{ {
String ownerName = stack.getTagCompound().getString("ownerName"); String ownerName = stack.getTagCompound().getString("ownerName");
SoulNetworkHandler.causeNauseaToPlayer(ownerName); SoulNetworkHandler.causeNauseaToPlayer(ownerName);
} }
} }
public static void causeNauseaToPlayer(String ownerName) public static void causeNauseaToPlayer(String ownerName)
{ {
EntityPlayer entityOwner = SoulNetworkHandler.getPlayerForUsername(ownerName); EntityPlayer entityOwner = SoulNetworkHandler.getPlayerForUsername(ownerName);
if (entityOwner == null) if (entityOwner == null)
{ {

View file

@ -5,7 +5,7 @@ import net.minecraft.world.World;
public abstract class SummoningHelper public abstract class SummoningHelper
{ {
protected int id; protected int id;
public SummoningHelper(int id) public SummoningHelper(int id)
{ {

View file

@ -1,11 +1,5 @@
package WayofTime.alchemicalWizardry.client; package WayofTime.alchemicalWizardry.client;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.client.event.sound.SoundEvent;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.client.renderer.RenderHelper; import WayofTime.alchemicalWizardry.client.renderer.RenderHelper;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
@ -13,46 +7,51 @@ import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent; import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.client.event.sound.SoundEvent;
import org.lwjgl.opengl.GL11;
public class ClientEventHandler public class ClientEventHandler
{ {
private Minecraft mcClient = FMLClientHandler.instance().getClient(); private Minecraft mcClient = FMLClientHandler.instance().getClient();
@SubscribeEvent @SubscribeEvent
public void onPlayerSoundEvent(SoundEvent event) public void onPlayerSoundEvent(SoundEvent event)
{ {
if(Minecraft.getMinecraft() != null) if (Minecraft.getMinecraft() != null)
{ {
EntityPlayer player = Minecraft.getMinecraft().thePlayer; EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if(player != null && player.isPotionActive(AlchemicalWizardry.customPotionDeaf)) if (player != null && player.isPotionActive(AlchemicalWizardry.customPotionDeaf))
{ {
event.setResult(Result.DENY); event.setResult(Result.DENY);
} }
} }
} }
@SubscribeEvent @SubscribeEvent
public void onTick(RenderTickEvent event) public void onTick(RenderTickEvent event)
{ {
if (event.phase.equals(Phase.START)) if (event.phase.equals(Phase.START))
return; return;
if (!RenderHelper.onTickInGame(mcClient)) if (!RenderHelper.onTickInGame(mcClient))
{ {
} }
} }
@SubscribeEvent @SubscribeEvent
public void onRenderLivingPlayerPre(RenderPlayerEvent.Pre event) public void onRenderLivingPlayerPre(RenderPlayerEvent.Pre event)
{ {
GL11.glDisable(2929); GL11.glDisable(2929);
} }
@SubscribeEvent @SubscribeEvent
public void onRenderLivingPlayerPost(RenderPlayerEvent.Post event) public void onRenderLivingPlayerPost(RenderPlayerEvent.Post event)
{ {
GL11.glEnable(2929); GL11.glEnable(2929);
} }
} }

View file

@ -1,89 +1,29 @@
package WayofTime.alchemicalWizardry.client; package WayofTime.alchemicalWizardry.client;
import net.minecraft.item.ItemBlock;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.CommonProxy; import WayofTime.alchemicalWizardry.common.CommonProxy;
import WayofTime.alchemicalWizardry.common.EntityAirElemental; import WayofTime.alchemicalWizardry.common.EntityAirElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityBileDemon; import WayofTime.alchemicalWizardry.common.entity.mob.*;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityBoulderFist;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityEarthElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityFallenAngel;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityFireElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityHolyElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityIceDemon;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityLowerGuardian;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityShade;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityShadeElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntitySmallEarthGolem;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWaterElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWingedFireDemon;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaMainProjectile; import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaMainProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityMeteor; import WayofTime.alchemicalWizardry.common.entity.projectile.EntityMeteor;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityParticleBeam; import WayofTime.alchemicalWizardry.common.entity.projectile.EntityParticleBeam;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderAlchemicCalcinator; import WayofTime.alchemicalWizardry.common.renderer.block.*;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderConduit; import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.*;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderCrystalBelljar; import WayofTime.alchemicalWizardry.common.renderer.mob.*;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderMasterStone; import WayofTime.alchemicalWizardry.common.renderer.model.*;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderPedestal;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderPlinth;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderReagentConduit;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellEffectBlock;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellEnhancementBlock;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellModifierBlock;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellParadigmBlock;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderWritingTable;
import WayofTime.alchemicalWizardry.common.renderer.block.ShaderHelper;
import WayofTime.alchemicalWizardry.common.renderer.block.TEAltarRenderer;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TEAlchemicalCalcinatorItemRenderer;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TEAltarItemRenderer;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TEBellJarItemRenderer;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TEConduitItemRenderer;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TESpellEffectBlockItemRenderer;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TESpellEnhancementBlockItemRenderer;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TESpellModifierBlockItemRenderer;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TESpellParadigmBlockItemRenderer;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderBileDemon;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderBoulderFist;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderElemental;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderFallenAngel;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderIceDemon;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderLowerGuardian;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderShade;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderSmallEarthGolem;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderWingedFireDemon;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelBileDemon;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelBoulderFist;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelElemental;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelFallenAngel;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelIceDemon;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelLowerGuardian;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelShade;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelSmallEarthGolem;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelWingedFireDemon;
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBazookaMainProjectile; import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBazookaMainProjectile;
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBlastProjectile; import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBlastProjectile;
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderMeteor; import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderMeteor;
import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator; import WayofTime.alchemicalWizardry.common.tileEntity.*;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEConduit;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEnhancementBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.item.ItemBlock;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
public class ClientProxy extends CommonProxy public class ClientProxy extends CommonProxy
{ {
@ -93,39 +33,24 @@ public class ClientProxy extends CommonProxy
@Override @Override
public void registerRenderers() public void registerRenderers()
{ {
//altarRenderType = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerEntityRenderingHandler(EnergyBlastProjectile.class, new RenderEnergyBlastProjectile()); RenderingRegistry.registerEntityRenderingHandler(EnergyBlastProjectile.class, new RenderEnergyBlastProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntityEnergyBazookaMainProjectile.class, new RenderEnergyBazookaMainProjectile()); RenderingRegistry.registerEntityRenderingHandler(EntityEnergyBazookaMainProjectile.class, new RenderEnergyBazookaMainProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntitySpellProjectile.class, new RenderEnergyBlastProjectile()); RenderingRegistry.registerEntityRenderingHandler(EntitySpellProjectile.class, new RenderEnergyBlastProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntityParticleBeam.class, new RenderEnergyBlastProjectile()); RenderingRegistry.registerEntityRenderingHandler(EntityParticleBeam.class, new RenderEnergyBlastProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntityMeteor.class, new RenderMeteor()); RenderingRegistry.registerEntityRenderingHandler(EntityMeteor.class, new RenderMeteor());
//EntityRegistry.registerGlobalEntityID(EntityFallenAngel.class, "AlchemicalWizardry.FallenAngel", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityFallenAngel.class, new RenderFallenAngel(new ModelFallenAngel(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityFallenAngel.class, new RenderFallenAngel(new ModelFallenAngel(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityLowerGuardian.class, "AlchemicalWizardry.LowerGuardian", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityLowerGuardian.class, new RenderLowerGuardian(new ModelLowerGuardian(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityLowerGuardian.class, new RenderLowerGuardian(new ModelLowerGuardian(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityBileDemon.class, "AlchemicalWizardry.BileDemon", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityBileDemon.class, new RenderBileDemon(new ModelBileDemon(), 1.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityBileDemon.class, new RenderBileDemon(new ModelBileDemon(), 1.5F));
//EntityRegistry.registerGlobalEntityID(EntityWingedFireDemon.class, "AlchemicalWizardry.WingedFireDemon", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityWingedFireDemon.class, new RenderWingedFireDemon(new ModelWingedFireDemon(), 1.0F)); RenderingRegistry.registerEntityRenderingHandler(EntityWingedFireDemon.class, new RenderWingedFireDemon(new ModelWingedFireDemon(), 1.0F));
//EntityRegistry.registerGlobalEntityID(EntitySmallEarthGolem.class, "AlchemicalWizardry.SmallEarthGolem", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntitySmallEarthGolem.class, new RenderSmallEarthGolem(new ModelSmallEarthGolem(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntitySmallEarthGolem.class, new RenderSmallEarthGolem(new ModelSmallEarthGolem(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityIceDemon.class, "AlchemicalWizardry.IceDemon", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityIceDemon.class, new RenderIceDemon(new ModelIceDemon(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityIceDemon.class, new RenderIceDemon(new ModelIceDemon(), 0.5F));
// EntityRegistry.registerGlobalEntityID(EntityBoulderFist.class, "AlchemicalWizardry.BoulderFist", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityBoulderFist.class, new RenderBoulderFist(new ModelBoulderFist(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityBoulderFist.class, new RenderBoulderFist(new ModelBoulderFist(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityShade.class, "AlchemicalWizardry.Shade", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityShade.class, new RenderShade(new ModelShade(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityShade.class, new RenderShade(new ModelShade(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityAirElemental.class, "AlchemicalWizardry.AirElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityAirElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityAirElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityWaterElemental.class, "AlchemicalWizardry.WaterElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityWaterElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityWaterElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityEarthElemental.class, "AlchemicalWizardry.EarthElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityEarthElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityEarthElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityFireElemental.class, "AlchemicalWizardry.FireElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityFireElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityFireElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityShadeElemental.class, "AlchemicalWizardry.ShadeElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityShadeElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityShadeElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityHolyElemental.class, "AlchemicalWizardry.HolyElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityHolyElemental.class, new RenderElemental(new ModelElemental(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityHolyElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
ClientRegistry.bindTileEntitySpecialRenderer(TEAltar.class, new TEAltarRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TEAltar.class, new TEAltarRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TEPedestal.class, new RenderPedestal()); ClientRegistry.bindTileEntitySpecialRenderer(TEPedestal.class, new RenderPedestal());
@ -149,11 +74,7 @@ public class ClientProxy extends CommonProxy
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellModifier), new TESpellModifierBlockItemRenderer()); MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellModifier), new TESpellModifierBlockItemRenderer());
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockAlchemicCalcinator), new TEAlchemicalCalcinatorItemRenderer()); MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockAlchemicCalcinator), new TEAlchemicalCalcinatorItemRenderer());
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockCrystalBelljar), new TEBellJarItemRenderer()); MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockCrystalBelljar), new TEBellJarItemRenderer());
ShaderHelper.initShaders();
//RenderingRegistry.registerEntityRenderingHandler(FireProjectile.class, new RenderFireProjectile());
//RenderingRegistry.registerBlockHandler(new AltarRenderer());
ShaderHelper.initShaders();
} }
@Override @Override
@ -165,14 +86,12 @@ public class ClientProxy extends CommonProxy
@Override @Override
public void InitRendering() public void InitRendering()
{ {
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockAltar), new TEAltarItemRenderer()); MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockAltar), new TEAltarItemRenderer());
//MinecraftForgeClient.registerItemRenderer(AlchemicalWizardry.blockWritingTable.blockID, new TEWritingTableItemRenderer());
} }
@Override @Override
public void registerEvents() public void registerEvents()
{ {
FMLCommonHandler.instance().bus().register(new ClientEventHandler()); FMLCommonHandler.instance().bus().register(new ClientEventHandler());
} }
} }

View file

@ -1,13 +1,14 @@
package WayofTime.alchemicalWizardry.client.renderer; package WayofTime.alchemicalWizardry.client.renderer;
import java.util.List; import java.util.List;
/** /**
* This class is a utility class that was created by bspkrs. * This class is a utility class that was created by bspkrs.
* https://github.com/bspkrs/bspkrsCore/blob/master/src/main/java/bspkrs/client/util/ColorThreshold.java * https://github.com/bspkrs/bspkrsCore/blob/master/src/main/java/bspkrs/client/util/ColorThreshold.java
*/ */
public class ColourThreshold implements Comparable<ColourThreshold> public class ColourThreshold implements Comparable<ColourThreshold>
{ {
public int threshold; public int threshold;
public String colorCode; public String colorCode;
public ColourThreshold(int t, String c) public ColourThreshold(int t, String c)

View file

@ -1,38 +1,36 @@
package WayofTime.alchemicalWizardry.client.renderer; package WayofTime.alchemicalWizardry.client.renderer;
import WayofTime.alchemicalWizardry.BloodMagicConfiguration;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.BloodMagicConfiguration;
public class HUDElement public class HUDElement
{ {
public final ItemStack itemStack; public final ItemStack itemStack;
public final int iconW; public final int iconW;
public final int iconH; public final int iconH;
public final int padW; public final int padW;
public final int value; public final int value;
private int elementW; private int elementW;
private int elementH; private int elementH;
private String itemName = ""; private String itemName = "";
private int itemNameW; private int itemNameW;
private String itemDamage = ""; private String itemDamage = "";
private int itemDamageW; private int itemDamageW;
private Minecraft mc = Minecraft.getMinecraft(); private Minecraft mc = Minecraft.getMinecraft();
private static final int offset = 5; private static final int offset = 5;
public boolean enableItemName = false; public boolean enableItemName = false;
public boolean showValue = true; public boolean showValue = true;
public boolean showDamageOverlay = false; public boolean showDamageOverlay = false;
public boolean showItemCount = false; public boolean showItemCount = false;
static RenderItem itemRenderer = new RenderItem(); static RenderItem itemRenderer = new RenderItem();
public HUDElement(ItemStack itemStack, int iconW, int iconH, int padW, int value) public HUDElement(ItemStack itemStack, int iconW, int iconH, int padW, int value)
{ {
this.itemStack = itemStack; this.itemStack = itemStack;
@ -40,48 +38,47 @@ public class HUDElement
this.iconH = iconH; this.iconH = iconH;
this.padW = padW; this.padW = padW;
this.value = value; this.value = value;
initSize(); initSize();
} }
public int width() public int width()
{ {
return elementW; return elementW;
} }
public int height() public int height()
{ {
return elementH; return elementH;
} }
private void initSize() private void initSize()
{ {
elementH = enableItemName ? Math.max(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT * 2, iconH) : elementH = enableItemName ? Math.max(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT * 2, iconH) :
Math.max(mc.fontRenderer.FONT_HEIGHT, iconH); Math.max(mc.fontRenderer.FONT_HEIGHT, iconH);
if (itemStack != null) if (itemStack != null)
{ {
int damage = 1; int damage = 1;
int maxDamage = 1; int maxDamage = 1;
if (showValue) if (showValue)
{ {
maxDamage = itemStack.getMaxDamage() + 1; maxDamage = itemStack.getMaxDamage() + 1;
damage = maxDamage - itemStack.getItemDamageForDisplay(); damage = maxDamage - itemStack.getItemDamageForDisplay();
boolean showSpecialValue = true; boolean showSpecialValue = true;
boolean showValue = false; boolean showValue = false;
boolean showPercent = false; boolean showPercent = false;
boolean showMaxDamage = true; boolean showMaxDamage = true;
boolean thresholdPercent = true; boolean thresholdPercent = true;
if(showSpecialValue) if (showSpecialValue)
{ {
itemDamage = "\247" + ColourThreshold.getColorCode(BloodMagicConfiguration.colorList, itemDamage = "\247" + ColourThreshold.getColorCode(BloodMagicConfiguration.colorList,
(thresholdPercent ? damage * 100 / maxDamage : damage)) + this.value; (thresholdPercent ? damage * 100 / maxDamage : damage)) + this.value;
} } else if (showValue)
else if (showValue)
itemDamage = "\247" + ColourThreshold.getColorCode(BloodMagicConfiguration.colorList, itemDamage = "\247" + ColourThreshold.getColorCode(BloodMagicConfiguration.colorList,
(thresholdPercent ? damage * 100 / maxDamage : damage)) + damage + (thresholdPercent ? damage * 100 / maxDamage : damage)) + damage +
(showMaxDamage ? "/" + maxDamage : ""); (showMaxDamage ? "/" + maxDamage : "");
@ -90,21 +87,21 @@ public class HUDElement
(thresholdPercent ? damage * 100 / maxDamage : damage)) + (thresholdPercent ? damage * 100 / maxDamage : damage)) +
(damage * 100 / maxDamage) + "%"; (damage * 100 / maxDamage) + "%";
} }
itemDamageW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemDamage)); itemDamageW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemDamage));
elementW = padW + iconW + padW + itemDamageW + offset; elementW = padW + iconW + padW + itemDamageW + offset;
if (enableItemName) if (enableItemName)
{ {
itemName = itemStack.getDisplayName(); itemName = itemStack.getDisplayName();
elementW = padW + iconW + padW + elementW = padW + iconW + padW +
Math.max(mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemName)), itemDamageW); Math.max(mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemName)), itemDamageW);
} }
itemNameW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemName)); itemNameW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemName));
} }
} }
public void renderToHud(int x, int y) public void renderToHud(int x, int y)
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
@ -112,31 +109,30 @@ public class HUDElement
RenderHelper.enableStandardItemLighting(); RenderHelper.enableStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.enableGUIStandardItemLighting();
itemRenderer.zLevel = 200.0F; itemRenderer.zLevel = 200.0F;
//if (ArmorStatusHUD.alignMode.toLowerCase().contains("right")) //if (ArmorStatusHUD.alignMode.toLowerCase().contains("right"))
boolean toRight = true; boolean toRight = true;
if(toRight) if (toRight)
{ {
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x - (iconW + padW), y); itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x - (iconW + padW), y);
HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x - (iconW + padW), y, showDamageOverlay, showItemCount); HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x - (iconW + padW), y, showDamageOverlay, showItemCount);
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */); GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_BLEND);
mc.fontRenderer.drawStringWithShadow(itemName + "\247r", x - (padW + iconW + padW) - itemNameW, y, 0xffffff); mc.fontRenderer.drawStringWithShadow(itemName + "\247r", x - (padW + iconW + padW) - itemNameW, y, 0xffffff);
mc.fontRenderer.drawStringWithShadow(itemDamage + "\247r", x - (padW + iconW + padW) - itemDamageW, mc.fontRenderer.drawStringWithShadow(itemDamage + "\247r", x - (padW + iconW + padW) - itemDamageW,
y + (enableItemName ? elementH / 2 : elementH / 4), 0xffffff); y + (enableItemName ? elementH / 2 : elementH / 4), 0xffffff);
} } else
else
{ {
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x, y); itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x, y);
HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x, y, showDamageOverlay, showItemCount); HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x, y, showDamageOverlay, showItemCount);
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */); GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_BLEND);
mc.fontRenderer.drawStringWithShadow(itemName + "\247r", x + iconW + padW, y, 0xffffff); mc.fontRenderer.drawStringWithShadow(itemName + "\247r", x + iconW + padW, y, 0xffffff);
mc.fontRenderer.drawStringWithShadow(itemDamage + "\247r", x + iconW + padW, mc.fontRenderer.drawStringWithShadow(itemDamage + "\247r", x + iconW + padW,
y + (enableItemName ? elementH / 2 : elementH / 4), 0xffffff); y + (enableItemName ? elementH / 2 : elementH / 4), 0xffffff);

View file

@ -9,7 +9,6 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
/** /**
@ -18,113 +17,113 @@ import org.lwjgl.opengl.GL11;
*/ */
public final class HUDUtils public final class HUDUtils
{ {
private static int[] colorCodes = new int[] { 0, 170, 43520, 43690, 11141120, 11141290, 16755200, 11184810, 5592405, 5592575, 5635925, 5636095, 16733525, 16733695, 16777045, 16777215, private static int[] colorCodes = new int[]{0, 170, 43520, 43690, 11141120, 11141290, 16755200, 11184810, 5592405, 5592575, 5635925, 5636095, 16733525, 16733695, 16777045, 16777215,
0, 42, 10752, 10794, 2752512, 2752554, 2763264, 2763306, 1381653, 1381695, 1392405, 1392447, 4134165, 4134207, 4144917, 4144959 }; 0, 42, 10752, 10794, 2752512, 2752554, 2763264, 2763306, 1381653, 1381695, 1392405, 1392447, 4134165, 4134207, 4144917, 4144959};
public static int getColorCode(char c, boolean isLighter) public static int getColorCode(char c, boolean isLighter)
{ {
return colorCodes[isLighter ? "0123456789abcdef".indexOf(c) : "0123456789abcdef".indexOf(c) + 16]; return colorCodes[isLighter ? "0123456789abcdef".indexOf(c) : "0123456789abcdef".indexOf(c) + 16];
} }
/** /**
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders * Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
* and filler. It is assumed that the desired texture ResourceLocation object has been bound using * and filler. It is assumed that the desired texture ResourceLocation object has been bound using
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation). * Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
* *
* @param x x axis offset * @param x x axis offset
* @param y y axis offset * @param y y axis offset
* @param u bound resource location image x offset * @param u bound resource location image x offset
* @param v bound resource location image y offset * @param v bound resource location image y offset
* @param width the desired box width * @param width the desired box width
* @param height the desired box height * @param height the desired box height
* @param textureWidth the width of the box texture in the resource location image * @param textureWidth the width of the box texture in the resource location image
* @param textureHeight the height of the box texture in the resource location image * @param textureHeight the height of the box texture in the resource location image
* @param borderSize the size of the box's borders * @param borderSize the size of the box's borders
* @param zLevel the zLevel to draw at * @param zLevel the zLevel to draw at
*/ */
public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
int borderSize, float zLevel) int borderSize, float zLevel)
{ {
drawContinuousTexturedBox(x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel); drawContinuousTexturedBox(x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel);
} }
/** /**
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders * Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
* and filler. The provided ResourceLocation object will be bound using * and filler. The provided ResourceLocation object will be bound using
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation). * Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
* *
* @param res the ResourceLocation object that contains the desired image * @param res the ResourceLocation object that contains the desired image
* @param x x axis offset * @param x x axis offset
* @param y y axis offset * @param y y axis offset
* @param u bound resource location image x offset * @param u bound resource location image x offset
* @param v bound resource location image y offset * @param v bound resource location image y offset
* @param width the desired box width * @param width the desired box width
* @param height the desired box height * @param height the desired box height
* @param textureWidth the width of the box texture in the resource location image * @param textureWidth the width of the box texture in the resource location image
* @param textureHeight the height of the box texture in the resource location image * @param textureHeight the height of the box texture in the resource location image
* @param borderSize the size of the box's borders * @param borderSize the size of the box's borders
* @param zLevel the zLevel to draw at * @param zLevel the zLevel to draw at
*/ */
public static void drawContinuousTexturedBox(ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, public static void drawContinuousTexturedBox(ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
int borderSize, float zLevel) int borderSize, float zLevel)
{ {
drawContinuousTexturedBox(res, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel); drawContinuousTexturedBox(res, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel);
} }
/** /**
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders * Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
* and filler. The provided ResourceLocation object will be bound using * and filler. The provided ResourceLocation object will be bound using
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation). * Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
* *
* @param res the ResourceLocation object that contains the desired image * @param res the ResourceLocation object that contains the desired image
* @param x x axis offset * @param x x axis offset
* @param y y axis offset * @param y y axis offset
* @param u bound resource location image x offset * @param u bound resource location image x offset
* @param v bound resource location image y offset * @param v bound resource location image y offset
* @param width the desired box width * @param width the desired box width
* @param height the desired box height * @param height the desired box height
* @param textureWidth the width of the box texture in the resource location image * @param textureWidth the width of the box texture in the resource location image
* @param textureHeight the height of the box texture in the resource location image * @param textureHeight the height of the box texture in the resource location image
* @param topBorder the size of the box's top border * @param topBorder the size of the box's top border
* @param bottomBorder the size of the box's bottom border * @param bottomBorder the size of the box's bottom border
* @param leftBorder the size of the box's left border * @param leftBorder the size of the box's left border
* @param rightBorder the size of the box's right border * @param rightBorder the size of the box's right border
* @param zLevel the zLevel to draw at * @param zLevel the zLevel to draw at
*/ */
public static void drawContinuousTexturedBox(ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, public static void drawContinuousTexturedBox(ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel) int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
{ {
Minecraft.getMinecraft().getTextureManager().bindTexture(res); Minecraft.getMinecraft().getTextureManager().bindTexture(res);
drawContinuousTexturedBox(x, y, u, v, width, height, textureWidth, textureHeight, topBorder, bottomBorder, leftBorder, rightBorder, zLevel); drawContinuousTexturedBox(x, y, u, v, width, height, textureWidth, textureHeight, topBorder, bottomBorder, leftBorder, rightBorder, zLevel);
} }
/** /**
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders * Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
* and filler. It is assumed that the desired texture ResourceLocation object has been bound using * and filler. It is assumed that the desired texture ResourceLocation object has been bound using
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation). * Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
* *
* @param x x axis offset * @param x x axis offset
* @param y y axis offset * @param y y axis offset
* @param u bound resource location image x offset * @param u bound resource location image x offset
* @param v bound resource location image y offset * @param v bound resource location image y offset
* @param width the desired box width * @param width the desired box width
* @param height the desired box height * @param height the desired box height
* @param textureWidth the width of the box texture in the resource location image * @param textureWidth the width of the box texture in the resource location image
* @param textureHeight the height of the box texture in the resource location image * @param textureHeight the height of the box texture in the resource location image
* @param topBorder the size of the box's top border * @param topBorder the size of the box's top border
* @param bottomBorder the size of the box's bottom border * @param bottomBorder the size of the box's bottom border
* @param leftBorder the size of the box's left border * @param leftBorder the size of the box's left border
* @param rightBorder the size of the box's right border * @param rightBorder the size of the box's right border
* @param zLevel the zLevel to draw at * @param zLevel the zLevel to draw at
*/ */
public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel) int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0); OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
int fillerWidth = textureWidth - leftBorder - rightBorder; int fillerWidth = textureWidth - leftBorder - rightBorder;
int fillerHeight = textureHeight - topBorder - bottomBorder; int fillerHeight = textureHeight - topBorder - bottomBorder;
int canvasWidth = width - leftBorder - rightBorder; int canvasWidth = width - leftBorder - rightBorder;
@ -133,7 +132,7 @@ public final class HUDUtils
int remainderWidth = canvasWidth % fillerWidth; int remainderWidth = canvasWidth % fillerWidth;
int yPasses = canvasHeight / fillerHeight; int yPasses = canvasHeight / fillerHeight;
int remainderHeight = canvasHeight % fillerHeight; int remainderHeight = canvasHeight % fillerHeight;
// Draw Border // Draw Border
// Top Left // Top Left
drawTexturedModalRect(x, y, u, v, leftBorder, topBorder, zLevel); drawTexturedModalRect(x, y, u, v, leftBorder, topBorder, zLevel);
@ -143,19 +142,19 @@ public final class HUDUtils
drawTexturedModalRect(x, y + topBorder + canvasHeight, u, v + topBorder + fillerHeight, leftBorder, bottomBorder, zLevel); drawTexturedModalRect(x, y + topBorder + canvasHeight, u, v + topBorder + fillerHeight, leftBorder, bottomBorder, zLevel);
// Bottom Right // Bottom Right
drawTexturedModalRect(x + leftBorder + canvasWidth, y + topBorder + canvasHeight, u + leftBorder + fillerWidth, v + topBorder + fillerHeight, rightBorder, bottomBorder, zLevel); drawTexturedModalRect(x + leftBorder + canvasWidth, y + topBorder + canvasHeight, u + leftBorder + fillerWidth, v + topBorder + fillerHeight, rightBorder, bottomBorder, zLevel);
for (int i = 0; i < xPasses + (remainderWidth > 0 ? 1 : 0); i++) for (int i = 0; i < xPasses + (remainderWidth > 0 ? 1 : 0); i++)
{ {
// Top Border // Top Border
drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y, u + leftBorder, v, (i == xPasses ? remainderWidth : fillerWidth), topBorder, zLevel); drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y, u + leftBorder, v, (i == xPasses ? remainderWidth : fillerWidth), topBorder, zLevel);
// Bottom Border // Bottom Border
drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y + topBorder + canvasHeight, u + leftBorder, v + topBorder + fillerHeight, (i == xPasses ? remainderWidth : fillerWidth), bottomBorder, zLevel); drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y + topBorder + canvasHeight, u + leftBorder, v + topBorder + fillerHeight, (i == xPasses ? remainderWidth : fillerWidth), bottomBorder, zLevel);
// Throw in some filler for good measure // Throw in some filler for good measure
for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++) for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++)
drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y + topBorder + (j * fillerHeight), u + leftBorder, v + topBorder, (i == xPasses ? remainderWidth : fillerWidth), (j == yPasses ? remainderHeight : fillerHeight), zLevel); drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y + topBorder + (j * fillerHeight), u + leftBorder, v + topBorder, (i == xPasses ? remainderWidth : fillerWidth), (j == yPasses ? remainderHeight : fillerHeight), zLevel);
} }
// Side Borders // Side Borders
for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++) for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++)
{ {
@ -165,7 +164,7 @@ public final class HUDUtils
drawTexturedModalRect(x + leftBorder + canvasWidth, y + topBorder + (j * fillerHeight), u + leftBorder + fillerWidth, v + topBorder, rightBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel); drawTexturedModalRect(x + leftBorder + canvasWidth, y + topBorder + (j * fillerHeight), u + leftBorder + fillerWidth, v + topBorder, rightBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel);
} }
} }
public static void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel) public static void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel)
{ {
float var7 = 0.00390625F; float var7 = 0.00390625F;
@ -178,7 +177,7 @@ public final class HUDUtils
tessellator.addVertexWithUV((x + 0), (y + 0), zLevel, ((u + 0) * var7), ((v + 0) * var8)); tessellator.addVertexWithUV((x + 0), (y + 0), zLevel, ((u + 0) * var7), ((v + 0) * var8));
tessellator.draw(); tessellator.draw();
} }
/** /**
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the specified position. * Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the specified position.
*/ */
@ -186,7 +185,7 @@ public final class HUDUtils
{ {
renderItemOverlayIntoGUI(fontRenderer, itemStack, x, y, true, true); renderItemOverlayIntoGUI(fontRenderer, itemStack, x, y, true, true);
} }
/** /**
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the specified position. * Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the specified position.
*/ */
@ -212,16 +211,16 @@ public final class HUDUtils
GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
} }
if (showCount) if (showCount)
{ {
int count = 0; int count = 0;
if (itemStack.getMaxStackSize() > 1) if (itemStack.getMaxStackSize() > 1)
count = HUDUtils.countInInventory(Minecraft.getMinecraft().thePlayer, itemStack.getItem(), itemStack.getItemDamage()); count = HUDUtils.countInInventory(Minecraft.getMinecraft().thePlayer, itemStack.getItem(), itemStack.getItemDamage());
else if (itemStack.getItem().equals(Items.bow)) else if (itemStack.getItem().equals(Items.bow))
count = HUDUtils.countInInventory(Minecraft.getMinecraft().thePlayer, Items.arrow); count = HUDUtils.countInInventory(Minecraft.getMinecraft().thePlayer, Items.arrow);
if (count > 1) if (count > 1)
{ {
String var6 = "" + count; String var6 = "" + count;
@ -234,7 +233,7 @@ public final class HUDUtils
} }
} }
} }
/** /**
* Adds a quad to the tesselator at the specified position with the set width and height and color. Args: tessellator, x, y, width, * Adds a quad to the tesselator at the specified position with the set width and height and color. Args: tessellator, x, y, width,
* height, color * height, color
@ -249,12 +248,12 @@ public final class HUDUtils
tessellator.addVertex((x + width), (y + 0), 0.0D); tessellator.addVertex((x + width), (y + 0), 0.0D);
tessellator.draw(); tessellator.draw();
} }
public static int countInInventory(EntityPlayer player, Item item) public static int countInInventory(EntityPlayer player, Item item)
{ {
return countInInventory(player, item, -1); return countInInventory(player, item, -1);
} }
public static int countInInventory(EntityPlayer player, Item item, int md) public static int countInInventory(EntityPlayer player, Item item, int md)
{ {
int count = 0; int count = 0;
@ -263,7 +262,7 @@ public final class HUDUtils
count += player.inventory.mainInventory[i].stackSize; count += player.inventory.mainInventory[i].stackSize;
return count; return count;
} }
public static String stripCtrl(String s) public static String stripCtrl(String s)
{ {
return s.replaceAll("(?i)\247[0-9a-fklmnor]", ""); return s.replaceAll("(?i)\247[0-9a-fklmnor]", "");

View file

@ -1,121 +1,117 @@
package WayofTime.alchemicalWizardry.client.renderer; package WayofTime.alchemicalWizardry.client.renderer;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
import java.util.List; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat; import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles; import java.util.ArrayList;
import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler; import java.util.List;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RenderHelper public class RenderHelper
{ {
public static boolean showEquippedItem = true; public static boolean showEquippedItem = true;
public static boolean enableItemName = false; public static boolean enableItemName = false;
public static boolean enabled = true; public static boolean enabled = true;
public static boolean showInChat = true; public static boolean showInChat = true;
private static int xOffsetDefault = +50; private static int xOffsetDefault = +50;
public static int xOffset = xOffsetDefault; public static int xOffset = xOffsetDefault;
private static int yOffsetDefault = 2; private static int yOffsetDefault = 2;
public static int yOffset = yOffsetDefault; public static int yOffset = yOffsetDefault;
private static int yOffsetBottomCenterDefault = 41; private static int yOffsetBottomCenterDefault = 41;
public static int yOffsetBottomCenter = yOffsetBottomCenterDefault; public static int yOffsetBottomCenter = yOffsetBottomCenterDefault;
private static boolean applyXOffsetToCenterDefault = true; private static boolean applyXOffsetToCenterDefault = true;
public static boolean applyXOffsetToCenter = applyXOffsetToCenterDefault; public static boolean applyXOffsetToCenter = applyXOffsetToCenterDefault;
private static boolean applyYOffsetToMiddleDefault = false; private static boolean applyYOffsetToMiddleDefault = false;
public static boolean applyYOffsetToMiddle = applyYOffsetToMiddleDefault; public static boolean applyYOffsetToMiddle = applyYOffsetToMiddleDefault;
public static String listMode = "horizontal"; public static String listMode = "horizontal";
public static String alignMode = "bottomcenter"; public static String alignMode = "bottomcenter";
private static ScaledResolution scaledResolution; private static ScaledResolution scaledResolution;
public static boolean onTickInGame(Minecraft mc) public static boolean onTickInGame(Minecraft mc)
{ {
if (enabled && (mc.inGameHasFocus || mc.currentScreen == null || (mc.currentScreen instanceof GuiChat && showInChat)) if (enabled && (mc.inGameHasFocus || mc.currentScreen == null || (mc.currentScreen instanceof GuiChat && showInChat))
&& !mc.gameSettings.showDebugInfo) && !mc.gameSettings.showDebugInfo)
{ {
EntityPlayer player = mc.thePlayer; EntityPlayer player = mc.thePlayer;
World world = mc.theWorld; World world = mc.theWorld;
if(SpellHelper.canPlayerSeeAlchemy(player)) if (SpellHelper.canPlayerSeeAlchemy(player))
{ {
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
scaledResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); scaledResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
displayArmorStatus(mc); displayArmorStatus(mc);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
} }
} }
return true; return true;
} }
private static List<HUDElement> getHUDElements(Minecraft mc) private static List<HUDElement> getHUDElements(Minecraft mc)
{ {
List<HUDElement> elements = new ArrayList(); List<HUDElement> elements = new ArrayList();
MovingObjectPosition movingobjectposition = mc.objectMouseOver; MovingObjectPosition movingobjectposition = mc.objectMouseOver;
World world = mc.theWorld; World world = mc.theWorld;
if (movingobjectposition == null) if (movingobjectposition == null)
{ {
return elements; return elements;
} else } else
{ {
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{ {
int x = movingobjectposition.blockX; int x = movingobjectposition.blockX;
int y = movingobjectposition.blockY; int y = movingobjectposition.blockY;
int z = movingobjectposition.blockZ; int z = movingobjectposition.blockZ;
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if(!(tile instanceof IReagentHandler)) if (!(tile instanceof IReagentHandler))
{ {
return elements; return elements;
} }
IReagentHandler relay = (IReagentHandler)tile; IReagentHandler relay = (IReagentHandler) tile;
ReagentContainerInfo[] infos = relay.getContainerInfo(ForgeDirection.getOrientation(movingobjectposition.sideHit)); ReagentContainerInfo[] infos = relay.getContainerInfo(ForgeDirection.getOrientation(movingobjectposition.sideHit));
if(infos != null) if (infos != null)
{ {
for(ReagentContainerInfo info : infos) for (ReagentContainerInfo info : infos)
{ {
if(info == null || info.reagent == null || info.reagent.reagent == null) if (info == null || info.reagent == null || info.reagent.reagent == null)
{ {
continue; continue;
} }
ItemStack itemStack = ReagentRegistry.getItemForReagent(info.reagent.reagent); ItemStack itemStack = ReagentRegistry.getItemForReagent(info.reagent.reagent);
if (itemStack != null) if (itemStack != null)
elements.add(new HUDElement(itemStack, 16, 16, 2, info.reagent.amount)); elements.add(new HUDElement(itemStack, 16, 16, 2, info.reagent.amount));
} }
} }
} }
} }
return elements; return elements;
} }
private static int getX(int width) private static int getX(int width)
{ {
if (alignMode.toLowerCase().contains("center")) if (alignMode.toLowerCase().contains("center"))
return scaledResolution.getScaledWidth() / 2 - width / 2 + (applyXOffsetToCenter ? xOffset : 0); return scaledResolution.getScaledWidth() / 2 - width / 2 + (applyXOffsetToCenter ? xOffset : 0);
@ -124,7 +120,7 @@ public class RenderHelper
else else
return xOffset; return xOffset;
} }
private static int getY(int rowCount, int height) private static int getY(int rowCount, int height)
{ {
if (alignMode.toLowerCase().contains("middle")) if (alignMode.toLowerCase().contains("middle"))
@ -136,49 +132,48 @@ public class RenderHelper
else else
return yOffset; return yOffset;
} }
private static int getElementsWidth(List<HUDElement> elements) private static int getElementsWidth(List<HUDElement> elements)
{ {
int r = 0; int r = 0;
for (HUDElement he : elements) for (HUDElement he : elements)
r += he.width(); r += he.width();
return r; return r;
} }
private static void displayArmorStatus(Minecraft mc) private static void displayArmorStatus(Minecraft mc)
{ {
List<HUDElement> elements = getHUDElements(mc); List<HUDElement> elements = getHUDElements(mc);
if (elements.size() > 0) if (elements.size() > 0)
{ {
int yOffset = enableItemName ? 18 : 16; int yOffset = enableItemName ? 18 : 16;
if (listMode.equalsIgnoreCase("vertical")) if (listMode.equalsIgnoreCase("vertical"))
{ {
int yBase = getY(elements.size(), yOffset); int yBase = getY(elements.size(), yOffset);
for (HUDElement e : elements) for (HUDElement e : elements)
{ {
e.renderToHud((alignMode.toLowerCase().contains("right") ? getX(0) : getX(e.width())), yBase); e.renderToHud((alignMode.toLowerCase().contains("right") ? getX(0) : getX(e.width())), yBase);
yBase += yOffset; yBase += yOffset;
} }
} } else if (listMode.equalsIgnoreCase("horizontal"))
else if (listMode.equalsIgnoreCase("horizontal"))
{ {
int totalWidth = getElementsWidth(elements); int totalWidth = getElementsWidth(elements);
int yBase = getY(1, yOffset); int yBase = getY(1, yOffset);
int xBase = getX(totalWidth); int xBase = getX(totalWidth);
int prevX = 0; int prevX = 0;
for (HUDElement e : elements) for (HUDElement e : elements)
{ {
e.renderToHud(xBase + prevX + (alignMode.toLowerCase().contains("right") ? e.width() : 0), yBase); e.renderToHud(xBase + prevX + (alignMode.toLowerCase().contains("right") ? e.width() : 0), yBase);
prevX += (e.width()); prevX += (e.width());
} }
}else if(listMode.equalsIgnoreCase("compound")) } else if (listMode.equalsIgnoreCase("compound"))
{ {
//TODO //TODO
} }
} }
} }

View file

@ -1,11 +1,13 @@
package WayofTime.alchemicalWizardry.common; package WayofTime.alchemicalWizardry.common;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import java.util.HashMap; import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
import java.util.Iterator; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import java.util.List; import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import java.util.Map; import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile; import net.minecraft.entity.IProjectile;
@ -26,138 +28,132 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn; import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; import java.util.*;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
public class AlchemicalWizardryEventHooks public class AlchemicalWizardryEventHooks
{ {
public static Map<String,Boolean> playerFlightBuff = new HashMap(); public static Map<String, Boolean> playerFlightBuff = new HashMap();
public static Map<String,Boolean> playerBoostStepHeight = new HashMap(); public static Map<String, Boolean> playerBoostStepHeight = new HashMap();
public static List<String> playersWith1Step = new ArrayList(); public static List<String> playersWith1Step = new ArrayList();
public static Map<Integer, List<CoordAndRange>> respawnMap = new HashMap(); public static Map<Integer, List<CoordAndRange>> respawnMap = new HashMap();
public static Map<Integer, List<CoordAndRange>> forceSpawnMap = new HashMap(); public static Map<Integer, List<CoordAndRange>> forceSpawnMap = new HashMap();
@SubscribeEvent @SubscribeEvent
public void onPlayerDamageEvent(LivingAttackEvent event) public void onPlayerDamageEvent(LivingAttackEvent event)
{ {
if(event.source.isProjectile()) if (event.source.isProjectile())
{ {
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionProjProt) && event.isCancelable()) if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionProjProt) && event.isCancelable())
{ {
event.setCanceled(true); event.setCanceled(true);
} }
} }
} }
@SubscribeEvent @SubscribeEvent
public void onLivingSpawnEvent(CheckSpawn event) public void onLivingSpawnEvent(CheckSpawn event)
{ {
if(!(event.entityLiving instanceof EntityMob)) if (!(event.entityLiving instanceof EntityMob))
{ {
return; return;
} }
String respawnRitual = "AW028SpawnWard"; String respawnRitual = "AW028SpawnWard";
Integer dimension = new Integer(event.world.provider.dimensionId); Integer dimension = new Integer(event.world.provider.dimensionId);
if(respawnMap.containsKey(dimension)) if (respawnMap.containsKey(dimension))
{ {
List<CoordAndRange> list = respawnMap.get(dimension); List<CoordAndRange> list = respawnMap.get(dimension);
if(list != null) if (list != null)
{ {
for(CoordAndRange coords : list) for (CoordAndRange coords : list)
{ {
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord); TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
if(tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(respawnRitual)) if (tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(respawnRitual))
{ {
if(event.x > coords.xCoord-coords.horizRadius && event.x < coords.xCoord+coords.horizRadius && event.z > coords.zCoord-coords.horizRadius && event.z < coords.zCoord+coords.horizRadius && event.y > coords.yCoord-coords.vertRadius && event.y < coords.yCoord+coords.vertRadius) if (event.x > coords.xCoord - coords.horizRadius && event.x < coords.xCoord + coords.horizRadius && event.z > coords.zCoord - coords.horizRadius && event.z < coords.zCoord + coords.horizRadius && event.y > coords.yCoord - coords.vertRadius && event.y < coords.yCoord + coords.vertRadius)
{ {
switch(event.getResult()) switch (event.getResult())
{ {
case ALLOW: case ALLOW:
event.setResult(Result.DEFAULT); event.setResult(Result.DEFAULT);
break; break;
case DEFAULT: case DEFAULT:
event.setResult(Result.DENY); event.setResult(Result.DENY);
break; break;
case DENY: case DENY:
break; break;
default: default:
break; break;
} }
break; break;
} }
}else } else
{ {
list.remove(coords); list.remove(coords);
} }
} }
} }
} }
if(event.entityLiving instanceof EntityCreeper) if (event.entityLiving instanceof EntityCreeper)
{ {
return; return;
} }
String forceSpawnRitual = "AW029VeilOfEvil"; String forceSpawnRitual = "AW029VeilOfEvil";
if(forceSpawnMap.containsKey(dimension)) if (forceSpawnMap.containsKey(dimension))
{ {
List<CoordAndRange> list = forceSpawnMap.get(dimension); List<CoordAndRange> list = forceSpawnMap.get(dimension);
if(list != null) if (list != null)
{ {
for(CoordAndRange coords : list) for (CoordAndRange coords : list)
{ {
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord); TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
if(tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(forceSpawnRitual)) if (tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(forceSpawnRitual))
{ {
if(event.x > coords.xCoord-coords.horizRadius && event.x < coords.xCoord+coords.horizRadius && event.z > coords.zCoord-coords.horizRadius && event.z < coords.zCoord+coords.horizRadius && event.y > coords.yCoord-coords.vertRadius && event.y < coords.yCoord+coords.vertRadius) if (event.x > coords.xCoord - coords.horizRadius && event.x < coords.xCoord + coords.horizRadius && event.z > coords.zCoord - coords.horizRadius && event.z < coords.zCoord + coords.horizRadius && event.y > coords.yCoord - coords.vertRadius && event.y < coords.yCoord + coords.vertRadius)
{ {
switch(event.getResult()) switch (event.getResult())
{ {
case ALLOW: case ALLOW:
break; break;
case DEFAULT: case DEFAULT:
event.setResult(Result.ALLOW); event.setResult(Result.ALLOW);
break; break;
case DENY: case DENY:
event.setResult(Result.DEFAULT); event.setResult(Result.DEFAULT);
break; break;
default: default:
break; break;
} }
break; break;
} }
}else } else
{ {
list.remove(coords); list.remove(coords);
} }
} }
} }
} }
} }
@SubscribeEvent @SubscribeEvent
public void onPlayerRespawnEvent(PlayerRespawnEvent event) public void onPlayerRespawnEvent(PlayerRespawnEvent event)
{ {
if(AlchemicalWizardry.respawnWithDebuff) if (AlchemicalWizardry.respawnWithDebuff)
{ {
event.player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionSoulFray.id, 20*60*5,0)); event.player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionSoulFray.id, 20 * 60 * 5, 0));
} }
} }
@SubscribeEvent @SubscribeEvent
public void onLivingJumpEvent(LivingJumpEvent event) public void onLivingJumpEvent(LivingJumpEvent event)
{ {
@ -165,21 +161,21 @@ public class AlchemicalWizardryEventHooks
{ {
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier(); int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier();
event.entityLiving.motionY += (0.1f) * (2 + i); event.entityLiving.motionY += (0.1f) * (2 + i);
} }
if(event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart)) if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart))
{ {
event.entityLiving.motionY = 0; event.entityLiving.motionY = 0;
} }
} }
@SubscribeEvent @SubscribeEvent
public void onEndermanTeleportEvent(EnderTeleportEvent event) public void onEndermanTeleportEvent(EnderTeleportEvent event)
{ {
if(event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding) && event.isCancelable()) if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding) && event.isCancelable())
{ {
event.setCanceled(true); event.setCanceled(true);
} }
} }
@SubscribeEvent @SubscribeEvent
@ -198,18 +194,18 @@ public class AlchemicalWizardryEventHooks
((EntityLivingBase) entityAttacking).attackEntityFrom(DamageSource.generic, damageRecieve); ((EntityLivingBase) entityAttacking).attackEntityFrom(DamageSource.generic, damageRecieve);
} }
} }
if(entityAttacked.isPotionActive(AlchemicalWizardry.customPotionFlameCloak)) if (entityAttacked.isPotionActive(AlchemicalWizardry.customPotionFlameCloak))
{ {
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak).getAmplifier(); int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak).getAmplifier();
Entity entityAttacking = event.source.getSourceOfDamage(); Entity entityAttacking = event.source.getSourceOfDamage();
if(entityAttacking != null && entityAttacking instanceof EntityLivingBase && !entityAttacking.isImmuneToFire() && !((EntityLivingBase)entityAttacking).isPotionActive(Potion.fireResistance)) if (entityAttacking != null && entityAttacking instanceof EntityLivingBase && !entityAttacking.isImmuneToFire() && !((EntityLivingBase) entityAttacking).isPotionActive(Potion.fireResistance))
{ {
entityAttacking.attackEntityFrom(DamageSource.inFire, 2*i+2); entityAttacking.attackEntityFrom(DamageSource.inFire, 2 * i + 2);
entityAttacking.setFire(3); entityAttacking.setFire(3);
} }
} }
} }
@ -227,7 +223,7 @@ public class AlchemicalWizardryEventHooks
// ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, event.player.capabilities, Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"}); // ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, event.player.capabilities, Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"});
// } // }
// } // }
@SubscribeEvent @SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) public void onEntityUpdate(LivingUpdateEvent event)
{ {
@ -235,17 +231,17 @@ public class AlchemicalWizardryEventHooks
double x = entityLiving.posX; double x = entityLiving.posX;
double y = entityLiving.posY; double y = entityLiving.posY;
double z = entityLiving.posZ; double z = entityLiving.posZ;
Vec3 blockVector = SpellHelper.getEntityBlockVector(entityLiving);
int xPos = (int)(blockVector.xCoord);
int yPos = (int)(blockVector.yCoord);
int zPos = (int)(blockVector.zCoord);
if(entityLiving instanceof EntityPlayer) Vec3 blockVector = SpellHelper.getEntityBlockVector(entityLiving);
int xPos = (int) (blockVector.xCoord);
int yPos = (int) (blockVector.yCoord);
int zPos = (int) (blockVector.zCoord);
if (entityLiving instanceof EntityPlayer)
{ {
ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, ((EntityPlayer)event.entityLiving).capabilities, Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"}); ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, ((EntityPlayer) event.entityLiving).capabilities, Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"});
} }
if (entityLiving instanceof EntityPlayer && entityLiving.worldObj.isRemote) if (entityLiving instanceof EntityPlayer && entityLiving.worldObj.isRemote)
{ {
EntityPlayer entityPlayer = (EntityPlayer) entityLiving; EntityPlayer entityPlayer = (EntityPlayer) entityLiving;
@ -266,9 +262,9 @@ public class AlchemicalWizardryEventHooks
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionFeatherFall)) if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionFeatherFall))
{ {
event.entityLiving.fallDistance = 0; event.entityLiving.fallDistance = 0;
} }
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionDrowning)) if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionDrowning))
{ {
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionDrowning).getAmplifier(); int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionDrowning).getAmplifier();
@ -293,8 +289,8 @@ public class AlchemicalWizardryEventHooks
EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving; EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving;
entityPlayer.stepHeight = 1.0f; entityPlayer.stepHeight = 1.0f;
if((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F) if ((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F)
entityPlayer.moveFlying(0F, 1F, entityPlayer.capabilities.isFlying ? (percentIncrease/2.0f) : percentIncrease); entityPlayer.moveFlying(0F, 1F, entityPlayer.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease);
} }
} }
} }
@ -306,7 +302,7 @@ public class AlchemicalWizardryEventHooks
int posX = (int) Math.round(entity.posX - 0.5f); int posX = (int) Math.round(entity.posX - 0.5f);
int posY = (int) Math.round(entity.posY); int posY = (int) Math.round(entity.posY);
int posZ = (int) Math.round(entity.posZ - 0.5f); int posZ = (int) Math.round(entity.posZ - 0.5f);
int d0 = (int)((i+1)*2.5); int d0 = (int) ((i + 1) * 2.5);
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5).expand(d0, d0, d0); AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5).expand(d0, d0, d0);
List list = event.entityLiving.worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb); List list = event.entityLiving.worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb);
Iterator iterator = list.iterator(); Iterator iterator = list.iterator();
@ -325,7 +321,7 @@ public class AlchemicalWizardryEventHooks
{ {
continue; continue;
} }
Entity throwingEntity = null; Entity throwingEntity = null;
if (projectile instanceof EntityArrow) if (projectile instanceof EntityArrow)
@ -334,29 +330,29 @@ public class AlchemicalWizardryEventHooks
} else if (projectile instanceof EnergyBlastProjectile) } else if (projectile instanceof EnergyBlastProjectile)
{ {
throwingEntity = ((EnergyBlastProjectile) projectile).shootingEntity; throwingEntity = ((EnergyBlastProjectile) projectile).shootingEntity;
}else if(projectile instanceof EntityThrowable) } else if (projectile instanceof EntityThrowable)
{ {
throwingEntity = ((EntityThrowable) projectile).getThrower(); throwingEntity = ((EntityThrowable) projectile).getThrower();
} }
if(throwingEntity != null && throwingEntity.equals(entity)) if (throwingEntity != null && throwingEntity.equals(entity))
{ {
continue; continue;
} }
double delX = projectile.posX - entity.posX; double delX = projectile.posX - entity.posX;
double delY = projectile.posY - entity.posY; double delY = projectile.posY - entity.posY;
double delZ = projectile.posZ - entity.posZ; double delZ = projectile.posZ - entity.posZ;
if(throwingEntity != null) if (throwingEntity != null)
{ {
delX = -projectile.posX + throwingEntity.posX; delX = -projectile.posX + throwingEntity.posX;
delY = -projectile.posY + (throwingEntity.posY + throwingEntity.getEyeHeight()); delY = -projectile.posY + (throwingEntity.posY + throwingEntity.getEyeHeight());
delZ = -projectile.posZ + throwingEntity.posZ; delZ = -projectile.posZ + throwingEntity.posZ;
} }
double curVel = Math.sqrt(delX * delX + delY * delY + delZ * delZ); double curVel = Math.sqrt(delX * delX + delY * delY + delZ * delZ);
delX /= curVel; delX /= curVel;
delY /= curVel; delY /= curVel;
delZ /= curVel; delZ /= curVel;
@ -376,7 +372,6 @@ public class AlchemicalWizardryEventHooks
String ownerName = SpellHelper.getUsername(entityPlayer); String ownerName = SpellHelper.getUsername(entityPlayer);
playerFlightBuff.put(ownerName, true); playerFlightBuff.put(ownerName, true);
entityPlayer.capabilities.allowFlying = true; entityPlayer.capabilities.allowFlying = true;
//entityPlayer.sendPlayerAbilities();
} }
} else } else
{ {
@ -403,75 +398,75 @@ public class AlchemicalWizardryEventHooks
} }
} }
} }
if(entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlameCloak)) if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlameCloak))
{ {
entityLiving.worldObj.spawnParticle("flame", x+SpellHelper.gaussian(1),y-1.3+SpellHelper.gaussian(0.3),z+SpellHelper.gaussian(1), 0, 0.06d, 0); entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak).getAmplifier(); int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak).getAmplifier();
double range = i*0.5; double range = i * 0.5;
List<Entity> entities = SpellHelper.getEntitiesInRange(entityLiving.worldObj, x, y, z, range, range); List<Entity> entities = SpellHelper.getEntitiesInRange(entityLiving.worldObj, x, y, z, range, range);
if(entities!=null) if (entities != null)
{ {
for(Entity entity : entities) for (Entity entity : entities)
{ {
if(!entity.equals(entityLiving)&&!entity.isImmuneToFire()&&!(entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.fireResistance))) if (!entity.equals(entityLiving) && !entity.isImmuneToFire() && !(entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isPotionActive(Potion.fireResistance)))
{ {
entity.setFire(3); entity.setFire(3);
} }
} }
} }
} }
if(entityLiving.isPotionActive(AlchemicalWizardry.customPotionIceCloak)) if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionIceCloak))
{ {
if(entityLiving.worldObj.getWorldTime()%2==0) if (entityLiving.worldObj.getWorldTime() % 2 == 0)
entityLiving.worldObj.spawnParticle("reddust", x+SpellHelper.gaussian(1),y-1.3+SpellHelper.gaussian(0.3),z+SpellHelper.gaussian(1), 0x74,0xbb,0xfb); entityLiving.worldObj.spawnParticle("reddust", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0x74, 0xbb, 0xfb);
int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionIceCloak).getAmplifier(); int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionIceCloak).getAmplifier();
int horizRange = r+1; int horizRange = r + 1;
int vertRange = 1; int vertRange = 1;
if(!entityLiving.worldObj.isRemote) if (!entityLiving.worldObj.isRemote)
{ {
for(int i=-horizRange; i<=horizRange;i++) for (int i = -horizRange; i <= horizRange; i++)
{ {
for(int k=-horizRange; k<=horizRange;k++) for (int k = -horizRange; k <= horizRange; k++)
{ {
for(int j=-vertRange-1; j<=vertRange-1; j++) for (int j = -vertRange - 1; j <= vertRange - 1; j++)
{ {
SpellHelper.freezeWaterBlock(entityLiving.worldObj, xPos+i, yPos+j, zPos+k); SpellHelper.freezeWaterBlock(entityLiving.worldObj, xPos + i, yPos + j, zPos + k);
} }
} }
} }
} }
}
if(entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart))
{
entityLiving.worldObj.spawnParticle("flame", x+SpellHelper.gaussian(1),y-1.3+SpellHelper.gaussian(0.3),z+SpellHelper.gaussian(1), 0, 0.06d, 0);
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionHeavyHeart).getAmplifier();
double decrease = 0.025*(i+1);
if(entityLiving.motionY>-0.9)
{
entityLiving.motionY-=decrease;
}
} }
if(entityLiving.isPotionActive(AlchemicalWizardry.customPotionFireFuse)) if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart))
{ {
entityLiving.worldObj.spawnParticle("flame", x+SpellHelper.gaussian(1),y-1.3+SpellHelper.gaussian(0.3),z+SpellHelper.gaussian(1), 0, 0.06d, 0); entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionHeavyHeart).getAmplifier();
double decrease = 0.025 * (i + 1);
if (entityLiving.motionY > -0.9)
{
entityLiving.motionY -= decrease;
}
}
if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionFireFuse))
{
entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getAmplifier(); int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getAmplifier();
int radius = r+1; int radius = r + 1;
if(entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getDuration()<=2) if (entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getDuration() <= 2)
{ {
entityLiving.worldObj.createExplosion(null, x, y, z, radius, false); entityLiving.worldObj.createExplosion(null, x, y, z, radius, false);
} }
} }
} }
} }

View file

@ -1,5 +1,9 @@
package WayofTime.alchemicalWizardry.common; package WayofTime.alchemicalWizardry.common;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.items.LavaCrystal;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.common.IFuelHandler;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -7,10 +11,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.items.LavaCrystal;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.common.IFuelHandler;
public class AlchemicalWizardryFuelHandler implements IFuelHandler public class AlchemicalWizardryFuelHandler implements IFuelHandler
{ {
@ -18,19 +18,15 @@ public class AlchemicalWizardryFuelHandler implements IFuelHandler
public int getBurnTime(ItemStack fuel) public int getBurnTime(ItemStack fuel)
{ {
ItemStack itemStack = fuel; ItemStack itemStack = fuel;
if(itemStack == null) if (itemStack == null)
{ {
return 0; return 0;
} }
Item fuelItem = itemStack.getItem(); Item fuelItem = itemStack.getItem();
if (fuelItem.equals(ModItems.lavaCrystal)) if (fuelItem.equals(ModItems.lavaCrystal))
{ {
/*ItemStack newItem = new ItemStack(AlchemicalWizardry.lavaCrystal);
newItem.getItem().setDamage(newItem, 50);
fuel.getItem().setContainerItem(((LavaCrystal)newItem.getItem()).change());
*/
LavaCrystal item = (LavaCrystal) fuel.getItem(); LavaCrystal item = (LavaCrystal) fuel.getItem();
if (item.hasEnoughEssence(fuel)) if (item.hasEnoughEssence(fuel))
@ -66,7 +62,7 @@ public class AlchemicalWizardryFuelHandler implements IFuelHandler
return 0; return 0;
} }
} }
return 0; return 0;
} }
} }

View file

@ -1,47 +0,0 @@
package WayofTime.alchemicalWizardry.common;
import java.util.EnumSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerCapabilities;
import net.minecraft.server.MinecraftServer;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
@Deprecated
public class AlchemicalWizardryTickHandler //implements ITickHandler
{
// public void tickStart(EnumSet<TickType> type, Object... tickData)
// {
// }
//
// public EnumSet<TickType> ticks()
// {
// return EnumSet.of(TickType.PLAYER);
// }
//
// public String getLabel()
// {
// return "BloodMagic";
// }
//
// public void tickEnd(EnumSet<TickType> type, Object... tickData)
// {
// String[] usernames = MinecraftServer.getServer().getAllUsernames();
//
// if (usernames == null)
// {
// return;
// }
//
// for (String userName : usernames)
// {
// EntityPlayer entityPlayer = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(userName);
//
// if (entityPlayer != null)
// {
// ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, entityPlayer.capabilities, Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"});
// //entityPlayer.sendPlayerAbilities();
// }
// }
// }
}

View file

@ -1,27 +1,13 @@
package WayofTime.alchemicalWizardry.common; package WayofTime.alchemicalWizardry.common;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; import WayofTime.alchemicalWizardry.common.entity.projectile.*;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityBloodLightProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaMainProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaSecondaryProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityMeteor;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityParticleBeam;
import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.LightningBoltProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.MudProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.TeleportProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.WaterProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.world.World;
public class CommonProxy public class CommonProxy
{ {
@ -49,7 +35,6 @@ public class CommonProxy
public void registerEvents() public void registerEvents()
{ {
} }
public void registerSoundHandler() public void registerSoundHandler()

View file

@ -1,25 +1,25 @@
package WayofTime.alchemicalWizardry.common; package WayofTime.alchemicalWizardry.common;
public class CoordAndRange public class CoordAndRange
{ {
public int xCoord; public int xCoord;
public int yCoord; public int yCoord;
public int zCoord; public int zCoord;
public int horizRadius; public int horizRadius;
public int vertRadius; public int vertRadius;
public CoordAndRange(int x, int y, int z, int horiz, int vert) public CoordAndRange(int x, int y, int z, int horiz, int vert)
{ {
this.xCoord = x; this.xCoord = x;
this.yCoord = y; this.yCoord = y;
this.zCoord = z; this.zCoord = z;
this.horizRadius = horiz; this.horizRadius = horiz;
this.vertRadius = vert; this.vertRadius = vert;
} }
@Override @Override
public boolean equals(Object o) public boolean equals(Object o)
{ {
return o instanceof CoordAndRange ? ((CoordAndRange)o).xCoord == this.xCoord && ((CoordAndRange)o).yCoord == this.yCoord && ((CoordAndRange)o).zCoord == this.zCoord && ((CoordAndRange)o).horizRadius == this.horizRadius && ((CoordAndRange)o).vertRadius == this.vertRadius: false; return o instanceof CoordAndRange ? ((CoordAndRange) o).xCoord == this.xCoord && ((CoordAndRange) o).yCoord == this.yCoord && ((CoordAndRange) o).zCoord == this.zCoord && ((CoordAndRange) o).horizRadius == this.horizRadius && ((CoordAndRange) o).vertRadius == this.vertRadius : false;
} }
} }

View file

@ -1,5 +0,0 @@
package WayofTime.alchemicalWizardry.common;
public class EntityAIFly
{
}

View file

@ -1,15 +1,14 @@
package WayofTime.alchemicalWizardry.common; package WayofTime.alchemicalWizardry.common;
import ibxm.Player; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityElemental;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.IMob; import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityElemental;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class EntityAirElemental extends EntityElemental implements IMob public class EntityAirElemental extends EntityElemental implements IMob
{ {
@ -22,7 +21,7 @@ public class EntityAirElemental extends EntityElemental implements IMob
{ {
if (target instanceof EntityPlayer) if (target instanceof EntityPlayer)
{ {
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)target, target.motionX, target.motionY + 3, target.motionZ); SpellHelper.setPlayerSpeedFromServer((EntityPlayer) target, target.motionX, target.motionY + 3, target.motionZ);
((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0)); ((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0));
} else if (target instanceof EntityLivingBase) } else if (target instanceof EntityLivingBase)
{ {

View file

@ -3,36 +3,36 @@ package WayofTime.alchemicalWizardry.common;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
public class Int3 public class Int3
{ {
public int xCoord; public int xCoord;
public int yCoord; public int yCoord;
public int zCoord; public int zCoord;
public Int3(int xCoord, int yCoord, int zCoord) public Int3(int xCoord, int yCoord, int zCoord)
{ {
this.xCoord = xCoord; this.xCoord = xCoord;
this.yCoord = yCoord; this.yCoord = yCoord;
this.zCoord = zCoord; this.zCoord = zCoord;
} }
public static Int3 readFromNBT(NBTTagCompound tag) public static Int3 readFromNBT(NBTTagCompound tag)
{ {
return new Int3(tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord")); return new Int3(tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord"));
} }
public NBTTagCompound writeToNBT(NBTTagCompound tag) public NBTTagCompound writeToNBT(NBTTagCompound tag)
{ {
tag.setInteger("xCoord", xCoord); tag.setInteger("xCoord", xCoord);
tag.setInteger("yCoord", yCoord); tag.setInteger("yCoord", yCoord);
tag.setInteger("zCoord", zCoord); tag.setInteger("zCoord", zCoord);
return tag; return tag;
} }
@Override @Override
public boolean equals(Object o) public boolean equals(Object o)
{ {
return o instanceof Int3 ? ((Int3)o).xCoord == this.xCoord && ((Int3)o).yCoord == this.yCoord && ((Int3)o).zCoord == this.zCoord : false; return o instanceof Int3 ? ((Int3) o).xCoord == this.xCoord && ((Int3) o).yCoord == this.yCoord && ((Int3) o).zCoord == this.zCoord : false;
} }
} }

View file

@ -1,14 +1,14 @@
package WayofTime.alchemicalWizardry.common; package WayofTime.alchemicalWizardry.common;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.ModItems;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.FillBucketEvent; import net.minecraftforge.event.entity.player.FillBucketEvent;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.ModItems;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class LifeBucketHandler public class LifeBucketHandler
{ {
@ -30,7 +30,7 @@ public class LifeBucketHandler
{ {
Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ); Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
if (block!=null && (block.equals(ModBlocks.blockLifeEssence)) && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0) if (block != null && (block.equals(ModBlocks.blockLifeEssence)) && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0)
{ {
world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ); world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
return new ItemStack(ModItems.bucketLife); return new ItemStack(ModItems.bucketLife);

View file

@ -7,11 +7,8 @@ public class LifeEssence extends Fluid
public LifeEssence(String fluidName) public LifeEssence(String fluidName)
{ {
super(fluidName); super(fluidName);
//setUnlocalizedName("lifeEssence");
//setBlockID(id);
this.setDensity(2000); this.setDensity(2000);
this.setViscosity(2000); this.setViscosity(2000);
//this.setFlowingIcon(flowingIcon)
} }
@Override @Override

View file

@ -1,11 +1,11 @@
package WayofTime.alchemicalWizardry.common; package WayofTime.alchemicalWizardry.common;
import WayofTime.alchemicalWizardry.ModItems;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent;
import WayofTime.alchemicalWizardry.ModItems;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class ModLivingDropsEvent public class ModLivingDropsEvent
{ {

View file

@ -1,966 +0,0 @@
package WayofTime.alchemicalWizardry.common;
import ibxm.Player;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Random;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;
import com.jcraft.jogg.Packet;
public class PacketHandler //implements IPacketHandler
{
// @Override
// public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
// {
// if (packet.channel.equals("BloodAltar"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// int x = dat.readInt();
// int y = dat.readInt();
// int z = dat.readInt();
// boolean hasStacks = dat.readByte() != 0;
// int[] items = new int[0];
//
// if (hasStacks)
// {
// items = new int[1 * 3];
//
// for (int i = 0; i < items.length; i++)
// {
// items[i] = dat.readInt();
// }
// }
//
// int fluidIDMain = dat.readInt();
// int fluidAmountMain = dat.readInt();
// int fluidIDOutput = dat.readInt();
// int fluidAmountOutput = dat.readInt();
// int fluidIDInput = dat.readInt();
// int fluidAmountInput = dat.readInt();
// int capacity = dat.readInt();
// World world = AlchemicalWizardry.proxy.getClientWorld();
// TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//
// if (tileEntity instanceof TEAltar)
// {
// TEAltar tileEntityAltar = (TEAltar) tileEntity;
// FluidStack flMain = new FluidStack(fluidIDMain, fluidAmountMain);
// FluidStack flOutput = new FluidStack(fluidIDOutput, fluidAmountOutput);
// FluidStack flInput = new FluidStack(fluidIDInput, fluidAmountInput);
// tileEntityAltar.handlePacketData(items, flMain, flOutput, flInput, capacity);
// }
// } else if (packet.channel.equals("FallReset"))
// {
// if (player instanceof EntityPlayer)
// {
// ((EntityPlayer) player).fallDistance = 0;
// }
// } else if (packet.channel.equals("particle"))
// {
// ByteArrayInputStream bin = new ByteArrayInputStream(packet.data);
// DataInputStream din = new DataInputStream(bin);
// Random rand = new Random();
//
// try
// {
// double x = din.readDouble();
// double y = din.readDouble();
// double z = din.readDouble();
// short particleType = din.readShort();
// World world = ((EntityPlayer) player).worldObj;
//
// if (particleType == 1)
// {
// world.spawnParticle("mobSpell", x + 0.5D + rand.nextGaussian() / 8, y + 1.1D, z + 0.5D + rand.nextGaussian() / 8, 0.5117D, 0.0117D, 0.0117D);
// }
//
// if (particleType == 2)
// {
// world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 1.1D, z + 0.5D + rand.nextGaussian() / 8, 0.82D, 0.941D, 0.91D);
// }
//
// if (particleType == 3)
// {
// world.spawnParticle("mobSpell", x + 0.5D + rand.nextGaussian() / 8, y + 1.1D, z + 0.5D + rand.nextGaussian() / 8, 1.0D, 0.371D, 0.371D);
// }
//
// if (particleType == 4)
// {
// float f = (float) 1.0F;
// float f1 = f * 0.6F + 0.4F;
// float f2 = f * f * 0.7F - 0.5F;
// float f3 = f * f * 0.6F - 0.7F;
//
// for (int l = 0; l < 8; ++l)
// {
// world.spawnParticle("reddust", x + Math.random() - Math.random(), y + Math.random() - Math.random(), z + Math.random() - Math.random(), f1, f2, f3);
// }
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// } else if (packet.channel.equals("CustomParticle"))
// {
// ByteArrayInputStream bin = new ByteArrayInputStream(packet.data);
// DataInputStream din = new DataInputStream(bin);
// Random rand = new Random();
//
// try
// {
// World world = ((EntityPlayer) player).worldObj;
// int size = din.readInt();
// String str = "";
//
// for (int i = 0; i < size; i++)
// {
// str = str + din.readChar();
// }
//
// double x = din.readDouble();
// double y = din.readDouble();
// double z = din.readDouble();
// double xVel = din.readDouble();
// double yVel = din.readDouble();
// double zVel = din.readDouble();
// world.spawnParticle(str, x, y, z, xVel, yVel, zVel);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// } else if (packet.channel.equals("SetLifeEssence")) //Sets the data for the character
// {
// ByteArrayInputStream bin = new ByteArrayInputStream(packet.data);
// DataInputStream din = new DataInputStream(bin);
//
// try
// {
// EntityPlayer user = (EntityPlayer) player;
// int length = din.readInt();
// String ownerName = "";
//
// for (int i = 0; i < length; i++)
// {
// ownerName = ownerName + din.readChar();
// }
//
// int addedEssence = din.readInt();
// int maxEssence = din.readInt();
// World world = MinecraftServer.getServer().worldServers[0];
// LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
//
// if (data == null)
// {
// data = new LifeEssenceNetwork(ownerName);
// world.setItemData(ownerName, data);
// }
//
// if (addedEssence > 0)
// {
// if (data.currentEssence < maxEssence)
// {
// data.currentEssence = Math.min(maxEssence, data.currentEssence + addedEssence);
// data.markDirty();
// }
//
// if (!user.capabilities.isCreativeMode)
// {
// for (int i = 0; i < ((addedEssence + 99) / 100); i++)
// {
// //player.setEntityHealth((player.getHealth()-1));
// user.setHealth((user.getHealth() - 1));
//
// if (user.getHealth() <= 0.5f)
// {
// //user.inventory.dropAllItems();
// user.onDeath(DamageSource.generic);
// return;
// }
// }
// }
// } else
// {
// int removedEssence = -addedEssence;
//
// if ((data.currentEssence - removedEssence) >= 0)
// {
// data.currentEssence -= removedEssence;
// data.markDirty();
// } else
// {
// if (removedEssence >= 100)
// {
// for (int i = 0; i < ((removedEssence + 99) / 100); i++)
// {
// //player.setEntityHealth((player.getHealth()-1));
// user.setHealth((user.getHealth() - 1));
//
// if (user.getHealth() <= 0.5f)
// {
// //user.inventory.dropAllItems();
// user.onDeath(DamageSource.generic);
// return;
// }
// }
// } else
// {
// if (user.worldObj.rand.nextInt(100) <= removedEssence)
// {
// user.setHealth((user.getHealth() - 1));
//
// if (user.getHealth() <= 0.5f)
// {
// //user.inventory.dropAllItems();
// user.onDeath(DamageSource.generic);
// return;
// }
// }
// }
// }
// }
//
// //PacketDispatcher.sendPacketToPlayer(PacketHandler.getPacket(ownerName), (Player)user);
//// data.currentEssence = addedEssence;
//// data.markDirty();
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// } else if (packet.channel.equals("InfiniteLPPath"))
// {
// ByteArrayInputStream bin = new ByteArrayInputStream(packet.data);
// DataInputStream din = new DataInputStream(bin);
//
// try
// {
// EntityPlayer user = (EntityPlayer) player;
// int length = din.readInt();
// String ownerName = "";
//
// for (int i = 0; i < length; i++)
// {
// ownerName = ownerName + din.readChar();
// }
//
// boolean fill = din.readBoolean();
// World world = MinecraftServer.getServer().worldServers[0];
// LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
//
// if (data == null)
// {
// data = new LifeEssenceNetwork(ownerName);
// world.setItemData(ownerName, data);
// }
//
// if (fill)
// {
// data.currentEssence += 1000000;
// data.markDirty();
// } else
// {
// data.currentEssence = 0;
// data.markDirty();
// }
//
// //PacketDispatcher.sendPacketToPlayer(PacketHandler.getPacket(ownerName), (Player)user);
//// data.currentEssence = addedEssence;
//// data.markDirty();
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// } else if (packet.channel.equals("GetLifeEssence"))
// {
// ByteArrayInputStream bin = new ByteArrayInputStream(packet.data);
// DataInputStream din = new DataInputStream(bin);
//
// try
// {
// int length = din.readInt();
// String ownerName = "";
//
// for (int i = 0; i < length; i++)
// {
// ownerName = ownerName + din.readChar();
// }
//
// World world = MinecraftServer.getServer().worldServers[0];
// LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
//
// if (data == null)
// {
// data = new LifeEssenceNetwork(ownerName);
// world.setItemData(ownerName, data);
// }
//
// if (player instanceof EntityPlayer)
// {
// EntityPlayer owner = (EntityPlayer) player;
// ChatMessageComponent chatmessagecomponent = new ChatMessageComponent();
// //chatmessagecomponent.func_111072_b("Current Essence: " + data.currentEssence + "LP");
// chatmessagecomponent.addText("Current Essence: " + data.currentEssence + "LP");
// owner.sendChatToPlayer(chatmessagecomponent);
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// } else if (packet.channel.equals("GetAltarEssence"))
// {
// ByteArrayInputStream bin = new ByteArrayInputStream(packet.data);
// DataInputStream din = new DataInputStream(bin);
//
// try
// {
// int x = din.readInt();
// int y = din.readInt();
// int z = din.readInt();
//
// if (player instanceof EntityPlayer)
// {
// EntityPlayer owner = (EntityPlayer) player;
// World world = owner.worldObj;
// TEAltar tileEntity = (TEAltar) world.getBlockTileEntity(x, y, z);
//
// if (tileEntity != null)
// {
// int level = UpgradedAltars.isAltarValid(world, x, y, z);
// ChatMessageComponent chatmessagecomponent = new ChatMessageComponent();
// chatmessagecomponent.addText("Altar's Current Essence: " + tileEntity.getFluidAmount() + "LP" + "\n" + "Altar's Current Tier: " + level + "\nCapacity: " + tileEntity.getCapacity() + "LP");
// //chatmessagecomponent.addText();
// owner.sendChatToPlayer(chatmessagecomponent);
// }
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// } else if (packet.channel.equals("TESocket"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// int x = dat.readInt();
// int y = dat.readInt();
// int z = dat.readInt();
// boolean hasStacks = dat.readByte() != 0;
// int[] items = new int[0];
//
// if (hasStacks)
// {
// items = new int[1 * 3];
//
// for (int i = 0; i < items.length; i++)
// {
// items[i] = dat.readInt();
// }
// }
//
// World world = AlchemicalWizardry.proxy.getClientWorld();
// TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//
// if (tileEntity instanceof TESocket)
// {
// TESocket tileEntityAltar = (TESocket) tileEntity;
// tileEntityAltar.handlePacketData(items);
// }
// } else if (packet.channel.equals("TEWritingTable"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// int x = dat.readInt();
// int y = dat.readInt();
// int z = dat.readInt();
// boolean hasStacks = dat.readByte() != 0;
// int[] items = new int[0];
//
// if (hasStacks)
// {
// items = new int[7 * 3];
//
// for (int i = 0; i < items.length; i++)
// {
// items[i] = dat.readInt();
// }
// }
//
// World world = AlchemicalWizardry.proxy.getClientWorld();
// TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//
// if (tileEntity instanceof TEWritingTable)
// {
// TEWritingTable tileEntityAltar = (TEWritingTable) tileEntity;
// tileEntityAltar.handlePacketData(items);
// }
// } else if (packet.channel.equals("TEOrientor"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// int x = dat.readInt();
// int y = dat.readInt();
// int z = dat.readInt();
// World world = AlchemicalWizardry.proxy.getClientWorld();
// TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//
// if (tileEntity instanceof TEOrientable)
// {
// TEOrientable tileEntityOrientable = (TEOrientable) tileEntity;
// tileEntityOrientable.setInputDirection(ForgeDirection.getOrientation(dat.readInt()));
// tileEntityOrientable.setOutputDirection(ForgeDirection.getOrientation(dat.readInt()));
// world.markBlockForRenderUpdate(x, y, z);
// }
// } else if (packet.channel.equals("TEPedestal"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// int x = dat.readInt();
// int y = dat.readInt();
// int z = dat.readInt();
// boolean hasStacks = dat.readByte() != 0;
// int[] items = new int[0];
//
// if (hasStacks)
// {
// items = new int[1 * 3];
//
// for (int i = 0; i < items.length; i++)
// {
// items[i] = dat.readInt();
// }
// }
//
// World world = AlchemicalWizardry.proxy.getClientWorld();
// TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//
// if (tileEntity instanceof TEPedestal)
// {
// TEPedestal tileEntityAltar = (TEPedestal) tileEntity;
// tileEntityAltar.handlePacketData(items);
// }
// } else if (packet.channel.equals("TEPlinth"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// int x = dat.readInt();
// int y = dat.readInt();
// int z = dat.readInt();
// boolean hasStacks = dat.readByte() != 0;
// int[] items = new int[0];
//
// if (hasStacks)
// {
// items = new int[1 * 3];
//
// for (int i = 0; i < items.length; i++)
// {
// items[i] = dat.readInt();
// }
// }
//
// World world = AlchemicalWizardry.proxy.getClientWorld();
// TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//
// if (tileEntity instanceof TEPlinth)
// {
// TEPlinth tileEntityAltar = (TEPlinth) tileEntity;
// tileEntityAltar.handlePacketData(items);
// }
// } else if (packet.channel.equals("TETeleposer"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// int x = dat.readInt();
// int y = dat.readInt();
// int z = dat.readInt();
// boolean hasStacks = dat.readByte() != 0;
// int[] items = new int[0];
//
// if (hasStacks)
// {
// items = new int[1 * 3];
//
// for (int i = 0; i < items.length; i++)
// {
// items[i] = dat.readInt();
// }
// }
//
// World world = AlchemicalWizardry.proxy.getClientWorld();
// TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//
// if (tileEntity instanceof TETeleposer)
// {
// TETeleposer tileEntityAltar = (TETeleposer) tileEntity;
// tileEntityAltar.handlePacketData(items);
// }
// } else if (packet.channel.equals("SetPlayerVel"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// double xVel = dat.readDouble();
// double yVel = dat.readDouble();
// double zVel = dat.readDouble();
// ((EntityPlayer) player).setVelocity(xVel, yVel, zVel);
// } else if (packet.channel.equals("SetPlayerPos"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// double xVel = dat.readDouble();
// double yVel = dat.readDouble();
// double zVel = dat.readDouble();
// ((EntityPlayer) player).setPosition(xVel, yVel, zVel);
// }
// }
//
// public static Packet getPacket(TEAltar tileEntity)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
// int[] items = tileEntity.buildIntDataList();
// boolean hasStacks = (items != null);
//
// try
// {
// dos.writeInt(tileEntity.xCoord);
// dos.writeInt(tileEntity.yCoord);
// dos.writeInt(tileEntity.zCoord);
// dos.writeByte(hasStacks ? 1 : 0);
//
// if (hasStacks)
// {
// for (int i = 0; i < 3; i++)
// {
// dos.writeInt(items[i]);
// }
// }
//
// FluidStack flMain = tileEntity.getFluid();
//
// if (flMain == null)
// {
// dos.writeInt(AlchemicalWizardry.lifeEssenceFluid.getBlockID());
// dos.writeInt(0);
// } else
// {
// dos.writeInt(flMain.fluidID);
// dos.writeInt(flMain.amount);
// }
//
// FluidStack flOut = tileEntity.getOutputFluid();
//
// if (flOut == null)
// {
// dos.writeInt(AlchemicalWizardry.lifeEssenceFluid.getBlockID());
// dos.writeInt(0);
// } else
// {
// dos.writeInt(flOut.fluidID);
// dos.writeInt(flOut.amount);
// }
//
// FluidStack flIn = tileEntity.getInputFluid();
//
// if (flIn == null)
// {
// dos.writeInt(AlchemicalWizardry.lifeEssenceFluid.getBlockID());
// dos.writeInt(0);
// } else
// {
// dos.writeInt(flIn.fluidID);
// dos.writeInt(flIn.amount);
// }
//
// dos.writeInt(tileEntity.capacity);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "BloodAltar";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getPacket(TESocket tileEntity)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
// int[] items = tileEntity.buildIntDataList();
// boolean hasStacks = (items != null);
//
// try
// {
// dos.writeInt(tileEntity.xCoord);
// dos.writeInt(tileEntity.yCoord);
// dos.writeInt(tileEntity.zCoord);
// dos.writeByte(hasStacks ? 1 : 0);
//
// if (hasStacks)
// {
// for (int i = 0; i < 3; i++)
// {
// dos.writeInt(items[i]);
// }
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "TESocket";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getPacket(String ownerName, int addedEssence, int maxEssence)
// //Packet to be sent to server to change essence
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeInt(ownerName.length());
// dos.writeChars(ownerName);
// dos.writeInt(addedEssence);
// dos.writeInt(maxEssence); //Used for Blood Orbs, but does nothing for other items
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "SetLifeEssence";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// //pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getPacket(String ownerName) //stores the current essence in the player's NBT
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeInt(ownerName.length());
// dos.writeChars(ownerName);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "GetLifeEssence";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// //pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getAltarPacket(int x, int y, int z)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeInt(x);
// dos.writeInt(y);
// dos.writeInt(z);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "GetAltarEssence";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// //pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getPacket(TEWritingTable tileEntity)
// {
// // TODO Auto-generated method stub
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
// int[] items = tileEntity.buildIntDataList();
// boolean hasStacks = (items != null);
//
// try
// {
// dos.writeInt(tileEntity.xCoord);
// dos.writeInt(tileEntity.yCoord);
// dos.writeInt(tileEntity.zCoord);
// dos.writeByte(hasStacks ? 1 : 0);
//
// if (hasStacks)
// {
// for (int i = 0; i < 3 * 7; i++)
// {
// dos.writeInt(items[i]);
// }
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "TEWritingTable";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getPacket(TEPedestal tileEntity)
// {
// // TODO Auto-generated method stub
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
// int[] items = tileEntity.buildIntDataList();
// boolean hasStacks = (items != null);
//
// try
// {
// dos.writeInt(tileEntity.xCoord);
// dos.writeInt(tileEntity.yCoord);
// dos.writeInt(tileEntity.zCoord);
// dos.writeByte(hasStacks ? 1 : 0);
//
// if (hasStacks)
// {
// for (int i = 0; i < 3 * 1; i++)
// {
// dos.writeInt(items[i]);
// }
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "TEPedestal";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getPacket(TEPlinth tileEntity)
// {
// // TODO Auto-generated method stub
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
// int[] items = tileEntity.buildIntDataList();
// boolean hasStacks = (items != null);
//
// try
// {
// dos.writeInt(tileEntity.xCoord);
// dos.writeInt(tileEntity.yCoord);
// dos.writeInt(tileEntity.zCoord);
// dos.writeByte(hasStacks ? 1 : 0);
//
// if (hasStacks)
// {
// for (int i = 0; i < 3 * 1; i++)
// {
// dos.writeInt(items[i]);
// }
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "TEPlinth";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getPacket(TETeleposer tileEntity)
// {
// // TODO Auto-generated method stub
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
// int[] items = tileEntity.buildIntDataList();
// boolean hasStacks = (items != null);
//
// try
// {
// dos.writeInt(tileEntity.xCoord);
// dos.writeInt(tileEntity.yCoord);
// dos.writeInt(tileEntity.zCoord);
// dos.writeByte(hasStacks ? 1 : 0);
//
// if (hasStacks)
// {
// for (int i = 0; i < 3 * 1; i++)
// {
// dos.writeInt(items[i]);
// }
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "TETeleposer";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getCustomParticlePacket(String str, double x, double y, double z, double xVel, double yVel, double zVel)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeInt(str.length());
// dos.writeChars(str);
// dos.writeDouble(x);
// dos.writeDouble(y);
// dos.writeDouble(z);
// dos.writeDouble(xVel);
// dos.writeDouble(yVel);
// dos.writeDouble(zVel);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "CustomParticle";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = false;
// return pkt;
// }
//
// public static Packet getPlayerVelocitySettingPacket(double xVel, double yVel, double zVel)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeDouble(xVel);
// dos.writeDouble(yVel);
// dos.writeDouble(zVel);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "SetPlayerVel";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = false;
// return pkt;
// }
//
// public static Packet getPlayerPositionSettingPacket(double xVel, double yVel, double zVel)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeDouble(xVel);
// dos.writeDouble(yVel);
// dos.writeDouble(zVel);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "SetPlayerPos";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = false;
// return pkt;
// }
//
// public static Packet getCreativeCheatPacket(String ownerName, boolean isFill)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeInt(ownerName.length());
// dos.writeChars(ownerName);
// dos.writeBoolean(isFill);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "InfiniteLPPath";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = false;
// return pkt;
// }
//
// public static Packet getBlockOrientationPacket(TEOrientable tileEntity)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeInt(tileEntity.xCoord);
// dos.writeInt(tileEntity.yCoord);
// dos.writeInt(tileEntity.zCoord);
// dos.writeInt(tileEntity.getIntForForgeDirection(tileEntity.getInputDirection()));
// dos.writeInt(tileEntity.getIntForForgeDirection(tileEntity.getOutputDirection()));
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "TEOrientor";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
}

View file

@ -2,26 +2,26 @@ package WayofTime.alchemicalWizardry.common.alchemy;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
public class CombinedPotionComponent public class CombinedPotionComponent
{ {
public Potion result; public Potion result;
public Potion pot1; public Potion pot1;
public Potion pot2; public Potion pot2;
public CombinedPotionComponent(Potion result, Potion pot1, Potion pot2) public CombinedPotionComponent(Potion result, Potion pot1, Potion pot2)
{ {
this.result = result; this.result = result;
this.pot1 = pot1; this.pot1 = pot1;
this.pot2 = pot2; this.pot2 = pot2;
} }
public boolean isRecipeValid(Potion test1, Potion test2) public boolean isRecipeValid(Potion test1, Potion test2)
{ {
return (test1 == pot1 && test2 == pot2) || (test1 == pot2 && test2 == pot1); return (test1 == pot1 && test2 == pot2) || (test1 == pot2 && test2 == pot1);
} }
public boolean isRecipeValid(int test1, int test2) public boolean isRecipeValid(int test1, int test2)
{ {
return (test1 == pot1.id && test2 == pot2.id) || (test1 == pot2.id && test2 == pot1.id); return (test1 == pot1.id && test2 == pot2.id) || (test1 == pot2.id && test2 == pot1.id);
} }
} }

View file

@ -1,182 +1,182 @@
package WayofTime.alchemicalWizardry.common.alchemy; package WayofTime.alchemicalWizardry.common.alchemy;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyPotionHelper;
import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.item.ItemStack; public class CombinedPotionRegistry
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyPotionHelper;
import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask;
public class CombinedPotionRegistry
{ {
public static List<CombinedPotionComponent> potionList = new ArrayList(); public static List<CombinedPotionComponent> potionList = new ArrayList();
public static void registerCombinedPotionRecipe(Potion result, Potion pot1, Potion pot2) public static void registerCombinedPotionRecipe(Potion result, Potion pot1, Potion pot2)
{ {
potionList.add(new CombinedPotionComponent(result, pot1, pot2)); potionList.add(new CombinedPotionComponent(result, pot1, pot2));
} }
public static boolean isRecipeValid(Potion pot1, Potion pot2) public static boolean isRecipeValid(Potion pot1, Potion pot2)
{ {
for(CombinedPotionComponent recipe : potionList) for (CombinedPotionComponent recipe : potionList)
{ {
if(recipe.isRecipeValid(pot1, pot2)) if (recipe.isRecipeValid(pot1, pot2))
{ {
return true; return true;
} }
} }
return false; return false;
} }
public static boolean isRecipeValid(int pot1, int pot2) public static boolean isRecipeValid(int pot1, int pot2)
{ {
for(CombinedPotionComponent recipe : potionList) for (CombinedPotionComponent recipe : potionList)
{ {
if(recipe.isRecipeValid(pot1, pot2)) if (recipe.isRecipeValid(pot1, pot2))
{ {
return true; return true;
} }
} }
return false; return false;
} }
public static Potion getPotion(Potion pot1, Potion pot2) public static Potion getPotion(Potion pot1, Potion pot2)
{ {
for(CombinedPotionComponent recipe : potionList) for (CombinedPotionComponent recipe : potionList)
{ {
if(recipe.isRecipeValid(pot1, pot2)) if (recipe.isRecipeValid(pot1, pot2))
{ {
return recipe.result; return recipe.result;
} }
} }
return null; return null;
} }
public static Potion getPotion(int pot1, int pot2) public static Potion getPotion(int pot1, int pot2)
{ {
for(CombinedPotionComponent recipe : potionList) for (CombinedPotionComponent recipe : potionList)
{ {
if(recipe.isRecipeValid(pot1, pot2)) if (recipe.isRecipeValid(pot1, pot2))
{ {
return recipe.result; return recipe.result;
} }
} }
return null; return null;
} }
public static ItemStack applyPotionEffect(ItemStack stack) public static ItemStack applyPotionEffect(ItemStack stack)
{ {
if(stack == null || !(stack.getItem() instanceof AlchemyFlask)) if (stack == null || !(stack.getItem() instanceof AlchemyFlask))
{ {
return null; return null;
} }
List<AlchemyPotionHelper> list = AlchemyFlask.getEffects(stack); List<AlchemyPotionHelper> list = AlchemyFlask.getEffects(stack);
if(list == null) if (list == null)
{ {
return stack; return stack;
} }
boolean isDone = false; boolean isDone = false;
for(AlchemyPotionHelper helper1 : list) for (AlchemyPotionHelper helper1 : list)
{ {
if(isDone) if (isDone)
{ {
continue; continue;
} }
for(int i=0; i<list.size(); i++) for (int i = 0; i < list.size(); i++)
{ {
if(isDone) if (isDone)
{ {
continue; continue;
} }
AlchemyPotionHelper helper2 = list.get(i); AlchemyPotionHelper helper2 = list.get(i);
PotionEffect potEffect = getResultantPotion(helper1, helper2); PotionEffect potEffect = getResultantPotion(helper1, helper2);
if(potEffect != null) if (potEffect != null)
{ {
AlchemyPotionHelper potHelper = new AlchemyPotionHelper(potEffect.getPotionID(), potEffect.getDuration(), 0, potEffect.getAmplifier()); AlchemyPotionHelper potHelper = new AlchemyPotionHelper(potEffect.getPotionID(), potEffect.getDuration(), 0, potEffect.getAmplifier());
list.remove(helper1); list.remove(helper1);
list.remove(helper2); list.remove(helper2);
list.add(potHelper); list.add(potHelper);
isDone = true; isDone = true;
} }
} }
} }
if(isDone) if (isDone)
{ {
AlchemyFlask.setEffects(stack, list); AlchemyFlask.setEffects(stack, list);
return stack; return stack;
} }
return null; return null;
} }
public static boolean hasCombinablePotionEffect(ItemStack stack) public static boolean hasCombinablePotionEffect(ItemStack stack)
{ {
if(stack == null || !(stack.getItem() instanceof AlchemyFlask)) if (stack == null || !(stack.getItem() instanceof AlchemyFlask))
{ {
return false; return false;
} }
List<AlchemyPotionHelper> list = AlchemyFlask.getEffects(stack); List<AlchemyPotionHelper> list = AlchemyFlask.getEffects(stack);
if(list == null) if (list == null)
{ {
return false; return false;
} }
for(AlchemyPotionHelper helper1 : list) for (AlchemyPotionHelper helper1 : list)
{ {
for(AlchemyPotionHelper helper2 : list) for (AlchemyPotionHelper helper2 : list)
{ {
int pot1 = helper1.getPotionID(); int pot1 = helper1.getPotionID();
int pot2 = helper2.getPotionID(); int pot2 = helper2.getPotionID();
if(isRecipeValid(pot1, pot2)) if (isRecipeValid(pot1, pot2))
{ {
return true; return true;
} }
} }
} }
return false; return false;
} }
public static PotionEffect getResultantPotion(AlchemyPotionHelper potE1, AlchemyPotionHelper potE2) public static PotionEffect getResultantPotion(AlchemyPotionHelper potE1, AlchemyPotionHelper potE2)
{ {
if(potE1 == null || potE2 == null) if (potE1 == null || potE2 == null)
{ {
return null; return null;
} }
int pot1 = potE1.getPotionID(); int pot1 = potE1.getPotionID();
int pot2 = potE2.getPotionID(); int pot2 = potE2.getPotionID();
if(isRecipeValid(pot1, pot2)) if (isRecipeValid(pot1, pot2))
{ {
int duration = (int)((potE1.getTickDuration()* Math.pow(8.0f / 3.0f, potE1.getdurationFactor()) + potE2.getdurationFactor() * Math.pow(8.0f / 3.0f, potE2.getdurationFactor()))/2.0); int duration = (int) ((potE1.getTickDuration() * Math.pow(8.0f / 3.0f, potE1.getdurationFactor()) + potE2.getdurationFactor() * Math.pow(8.0f / 3.0f, potE2.getdurationFactor())) / 2.0);
int amplifier = (potE1.getConcentration() + potE2.getConcentration())/2; int amplifier = (potE1.getConcentration() + potE2.getConcentration()) / 2;
Potion pot = getPotion(pot1, pot2); Potion pot = getPotion(pot1, pot2);
return new PotionEffect(pot.id, duration, amplifier); return new PotionEffect(pot.id, duration, amplifier);
} }
return null; return null;
} }
} }

View file

@ -1,6 +1,5 @@
package WayofTime.alchemicalWizardry.common.alchemy; package WayofTime.alchemicalWizardry.common.alchemy;
public interface ICombinationalCatalyst public interface ICombinationalCatalyst
{ {
} }

View file

@ -1,8 +1,14 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import java.util.List; import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.ArmourComponent;
import WayofTime.alchemicalWizardry.common.items.BoundArmour;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -14,16 +20,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems; import java.util.ArrayList;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import java.util.List;
import WayofTime.alchemicalWizardry.common.ArmourComponent;
import WayofTime.alchemicalWizardry.common.items.BoundArmour;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ArmourForge extends Block public class ArmourForge extends Block
{ {
@ -39,8 +38,6 @@ public class ArmourForge extends Block
setResistance(5.0F); setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic); setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("armourForge"); this.setBlockName("armourForge");
//setUnlocalizedName("armourForge");
// TODO Auto-generated constructor stub
} }
@Override @Override
@ -160,7 +157,6 @@ public class ArmourForge extends Block
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
//PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 20, world.provider.dimensionId, TEAltar.getParticlePacket(xCoord, yCoord, zCoord, (short) 1));
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, world.provider.dimensionId, 1, xCoord, yCoord, zCoord); SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, world.provider.dimensionId, 1, xCoord, yCoord, zCoord);
} }

View file

@ -1,7 +1,9 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.Random; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -12,29 +14,27 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; import java.util.Random;
import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
public class BlockAlchemicCalcinator extends BlockContainer public class BlockAlchemicCalcinator extends BlockContainer
{ {
public BlockAlchemicCalcinator() public BlockAlchemicCalcinator()
{ {
super(Material.rock); super(Material.rock);
setHardness(2.0F); setHardness(2.0F);
setResistance(5.0F); setResistance(5.0F);
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("alchemicCalcinator"); this.setBlockName("alchemicCalcinator");
} }
@Override @Override
public TileEntity createNewTileEntity(World world, int meta) public TileEntity createNewTileEntity(World world, int meta)
{ {
return new TEAlchemicCalcinator(); return new TEAlchemicCalcinator();
} }
@Override @Override
public boolean renderAsNormalBlock() public boolean renderAsNormalBlock()
{ {
return false; return false;
@ -57,13 +57,13 @@ public class BlockAlchemicCalcinator extends BlockContainer
{ {
return true; return true;
} }
@Override @Override
public boolean canProvidePower() public boolean canProvidePower()
{ {
return true; return true;
} }
@Override @Override
public void breakBlock(World world, int x, int y, int z, Block par5, int par6) public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
{ {
@ -110,11 +110,11 @@ public class BlockAlchemicCalcinator extends BlockContainer
} }
} }
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
{ {
TEAlchemicCalcinator tileEntity = (TEAlchemicCalcinator) world.getTileEntity(x, y, z); TEAlchemicCalcinator tileEntity = (TEAlchemicCalcinator) world.getTileEntity(x, y, z);
if (tileEntity == null || player.isSneaking()) if (tileEntity == null || player.isSneaking())
{ {
@ -122,45 +122,44 @@ public class BlockAlchemicCalcinator extends BlockContainer
} }
ItemStack playerItem = player.getCurrentEquippedItem(); ItemStack playerItem = player.getCurrentEquippedItem();
if (playerItem != null) if (playerItem != null)
{ {
if(playerItem.getItem() instanceof IReagentManipulator) if (playerItem.getItem() instanceof IReagentManipulator)
{ {
return false; return false;
} }
if(playerItem.getItem() instanceof IBloodOrb) if (playerItem.getItem() instanceof IBloodOrb)
{ {
if(tileEntity.getStackInSlot(0) == null) if (tileEntity.getStackInSlot(0) == null)
{ {
ItemStack newItem = playerItem.copy(); ItemStack newItem = playerItem.copy();
newItem.stackSize = 1; newItem.stackSize = 1;
--playerItem.stackSize; --playerItem.stackSize;
tileEntity.setInventorySlotContents(0, newItem); tileEntity.setInventorySlotContents(0, newItem);
} }
} } else if (tileEntity.getStackInSlot(1) == null)
else if(tileEntity.getStackInSlot(1) == null) {
{ ItemStack newItem = playerItem.copy();
ItemStack newItem = playerItem.copy();
newItem.stackSize = 1; newItem.stackSize = 1;
--playerItem.stackSize; --playerItem.stackSize;
tileEntity.setInventorySlotContents(1, newItem); tileEntity.setInventorySlotContents(1, newItem);
} }
} else if (playerItem == null) } else if (playerItem == null)
{ {
if(tileEntity.getStackInSlot(1) != null) if (tileEntity.getStackInSlot(1) != null)
{ {
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(1)); player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(1));
tileEntity.setInventorySlotContents(1, null); tileEntity.setInventorySlotContents(1, null);
}else if(tileEntity.getStackInSlot(0) != null) } else if (tileEntity.getStackInSlot(0) != null)
{ {
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0)); player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
tileEntity.setInventorySlotContents(0, null); tileEntity.setInventorySlotContents(0, null);
} }
} }
tileEntity.getWorldObj().markBlockForUpdate(x, y, z); tileEntity.getWorldObj().markBlockForUpdate(x, y, z);
return true; return true;

View file

@ -1,9 +1,12 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.Random; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import javax.swing.Icon; import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -15,17 +18,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems; import java.util.Random;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockAltar extends BlockContainer public class BlockAltar extends BlockContainer
{ {
@ -45,8 +40,6 @@ public class BlockAltar extends BlockContainer
setResistance(5.0F); setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic); setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("bloodAltar"); this.setBlockName("bloodAltar");
//setUnlocalizedName("blockAltar");
//func_111022_d("AlchemicalWizardry:blocks");
} }
@Override @Override
@ -67,29 +60,23 @@ public class BlockAltar extends BlockContainer
{ {
case 0: case 0:
return bottomIcon; return bottomIcon;
case 1: case 1:
return topIcon; return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default: default:
return sideIcon2; return sideIcon2;
} }
} }
@Override @Override
public boolean hasComparatorInputOverride() public boolean hasComparatorInputOverride()
{ {
return true; return true;
} }
@Override @Override
public int getComparatorInputOverride(World world, int x, int y, int z, int meta) public int getComparatorInputOverride(World world, int x, int y, int z, int meta)
{ {
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TEAltar) if (tile instanceof TEAltar)
{ {
@ -113,8 +100,6 @@ public class BlockAltar extends BlockContainer
{ {
TEAltar tileEntity = (TEAltar) world.getTileEntity(x, y, z); TEAltar tileEntity = (TEAltar) world.getTileEntity(x, y, z);
// world.scheduleBlockUpdate(x, y, z, this.blockID, 0);
if (tileEntity == null || player.isSneaking()) if (tileEntity == null || player.isSneaking())
{ {
return false; return false;
@ -129,26 +114,24 @@ public class BlockAltar extends BlockContainer
if (player.worldObj.isRemote) if (player.worldObj.isRemote)
{ {
world.markBlockForUpdate(x, y, z); world.markBlockForUpdate(x, y, z);
}else } else
{ {
tileEntity.sendChatInfoToPlayer(player); tileEntity.sendChatInfoToPlayer(player);
} }
return true; return true;
} } else if (playerItem.getItem().equals(ModItems.itemSeerSigil))
else if(playerItem.getItem().equals(ModItems.itemSeerSigil))
{ {
if (player.worldObj.isRemote) if (player.worldObj.isRemote)
{ {
world.markBlockForUpdate(x, y, z); world.markBlockForUpdate(x, y, z);
}else } else
{ {
tileEntity.sendMoreChatInfoToPlayer(player); tileEntity.sendMoreChatInfoToPlayer(player);
} }
return true; return true;
} } else if (playerItem.getItem().equals(ModItems.sigilOfHolding))
else if (playerItem.getItem().equals(ModItems.sigilOfHolding))
{ {
ItemStack item = ((SigilOfHolding) playerItem.getItem()).getCurrentItem(playerItem); ItemStack item = ((SigilOfHolding) playerItem.getItem()).getCurrentItem(playerItem);
@ -156,24 +139,23 @@ public class BlockAltar extends BlockContainer
{ {
if (player.worldObj.isRemote) if (player.worldObj.isRemote)
{ {
world.markBlockForUpdate(x, y, z); world.markBlockForUpdate(x, y, z);
}else } else
{ {
tileEntity.sendChatInfoToPlayer(player); tileEntity.sendChatInfoToPlayer(player);
} }
return true; return true;
} } else if (item != null && item.getItem().equals(ModItems.itemSeerSigil))
else if(item !=null && item.getItem().equals(ModItems.itemSeerSigil))
{ {
if (player.worldObj.isRemote) if (player.worldObj.isRemote)
{ {
world.markBlockForUpdate(x, y, z); world.markBlockForUpdate(x, y, z);
}else } else
{ {
tileEntity.sendMoreChatInfoToPlayer(player); tileEntity.sendMoreChatInfoToPlayer(player);
} }
return true; return true;
} }
} }
@ -183,27 +165,16 @@ public class BlockAltar extends BlockContainer
{ {
ItemStack newItem = playerItem.copy(); ItemStack newItem = playerItem.copy();
newItem.stackSize = 1; newItem.stackSize = 1;
// if(newItem.getMaxDamage()==0)
// {
// newItem.setItemDamage(0);
// }
--playerItem.stackSize; --playerItem.stackSize;
tileEntity.setInventorySlotContents(0, newItem); tileEntity.setInventorySlotContents(0, newItem);
tileEntity.startCycle(); tileEntity.startCycle();
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null) } else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
{ {
/**stub method
* Add the item that is in the slot to the player's inventory, and
* then set the slot to null.
*/
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0)); player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
tileEntity.setInventorySlotContents(0, null); tileEntity.setInventorySlotContents(0, null);
tileEntity.setActive(); tileEntity.setActive();
} }
world.markBlockForUpdate(x, y, z); world.markBlockForUpdate(x, y, z);
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
return true; return true;
} }
@ -294,21 +265,9 @@ public class BlockAltar extends BlockContainer
} }
} }
// @Override @Override
// public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) public TileEntity createNewTileEntity(World var1, int var2)
// { {
// return 1; return new TEAltar();
// } }
// @Override
// public boolean canProvidePower()
// {
// return true;
// }
@Override
public TileEntity createNewTileEntity(World var1, int var2)
{
return new TEAltar();
}
} }

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
@ -9,84 +9,43 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import java.util.ArrayList;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
public class BlockBelljar extends BlockContainer public class BlockBelljar extends BlockContainer
{ {
public BlockBelljar() public BlockBelljar()
{ {
super(Material.glass); super(Material.glass);
setHardness(2.0F); setHardness(2.0F);
setResistance(5.0F); setResistance(5.0F);
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("crystalBelljar"); this.setBlockName("crystalBelljar");
} }
@Override @Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack) public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack)
{ {
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TEBellJar) if (tile instanceof TEBellJar)
{ {
NBTTagCompound tag = stack.getTagCompound(); NBTTagCompound tag = stack.getTagCompound();
if(tag != null) if (tag != null)
{ {
((TEBellJar) tile).readTankNBTOnPlace(tag); ((TEBellJar) tile).readTankNBTOnPlace(tag);
} }
} }
} }
// @Override @Override
// public void breakBlock(World world, int x, int y, int z, Block par5, int par6) public TileEntity createNewTileEntity(World world, int meta)
// { {
// if(world.isRemote) return new TEBellJar();
// { }
// return;
// } @Override
//
// TileEntity tile = world.getTileEntity(x, y, z);
//
// if(tile == null)
// {
// System.out.println("Tile has been removed already!");
// }
//
// if(tile instanceof TEBellJar)
// {
// if(((TEBellJar) tile).areTanksEmpty())
// {
// super.breakBlock(world, x, y, z, par5, par6);
// return;
// }
// System.out.println("Writing...");
// ItemStack droppedStack = new ItemStack(ModBlocks.blockCrystalBelljar);
// droppedStack.setTagCompound(new NBTTagCompound());
//
// NBTTagCompound savedTag = droppedStack.getTagCompound();
// ((TEBellJar) tile).writeTankNBT(savedTag);
//
// this.dropBlockAsItem(world, x, y, z, droppedStack);
//
// world.removeTileEntity(x, y, z);
// return;
// }
//
// super.breakBlock(world, x, y, z, par5, par6);
// }
@Override
public TileEntity createNewTileEntity(World world, int meta)
{
return new TEBellJar();
}
@Override
public boolean renderAsNormalBlock() public boolean renderAsNormalBlock()
{ {
return false; return false;
@ -108,50 +67,49 @@ public class BlockBelljar extends BlockContainer
public boolean hasTileEntity() public boolean hasTileEntity()
{ {
return true; return true;
} }
@Override @Override
public boolean hasComparatorInputOverride() public boolean hasComparatorInputOverride()
{ {
return true; return true;
} }
@Override @Override
public int getComparatorInputOverride(World world, int x, int y, int z, int meta) public int getComparatorInputOverride(World world, int x, int y, int z, int meta)
{ {
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TEBellJar) if (tile instanceof TEBellJar)
{ {
return ((TEBellJar) tile).getRSPowerOutput(); return ((TEBellJar) tile).getRSPowerOutput();
} }
return 15; return 15;
} }
@Override @Override
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player)
{ {
this.dropBlockAsItem(world, x, y, z, meta, 0); this.dropBlockAsItem(world, x, y, z, meta, 0);
super.onBlockHarvested(world, x, y, z, meta, player);
super.onBlockHarvested(world, x, y, z, meta, player);
} }
@Override @Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
{ {
ArrayList<ItemStack> list = new ArrayList(); ArrayList<ItemStack> list = new ArrayList();
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TEBellJar) if (tile instanceof TEBellJar)
{ {
ItemStack drop = new ItemStack(this); ItemStack drop = new ItemStack(this);
NBTTagCompound tag = new NBTTagCompound(); NBTTagCompound tag = new NBTTagCompound();
((TEBellJar)tile).writeTankNBT(tag); ((TEBellJar) tile).writeTankNBT(tag);
drop.stackTagCompound = tag; drop.stackTagCompound = tag;
list.add(drop); list.add(drop);
} }
return list; return list;
} }
} }

View file

@ -1,8 +1,7 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.List; import cpw.mods.fml.relauncher.Side;
import java.util.Random; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -10,15 +9,15 @@ import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import java.util.List;
import java.util.Random;
public class BlockBloodLightSource extends Block public class BlockBloodLightSource extends Block
{ {
public BlockBloodLightSource() public BlockBloodLightSource()
{ {
super(Material.cloth); super(Material.cloth);
//setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("blockBloodLightSource"); this.setBlockName("blockBloodLightSource");
} }
@ -65,7 +64,6 @@ public class BlockBloodLightSource extends Block
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
{ {
this.setBlockBounds(0.40F, 0.40F, 0.40F, 0.60F, 0.60F, 0.60F); this.setBlockBounds(0.40F, 0.40F, 0.40F, 0.60F, 0.60F, 0.60F);
//super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
} }
public int quantityDropped(Random par1Random) public int quantityDropped(Random par1Random)

View file

@ -1,14 +1,14 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEConduit;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEConduit;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockConduit extends BlockOrientable public class BlockConduit extends BlockOrientable
{ {
@ -28,7 +28,6 @@ public class BlockConduit extends BlockOrientable
setResistance(5.0F); setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic); setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("blockConduit"); this.setBlockName("blockConduit");
//func_111022_d("AlchemicalWizardry:blocks");
} }
@Override @Override
@ -49,14 +48,8 @@ public class BlockConduit extends BlockOrientable
{ {
case 0: case 0:
return bottomIcon; return bottomIcon;
case 1: case 1:
return topIcon; return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default: default:
return sideIcon2; return sideIcon2;
} }
@ -65,7 +58,6 @@ public class BlockConduit extends BlockOrientable
@Override @Override
public void breakBlock(World world, int x, int y, int z, Block par5, int par6) 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); super.breakBlock(world, x, y, z, par5, par6);
} }

View file

@ -1,43 +1,42 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEDemonPortal;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEDemonPortal;
public class BlockDemonPortal extends BlockContainer public class BlockDemonPortal extends BlockContainer
{ {
public BlockDemonPortal() public BlockDemonPortal()
{ {
super(Material.rock); super(Material.rock);
setHardness(2.0F); setHardness(2.0F);
setResistance(5.0F); setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic); setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("demonPortal"); this.setBlockName("demonPortal");
} }
@Override @Override
public TileEntity createNewTileEntity(World var1, int var2) public TileEntity createNewTileEntity(World var1, int var2)
{ {
return new TEDemonPortal(); return new TEDemonPortal();
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
{ {
if(world.isRemote) if (world.isRemote)
{ {
return false; return false;
} }
TEDemonPortal tileEntity = (TEDemonPortal) world.getTileEntity(x, y, z); TEDemonPortal tileEntity = (TEDemonPortal) world.getTileEntity(x, y, z);
tileEntity.rightClickBlock(player, side); tileEntity.rightClickBlock(player, side);
return false; return false;
} }
} }

View file

@ -1,5 +1,10 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.items.BlankSpell;
import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -9,11 +14,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.items.BlankSpell;
import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockHomHeart extends BlockContainer public class BlockHomHeart extends BlockContainer
{ {
@ -47,14 +47,8 @@ public class BlockHomHeart extends BlockContainer
{ {
case 0: case 0:
return bottomIcon; return bottomIcon;
case 1: case 1:
return topIcon; return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default: default:
return sideIcon; return sideIcon;
} }

View file

@ -1,5 +1,10 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.items.ActivationCrystal;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -8,11 +13,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.items.ActivationCrystal;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockMasterStone extends BlockContainer public class BlockMasterStone extends BlockContainer
{ {
@ -23,7 +23,6 @@ public class BlockMasterStone extends BlockContainer
setResistance(5.0F); setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic); setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("blockMasterStone"); this.setBlockName("blockMasterStone");
// TODO Auto-generated constructor stub
} }
@Override @Override
@ -32,17 +31,17 @@ public class BlockMasterStone extends BlockContainer
{ {
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:MasterStone"); this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:MasterStone");
} }
@Override @Override
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player)
{ {
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TEMasterStone) if (tile instanceof TEMasterStone)
{ {
((TEMasterStone) tile).useOnRitualBroken(); ((TEMasterStone) tile).useOnRitualBroken();
} }
super.onBlockHarvested(world, x, y, z, meta, player); super.onBlockHarvested(world, x, y, z, meta, player);
} }
@Override @Override

View file

@ -1,49 +1,34 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import javax.swing.Icon;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable; import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable;
import cpw.mods.fml.relauncher.Side; import net.minecraft.block.BlockContainer;
import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockOrientable extends BlockContainer public class BlockOrientable extends BlockContainer
{ {
public BlockOrientable() public BlockOrientable()
{ {
super(Material.rock); super(Material.rock);
setHardness(2.0F); setHardness(2.0F);
setResistance(5.0F); setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic); setCreativeTab(AlchemicalWizardry.tabBloodMagic);
//setUnlocalizedName("bloodSocket");
//func_111022_d("AlchemicalWizardry:blocks");
} }
// @Override
// public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
// {
// return false;
// }
@Override @Override
public TileEntity createNewTileEntity(World world, int dunno) public TileEntity createNewTileEntity(World world, int dunno)
{ {
return new TEOrientable(); return new TEOrientable();
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
{ {
//Right-click orients the output face. Shift-right-click orients the input face. //Right-click orients the output face. Shift-right-click orients the input face.
if (world.isRemote) if (world.isRemote)
{ {
return false; return false;
@ -54,137 +39,167 @@ public class BlockOrientable extends BlockContainer
if (tile instanceof TEOrientable) if (tile instanceof TEOrientable)
{ {
TEOrientable newTile = (TEOrientable)tile; TEOrientable newTile = (TEOrientable) tile;
if(player.isSneaking()) if (player.isSneaking())
{ {
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getInputDirection())+1; int nextSide = TEOrientable.getIntForForgeDirection(newTile.getInputDirection()) + 1;
if(nextSide>5) if (nextSide > 5)
{ {
nextSide = 0; nextSide = 0;
} }
if(ForgeDirection.getOrientation(nextSide)==newTile.getOutputDirection()) if (ForgeDirection.getOrientation(nextSide) == newTile.getOutputDirection())
{ {
nextSide++; nextSide++;
if(nextSide>5) if (nextSide > 5)
{ {
nextSide = 0; nextSide = 0;
} }
} }
newTile.setInputDirection(ForgeDirection.getOrientation(nextSide)); newTile.setInputDirection(ForgeDirection.getOrientation(nextSide));
}else } else
{ {
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getOutputDirection())+1; int nextSide = TEOrientable.getIntForForgeDirection(newTile.getOutputDirection()) + 1;
if(nextSide>5) if (nextSide > 5)
{ {
nextSide = 0; nextSide = 0;
} }
if(ForgeDirection.getOrientation(nextSide)==newTile.getInputDirection()) if (ForgeDirection.getOrientation(nextSide) == newTile.getInputDirection())
{ {
nextSide++; nextSide++;
if(nextSide>5) if (nextSide > 5)
{ {
nextSide = 0; nextSide = 0;
} }
} }
newTile.setOutputDirection(ForgeDirection.getOrientation(nextSide)); newTile.setOutputDirection(ForgeDirection.getOrientation(nextSide));
} }
} }
world.markBlockForUpdate(x, y, z); world.markBlockForUpdate(x, y, z);
return true; return true;
} }
public int getTextureIndexForSideAndOrientation(int side, ForgeDirection input, ForgeDirection output) public int getTextureIndexForSideAndOrientation(int side, ForgeDirection input, ForgeDirection output)
{ {
if(ForgeDirection.getOrientation(side) == input) if (ForgeDirection.getOrientation(side) == input)
{ {
return 0; return 0;
} }
if(ForgeDirection.getOrientation(side) == output) if (ForgeDirection.getOrientation(side) == output)
{ {
return 1; return 1;
} }
if(ForgeDirection.getOrientation(side) == output.getOpposite()) if (ForgeDirection.getOrientation(side) == output.getOpposite())
{ {
return 6; return 6;
} }
switch(side) switch (side)
{ {
case 0: //BOTTOM case 0: //BOTTOM
switch(output) switch (output)
{ {
case NORTH: return 2; //UP case NORTH:
case SOUTH: return 3; //DOWN return 2; //UP
case EAST: return 4; //LEFT case SOUTH:
case WEST: return 5; //RIGHT return 3; //DOWN
default: break; case EAST:
} return 4; //LEFT
break; case WEST:
case 1: //TOP return 5; //RIGHT
switch(output) default:
{ break;
case NORTH: return 2; //UP }
case SOUTH: return 3; //DOWN break;
case EAST: return 5; case 1: //TOP
case WEST: return 4; switch (output)
default: break; {
} case NORTH:
break; return 2; //UP
case 2: //NORTH case SOUTH:
switch(output) return 3; //DOWN
{ case EAST:
case DOWN: return 3; return 5;
case UP: return 2; case WEST:
case EAST: return 4; return 4;
case WEST: return 5; default:
default: break; break;
} }
break; break;
case 3: //SOUTH case 2: //NORTH
switch(output) switch (output)
{ {
case DOWN: return 3; case DOWN:
case UP: return 2; return 3;
case EAST: return 5; case UP:
case WEST: return 4; return 2;
default: break; case EAST:
} return 4;
break; case WEST:
case 4: //WEST return 5;
switch(output) default:
{ break;
case DOWN: return 3; }
case UP: return 2; break;
case NORTH: return 5; case 3: //SOUTH
case SOUTH: return 4; switch (output)
default: break; {
} case DOWN:
break; return 3;
case 5: //EAST case UP:
switch(output) return 2;
{ case EAST:
case DOWN: return 3; return 5;
case UP: return 2; case WEST:
case NORTH: return 4; return 4;
case SOUTH: return 5; default:
default: break; break;
} }
break; break;
} case 4: //WEST
switch (output)
return 0; {
case DOWN:
return 3;
case UP:
return 2;
case NORTH:
return 5;
case SOUTH:
return 4;
default:
break;
}
break;
case 5: //EAST
switch (output)
{
case DOWN:
return 3;
case UP:
return 2;
case NORTH:
return 4;
case SOUTH:
return 5;
default:
break;
}
break;
}
return 0;
} }
@Override @Override
public int damageDropped(int metadata) public int damageDropped(int metadata)
{ {
return metadata; return metadata;
} }
} }

View file

@ -1,7 +1,9 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.Random; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -16,10 +18,8 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal; import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockPedestal extends BlockContainer public class BlockPedestal extends BlockContainer
{ {
@ -39,7 +39,6 @@ public class BlockPedestal extends BlockContainer
setResistance(5.0F); setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic); setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("bloodPedestal"); this.setBlockName("bloodPedestal");
//func_111022_d("AlchemicalWizardry:blocks");
} }
@Override @Override
@ -60,14 +59,8 @@ public class BlockPedestal extends BlockContainer
{ {
case 0: case 0:
return bottomIcon; return bottomIcon;
case 1: case 1:
return topIcon; return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default: default:
return sideIcon2; return sideIcon2;
} }
@ -93,18 +86,11 @@ public class BlockPedestal extends BlockContainer
tileEntity.setInventorySlotContents(0, newItem); tileEntity.setInventorySlotContents(0, newItem);
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null) } else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
{ {
/**stub method
* Add the item that is in the slot to the player's inventory, and
* then set the slot to null.
*/
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0)); player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
tileEntity.setInventorySlotContents(0, null); tileEntity.setInventorySlotContents(0, null);
tileEntity.setActive(); tileEntity.setActive();
} }
world.markBlockForUpdate(x, y, z); world.markBlockForUpdate(x, y, z);
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
return true; return true;
} }

View file

@ -1,7 +1,9 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.Random; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -16,10 +18,8 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth; import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockPlinth extends BlockContainer public class BlockPlinth extends BlockContainer
{ {
@ -39,7 +39,6 @@ public class BlockPlinth extends BlockContainer
setResistance(5.0F); setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic); setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("bloodPlinth"); this.setBlockName("bloodPlinth");
//func_111022_d("AlchemicalWizardry:blocks");
} }
@Override @Override
@ -60,14 +59,8 @@ public class BlockPlinth extends BlockContainer
{ {
case 0: case 0:
return bottomIcon; return bottomIcon;
case 1: case 1:
return topIcon; return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default: default:
return sideIcon2; return sideIcon2;
} }
@ -93,18 +86,11 @@ public class BlockPlinth extends BlockContainer
tileEntity.setInventorySlotContents(0, newItem); tileEntity.setInventorySlotContents(0, newItem);
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null) } else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
{ {
/**stub method
* Add the item that is in the slot to the player's inventory, and
* then set the slot to null.
*/
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0)); player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
tileEntity.setInventorySlotContents(0, null); tileEntity.setInventorySlotContents(0, null);
tileEntity.setActive(); tileEntity.setActive();
} }
world.markBlockForUpdate(x, y, z); world.markBlockForUpdate(x, y, z);
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
return true; return true;
} }

View file

@ -1,83 +1,67 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockReagentConduit extends BlockContainer public class BlockReagentConduit extends BlockContainer
{ {
public BlockReagentConduit() public BlockReagentConduit()
{ {
super(Material.cloth); super(Material.cloth);
setHardness(2.0F); setHardness(2.0F);
setResistance(5.0F); setResistance(5.0F);
this.setBlockName("blockReagentConduit"); this.setBlockName("blockReagentConduit");
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) public void registerBlockIcons(IIconRegister iconRegister)
{ {
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SimpleTransCircle"); this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SimpleTransCircle");
} }
@Override @Override
public TileEntity createNewTileEntity(World world, int meta) public TileEntity createNewTileEntity(World world, int meta)
{ {
return new TEReagentConduit(); return new TEReagentConduit();
} }
@Override @Override
public boolean canProvidePower() public boolean canProvidePower()
{ {
return true; return true;
} }
// @Override @Override
// @SideOnly(Side.CLIENT) public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
// public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
// { return super.onBlockActivated(world, x, y, z, player, side, what, these, are);
// if (this.equals(ModBlocks.blockSpellParadigm)) }
// {
// par3List.add(new ItemStack(par1, 1, 0)); @Override
// par3List.add(new ItemStack(par1, 1, 1)); public boolean isOpaqueCube()
// par3List.add(new ItemStack(par1, 1, 2)); {
// par3List.add(new ItemStack(par1, 1, 3)); return false;
// } else }
// {
// super.getSubBlocks(par1, par2CreativeTabs, par3List); @Override
// } public boolean renderAsNormalBlock()
// } {
return false;
@Override }
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
{ @Override
return super.onBlockActivated(world, x, y, z, player, side, what, these, are); public int getRenderType()
} {
return -1;
@Override }
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public int getRenderType()
{
return -1;
}
} }

View file

@ -1,43 +1,42 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TESchematicSaver;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEDemonPortal;
import WayofTime.alchemicalWizardry.common.tileEntity.TESchematicSaver;
public class BlockSchematicSaver extends BlockContainer public class BlockSchematicSaver extends BlockContainer
{ {
public BlockSchematicSaver() public BlockSchematicSaver()
{ {
super(Material.rock); super(Material.rock);
setHardness(2.0F); setHardness(2.0F);
setResistance(5.0F); setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic); setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("schematicSaver"); this.setBlockName("schematicSaver");
} }
@Override @Override
public TileEntity createNewTileEntity(World var1, int var2) public TileEntity createNewTileEntity(World var1, int var2)
{ {
return new TESchematicSaver(); return new TESchematicSaver();
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
{ {
if(world.isRemote) if (world.isRemote)
{ {
return false; return false;
} }
TESchematicSaver tileEntity = (TESchematicSaver) world.getTileEntity(x, y, z); TESchematicSaver tileEntity = (TESchematicSaver) world.getTileEntity(x, y, z);
tileEntity.rightClickBlock(player, side); tileEntity.rightClickBlock(player, side);
return false; return false;
} }
} }

View file

@ -1,7 +1,10 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.Random; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -14,11 +17,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import java.util.Random;
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockSocket extends BlockContainer public class BlockSocket extends BlockContainer
{ {
@ -59,14 +59,8 @@ public class BlockSocket extends BlockContainer
{ {
case 0: case 0:
return bottomIcon; return bottomIcon;
case 1: case 1:
return topIcon; return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default: default:
return sideIcon2; return sideIcon2;
} }
@ -83,7 +77,6 @@ public class BlockSocket extends BlockContainer
} }
ItemStack playerItem = player.getCurrentEquippedItem(); ItemStack playerItem = player.getCurrentEquippedItem();
if (tileEntity.getStackInSlot(0) == null && playerItem != null) if (tileEntity.getStackInSlot(0) == null && playerItem != null)
{ {
if (playerItem.getItem() instanceof ArmourUpgrade) if (playerItem.getItem() instanceof ArmourUpgrade)
@ -95,18 +88,11 @@ public class BlockSocket extends BlockContainer
} }
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null) } else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
{ {
/**stub method
* Add the item that is in the slot to the player's inventory, and
* then set the slot to null.
*/
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0)); player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
tileEntity.setInventorySlotContents(0, null); tileEntity.setInventorySlotContents(0, null);
tileEntity.setActive(); tileEntity.setActive();
} }
world.markBlockForUpdate(x, y, z); world.markBlockForUpdate(x, y, z);
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
return true; return true;
} }

View file

@ -1,8 +1,8 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.List; import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
import java.util.Random; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -11,18 +11,17 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
import cpw.mods.fml.relauncher.Side; import java.util.List;
import cpw.mods.fml.relauncher.SideOnly; import java.util.Random;
public class BlockSpectralContainer extends BlockContainer public class BlockSpectralContainer extends BlockContainer
{ {
public BlockSpectralContainer() public BlockSpectralContainer()
{ {
super(Material.cloth); super(Material.cloth);
//setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("blockSpectralContainer"); this.setBlockName("blockSpectralContainer");
this.setBlockBounds(0,0,0,0,0,0); this.setBlockBounds(0, 0, 0, 0, 0, 0);
} }
@Override @Override
@ -54,22 +53,22 @@ public class BlockSpectralContainer extends BlockContainer
{ {
return 0; return 0;
} }
@Override
public boolean isReplaceable(IBlockAccess world, int x, int y, int z)
{
return true;
}
@Override
public boolean isAir(IBlockAccess world, int x, int y, int z)
{
return true;
}
@Override @Override
public TileEntity createNewTileEntity(World var1, int var2) public boolean isReplaceable(IBlockAccess world, int x, int y, int z)
{ {
return new TESpectralContainer(); return true;
} }
@Override
public boolean isAir(IBlockAccess world, int x, int y, int z)
{
return true;
}
@Override
public TileEntity createNewTileEntity(World var1, int var2)
{
return new TESpectralContainer();
}
} }

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.List; import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
@ -9,25 +9,25 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock; import java.util.List;
public class BlockSpellEffect extends BlockOrientable public class BlockSpellEffect extends BlockOrientable
{ {
public BlockSpellEffect() public BlockSpellEffect()
{ {
super(); super();
this.setBlockName("blockSpellEffect"); this.setBlockName("blockSpellEffect");
} }
@Override @Override
public TileEntity createNewTileEntity(World world, int meta) public TileEntity createNewTileEntity(World world, int meta)
{ {
return new TESpellEffectBlock(); return new TESpellEffectBlock();
} }
@Override @Override
public boolean renderAsNormalBlock() public boolean renderAsNormalBlock()
{ {
return false; return false;
@ -44,16 +44,16 @@ public class BlockSpellEffect extends BlockOrientable
{ {
return false; return false;
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{ {
if (this.equals(ModBlocks.blockSpellEffect)) if (this.equals(ModBlocks.blockSpellEffect))
{ {
for(int i=0; i<4; i++) for (int i = 0; i < 4; i++)
{ {
par3List.add(new ItemStack(par1, 1, i)); par3List.add(new ItemStack(par1, 1, i));
} }
} else } else
{ {
super.getSubBlocks(par1, par2CreativeTabs, par3List); super.getSubBlocks(par1, par2CreativeTabs, par3List);

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.List; import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEnhancementBlock;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
@ -9,27 +9,25 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock; import java.util.List;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEnhancementBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock;
public class BlockSpellEnhancement extends BlockOrientable public class BlockSpellEnhancement extends BlockOrientable
{ {
public BlockSpellEnhancement() public BlockSpellEnhancement()
{ {
super(); super();
this.setBlockName("blockSpellEnhancement"); this.setBlockName("blockSpellEnhancement");
} }
@Override @Override
public TileEntity createNewTileEntity(World world, int meta) public TileEntity createNewTileEntity(World world, int meta)
{ {
return new TESpellEnhancementBlock(); return new TESpellEnhancementBlock();
} }
@Override @Override
public boolean renderAsNormalBlock() public boolean renderAsNormalBlock()
{ {
return false; return false;
@ -46,16 +44,16 @@ public class BlockSpellEnhancement extends BlockOrientable
{ {
return false; return false;
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{ {
if (this.equals(ModBlocks.blockSpellEnhancement)) if (this.equals(ModBlocks.blockSpellEnhancement))
{ {
for(int i=0; i<15; i++) for (int i = 0; i < 15; i++)
{ {
par3List.add(new ItemStack(par1, 1, i)); par3List.add(new ItemStack(par1, 1, i));
} }
} else } else
{ {
super.getSubBlocks(par1, par2CreativeTabs, par3List); super.getSubBlocks(par1, par2CreativeTabs, par3List);

View file

@ -1,7 +1,7 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.List; import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
@ -9,55 +9,54 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock; import java.util.List;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock;
public class BlockSpellModifier extends BlockOrientable public class BlockSpellModifier extends BlockOrientable
{ {
public BlockSpellModifier() public BlockSpellModifier()
{ {
super(); super();
this.setBlockName("blockSpellModifier"); this.setBlockName("blockSpellModifier");
} }
@Override @Override
public TileEntity createNewTileEntity(World world, int meta) public TileEntity createNewTileEntity(World world, int meta)
{ {
return new TESpellModifierBlock(); return new TESpellModifierBlock();
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{ {
if (this.equals(ModBlocks.blockSpellModifier)) if (this.equals(ModBlocks.blockSpellModifier))
{ {
for(int i=0; i<4; i++) for (int i = 0; i < 4; i++)
{ {
par3List.add(new ItemStack(par1, 1, i)); par3List.add(new ItemStack(par1, 1, i));
} }
} else } else
{ {
super.getSubBlocks(par1, par2CreativeTabs, par3List); super.getSubBlocks(par1, par2CreativeTabs, par3List);
} }
} }
@Override @Override
public boolean isOpaqueCube() public boolean isOpaqueCube()
{ {
return false; return false;
} }
@Override @Override
public boolean renderAsNormalBlock() public boolean renderAsNormalBlock()
{ {
return false; return false;
} }
@Override @Override
public int getRenderType() public int getRenderType()
{ {
return -1; return -1;
} }
} }

View file

@ -1,40 +1,38 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.List; import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.items.ItemComplexSpellCrystal;
import net.minecraft.client.renderer.texture.IIconRegister; import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.items.ItemComplexSpellCrystal;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockSpellParadigm extends BlockOrientable import java.util.List;
public class BlockSpellParadigm extends BlockOrientable
{ {
public static final float minPos = (3f/16f); public static final float minPos = (3f / 16f);
public static final float maxPos = (13f/16f); public static final float maxPos = (13f / 16f);
public BlockSpellParadigm() public BlockSpellParadigm()
{ {
super(); super();
this.setBlockName("blockSpellParadigm"); this.setBlockName("blockSpellParadigm");
} }
@Override @Override
public TileEntity createNewTileEntity(World world, int meta) public TileEntity createNewTileEntity(World world, int meta)
{ {
return new TESpellParadigmBlock(); return new TESpellParadigmBlock();
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
/** /**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items) * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
@ -52,14 +50,14 @@ public class BlockSpellParadigm extends BlockOrientable
super.getSubBlocks(par1, par2CreativeTabs, par3List); super.getSubBlocks(par1, par2CreativeTabs, par3List);
} }
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
{ {
ItemStack stack = player.getCurrentEquippedItem(); ItemStack stack = player.getCurrentEquippedItem();
if(stack != null && stack.getItem() instanceof ItemComplexSpellCrystal) if (stack != null && stack.getItem() instanceof ItemComplexSpellCrystal)
{ {
if (stack.stackTagCompound == null) if (stack.stackTagCompound == null)
{ {
stack.setTagCompound(new NBTTagCompound()); stack.setTagCompound(new NBTTagCompound());
@ -71,26 +69,26 @@ public class BlockSpellParadigm extends BlockOrientable
itemTag.setInteger("zCoord", z); itemTag.setInteger("zCoord", z);
itemTag.setInteger("dimensionId", world.provider.dimensionId); itemTag.setInteger("dimensionId", world.provider.dimensionId);
return true; return true;
} }
return super.onBlockActivated(world, x, y, z, player, side, what, these, are); return super.onBlockActivated(world, x, y, z, player, side, what, these, are);
} }
@Override @Override
public boolean isOpaqueCube() public boolean isOpaqueCube()
{ {
return false; return false;
} }
@Override @Override
public boolean renderAsNormalBlock() public boolean renderAsNormalBlock()
{ {
return false; return false;
} }
@Override @Override
public int getRenderType() public int getRenderType()
{ {
return -1; return -1;
} }
} }

View file

@ -1,7 +1,10 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.Random; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockMobSpawner; import net.minecraft.block.BlockMobSpawner;
@ -16,11 +19,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus; import java.util.Random;
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockTeleposer extends BlockContainer public class BlockTeleposer extends BlockContainer
{ {
@ -40,7 +40,6 @@ public class BlockTeleposer extends BlockContainer
setResistance(5.0F); setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic); setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("bloodTeleposer"); this.setBlockName("bloodTeleposer");
//func_111022_d("AlchemicalWizardry:blocks");
} }
@Override @Override
@ -61,14 +60,8 @@ public class BlockTeleposer extends BlockContainer
{ {
case 0: case 0:
return bottomIcon; return bottomIcon;
case 1: case 1:
return topIcon; return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default: default:
return sideIcon2; return sideIcon2;
} }
@ -97,13 +90,7 @@ public class BlockTeleposer extends BlockContainer
return true; return true;
} }
} }
player.openGui(AlchemicalWizardry.instance, 1, world, x, y, z); player.openGui(AlchemicalWizardry.instance, 1, world, x, y, z);
// this.swapBlocks(world, x, y+1, z, x, y+2, z);
//
// world.markBlockForUpdate(x, y, z);
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
return true; return true;
} }
@ -216,11 +203,6 @@ public class BlockTeleposer extends BlockContainer
} }
//TILES CLEARED //TILES CLEARED
// worldF.destroyBlock(xf, yf, zf, false);
// worldI.destroyBlock(xi, yi, zi, false);
// worldI.setBlockToAir(xi, yi, zi);
// worldF.setBlockToAir(xf, yf, zf);
worldF.setBlock(xf, yf, zf, initialBlock, metaI, 3); worldF.setBlock(xf, yf, zf, initialBlock, metaI, 3);
if (tileEntityI != null) if (tileEntityI != null)
@ -230,12 +212,6 @@ public class BlockTeleposer extends BlockContainer
newTileEntityI.xCoord = xf; newTileEntityI.xCoord = xf;
newTileEntityI.yCoord = yf; newTileEntityI.yCoord = yf;
newTileEntityI.zCoord = zf; newTileEntityI.zCoord = zf;
// TileEntity tile = worldI.getTileEntity(xf, yf, zf);
// if(tile instanceof TileMultipart)
// {
// TileMultipart.createFromNBT(nbttag1);
// }
} }
worldI.setBlock(xi, yi, zi, finalBlock, metaF, 3); worldI.setBlock(xi, yi, zi, finalBlock, metaF, 3);
@ -247,12 +223,6 @@ public class BlockTeleposer extends BlockContainer
newTileEntityF.xCoord = xi; newTileEntityF.xCoord = xi;
newTileEntityF.yCoord = yi; newTileEntityF.yCoord = yi;
newTileEntityF.zCoord = zi; newTileEntityF.zCoord = zi;
TileEntity tile = worldI.getTileEntity(xi, yi, zi);
// if(tile instanceof TileMultipart)
// {
// TileMultipart.createFromNBT(nbttag2);
// }
} }
return true; return true;

View file

@ -1,8 +1,9 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.List; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import java.util.Random; import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -17,10 +18,9 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable; import java.util.List;
import cpw.mods.fml.relauncher.Side; import java.util.Random;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockWritingTable extends BlockContainer public class BlockWritingTable extends BlockContainer
{ {
@ -60,14 +60,8 @@ public class BlockWritingTable extends BlockContainer
{ {
case 0: case 0:
return bottomIcon; return bottomIcon;
case 1: case 1:
return topIcon; return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default: default:
return sideIcon2; return sideIcon2;
} }

View file

@ -1,9 +1,9 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.List; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import javax.swing.Icon; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -11,10 +11,8 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks; import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BloodRune extends Block public class BloodRune extends Block
{ {
@ -59,9 +57,9 @@ public class BloodRune extends Block
case 3: //Orb Capacity rune case 3: //Orb Capacity rune
return 7; return 7;
case 4: //Better Capacity rune case 4: //Better Capacity rune
return 8; return 8;
} }
return 0; return 0;
@ -104,9 +102,9 @@ public class BloodRune extends Block
case 3: case 3:
return this.orbCapacityRuneIcon; return this.orbCapacityRuneIcon;
case 4: case 4:
return this.betterCapacityRuneIcon; return this.betterCapacityRuneIcon;
default: default:
return blockIcon; return blockIcon;

View file

@ -1,11 +1,11 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
public class BloodStoneBrick extends Block public class BloodStoneBrick extends Block
{ {

View file

@ -1,9 +1,9 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import net.minecraft.client.renderer.texture.IIconRegister;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
public class EfficiencyRune extends BloodRune public class EfficiencyRune extends BloodRune
{ {

View file

@ -1,11 +1,11 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
public class EmptySocket extends Block public class EmptySocket extends Block
{ {
@ -16,7 +16,6 @@ public class EmptySocket extends Block
setResistance(5.0F); setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic); setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("emptySocket"); this.setBlockName("emptySocket");
// TODO Auto-generated constructor stub
} }
@Override @Override

View file

@ -1,5 +1,9 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -10,12 +14,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ImperfectRitualStone extends Block public class ImperfectRitualStone extends Block
{ {
@ -26,7 +24,6 @@ public class ImperfectRitualStone extends Block
setResistance(5.0F); setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic); setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("imperfectRitualStone"); this.setBlockName("imperfectRitualStone");
// TODO Auto-generated constructor stub
} }
@Override @Override
@ -39,25 +36,19 @@ public class ImperfectRitualStone extends Block
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xOff, float yOff, float zOff) public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xOff, float yOff, float zOff)
{ {
//ItemStack ist = player.getItemInUse();
//if (!world.isRemote)
{ {
Block block = world.getBlock(x, y + 1, z); Block block = world.getBlock(x, y + 1, z);
if (block == Blocks.water) if (block == Blocks.water)
{ {
if (!player.capabilities.isCreativeMode && !world.isRemote) if (!player.capabilities.isCreativeMode && !world.isRemote)
{ {
EnergyItems.drainPlayerNetwork(player, 5000); EnergyItems.drainPlayerNetwork(player, 5000);
} }
if (!world.isRemote) if (!world.isRemote)
{ {
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z)); world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
// if (!player.capabilities.isCreativeMode)
// {
// PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
// }
} }
world.getWorldInfo().setRaining(true); world.getWorldInfo().setRaining(true);
@ -73,19 +64,13 @@ public class ImperfectRitualStone extends Block
return true; return true;
} else if (block == Blocks.coal_block) } else if (block == Blocks.coal_block)
{ {
if (!player.capabilities.isCreativeMode && !world.isRemote) if (!player.capabilities.isCreativeMode && !world.isRemote)
{ {
EnergyItems.drainPlayerNetwork(player, 5000); EnergyItems.drainPlayerNetwork(player, 5000);
} }
//EntityFallenAngel zomb = new EntityFallenAngel(world);
EntityZombie zomb = new EntityZombie(world); EntityZombie zomb = new EntityZombie(world);
zomb.setPosition(x + 0.5, y + 2, z + 0.5); zomb.setPosition(x + 0.5, y + 2, z + 0.5);
// zomb.setCurrentItemOrArmor(4, new ItemStack(Item.helmetIron.itemID,1,0));
// zomb.setCurrentItemOrArmor(3, new ItemStack(Item.plateIron.itemID,1,0));
// zomb.setCurrentItemOrArmor(2, new ItemStack(Item.legsIron.itemID,1,0));
// zomb.setCurrentItemOrArmor(1, new ItemStack(Item.bootsIron.itemID,1,0));
//zomb.setCurrentItemOrArmor(0, new ItemStack(AlchemicalWizardry.energySword.itemID,1,0));
zomb.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2000)); zomb.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2000));
zomb.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 20000, 7)); zomb.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 20000, 7));
zomb.addPotionEffect(new PotionEffect(Potion.resistance.id, 20000, 3)); zomb.addPotionEffect(new PotionEffect(Potion.resistance.id, 20000, 3));
@ -94,44 +79,31 @@ public class ImperfectRitualStone extends Block
{ {
world.spawnEntityInWorld(zomb); world.spawnEntityInWorld(zomb);
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z)); world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
// if (!player.capabilities.isCreativeMode)
// {
// PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
// }
} }
return true; return true;
} else if (block== Blocks.lapis_block) } else if (block == Blocks.lapis_block)
{ {
if (!player.capabilities.isCreativeMode && !world.isRemote) if (!player.capabilities.isCreativeMode && !world.isRemote)
{ {
EnergyItems.drainPlayerNetwork(player, 5000); EnergyItems.drainPlayerNetwork(player, 5000);
} }
if (!world.isRemote) if (!world.isRemote)
{ {
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z)); world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
world.setWorldTime((world.getWorldTime() / 24000) * 24000 + 13800); world.setWorldTime((world.getWorldTime() / 24000) * 24000 + 13800);
// if (!player.capabilities.isCreativeMode)
// {
// PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
// }
} }
} else if (block == Blocks.bedrock) } else if (block == Blocks.bedrock)
{ {
if (!player.capabilities.isCreativeMode && !world.isRemote) if (!player.capabilities.isCreativeMode && !world.isRemote)
{ {
EnergyItems.drainPlayerNetwork(player, 5000); EnergyItems.drainPlayerNetwork(player, 5000);
} }
if (!world.isRemote) if (!world.isRemote)
{ {
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z)); world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
//world.setWorldTime((world.getWorldTime()/24000)*24000+13800);
// if (!player.capabilities.isCreativeMode)
// {
// PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
// }
} }
player.addPotionEffect(new PotionEffect(Potion.resistance.id, 60 * 20, 1)); player.addPotionEffect(new PotionEffect(Potion.resistance.id, 60 * 20, 1));

View file

@ -1,11 +1,11 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
public class LargeBloodStoneBrick extends Block public class LargeBloodStoneBrick extends Block
{ {

View file

@ -1,14 +1,14 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.BlockFluidClassic;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class LifeEssenceBlock extends BlockFluidClassic public class LifeEssenceBlock extends BlockFluidClassic
{ {
@ -16,8 +16,6 @@ public class LifeEssenceBlock extends BlockFluidClassic
{ {
super(AlchemicalWizardry.lifeEssenceFluid, Material.water); super(AlchemicalWizardry.lifeEssenceFluid, Material.water);
AlchemicalWizardry.lifeEssenceFluid.setBlock(this); AlchemicalWizardry.lifeEssenceFluid.setBlock(this);
//setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("lifeEssenceFluidBlock"); this.setBlockName("lifeEssenceFluidBlock");
} }
@ -35,7 +33,6 @@ public class LifeEssenceBlock extends BlockFluidClassic
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:lifeEssenceStill"); this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:lifeEssenceStill");
AlchemicalWizardry.lifeEssenceFluid.setFlowingIcon(blockIcon); AlchemicalWizardry.lifeEssenceFluid.setFlowingIcon(blockIcon);
AlchemicalWizardry.lifeEssenceFluid.setStillIcon(blockIcon); AlchemicalWizardry.lifeEssenceFluid.setStillIcon(blockIcon);
//this.getFluid().setIcons(blockIcon);
} }
@Override @Override

View file

@ -1,5 +1,10 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.rituals.IRitualStone;
import WayofTime.alchemicalWizardry.common.items.ScribeTool;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -8,11 +13,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.rituals.IRitualStone;
import WayofTime.alchemicalWizardry.common.items.ScribeTool;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class RitualStone extends Block implements IRitualStone public class RitualStone extends Block implements IRitualStone
{ {

View file

@ -1,9 +1,9 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import net.minecraft.client.renderer.texture.IIconRegister;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
public class RuneOfSacrifice extends BloodRune public class RuneOfSacrifice extends BloodRune
{ {

View file

@ -1,9 +1,9 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import net.minecraft.client.renderer.texture.IIconRegister;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
public class RuneOfSelfSacrifice extends BloodRune public class RuneOfSelfSacrifice extends BloodRune
{ {

View file

@ -1,22 +1,21 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import java.util.Random; import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Facing; import net.minecraft.util.Facing;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
import cpw.mods.fml.relauncher.Side; import java.util.Random;
import cpw.mods.fml.relauncher.SideOnly;
public class SpectralBlock extends BlockContainer public class SpectralBlock extends BlockContainer
{ {
@ -26,13 +25,6 @@ public class SpectralBlock extends BlockContainer
this.setBlockName("spectralBlock"); this.setBlockName("spectralBlock");
} }
// @Override
// public int tickRate(World par1World)
// {
// return 10;
// }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) public void registerBlockIcons(IIconRegister iconRegister)
@ -43,7 +35,7 @@ public class SpectralBlock extends BlockContainer
@Override @Override
public boolean isOpaqueCube() public boolean isOpaqueCube()
{ {
Block d; Block d;
return false; return false;
} }
@ -52,7 +44,7 @@ public class SpectralBlock extends BlockContainer
{ {
return 0; return 0;
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
{ {
@ -83,7 +75,6 @@ public class SpectralBlock extends BlockContainer
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
{ {
//TEAltar tileEntity = (TEAltar)world.getBlockTileEntity(x, y, z);
if (player.isSneaking()) if (player.isSneaking())
{ {
return false; return false;
@ -95,7 +86,7 @@ public class SpectralBlock extends BlockContainer
{ {
if (playerItem.getItem() instanceof ItemBlock) if (playerItem.getItem() instanceof ItemBlock)
{ {
world.setBlock(x, y, z, ((ItemBlock)(playerItem.getItem())).field_150939_a, playerItem.getItemDamage(), 3); world.setBlock(x, y, z, ((ItemBlock) (playerItem.getItem())).field_150939_a, playerItem.getItemDamage(), 3);
if (!player.capabilities.isCreativeMode) if (!player.capabilities.isCreativeMode)
{ {
@ -112,9 +103,9 @@ public class SpectralBlock extends BlockContainer
return true; return true;
} }
@Override @Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
{ {
return new TESpectralBlock(); return new TESpectralBlock();
} }
} }

View file

@ -1,9 +1,9 @@
package WayofTime.alchemicalWizardry.common.block; package WayofTime.alchemicalWizardry.common.block;
import net.minecraft.client.renderer.texture.IIconRegister;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
public class SpeedRune extends BloodRune public class SpeedRune extends BloodRune
{ {

View file

@ -57,10 +57,10 @@ public class AltarUpgradeComponent
{ {
orbCapacitiveUpgrades++; orbCapacitiveUpgrades++;
} }
public void addBetterCapacitiveUpgrade() public void addBetterCapacitiveUpgrade()
{ {
betterCapacitiveUpgrades++; betterCapacitiveUpgrades++;
} }
public int getSpeedUpgrades() public int getSpeedUpgrades()
@ -97,9 +97,9 @@ public class AltarUpgradeComponent
{ {
return this.orbCapacitiveUpgrades; return this.orbCapacitiveUpgrades;
} }
public int getBetterCapacitiveUpgrades() public int getBetterCapacitiveUpgrades()
{ {
return this.betterCapacitiveUpgrades; return this.betterCapacitiveUpgrades;
} }
} }

View file

@ -1,14 +1,13 @@
package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade; package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.ModBlocks;
import java.util.List; import WayofTime.alchemicalWizardry.common.block.BloodRune;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks; import java.util.ArrayList;
import WayofTime.alchemicalWizardry.common.block.BloodRune; import java.util.List;
public class UpgradedAltars public class UpgradedAltars
{ {
@ -189,10 +188,10 @@ public class UpgradedAltars
case 7: case 7:
upgrades.addorbCapacitiveUpgrade(); upgrades.addorbCapacitiveUpgrade();
break; break;
case 8: case 8:
upgrades.addBetterCapacitiveUpgrade(); upgrades.addBetterCapacitiveUpgrade();
break; break;
} }
} }
} }

View file

@ -1,195 +1,195 @@
package WayofTime.alchemicalWizardry.common.demonVillage; package WayofTime.alchemicalWizardry.common.demonVillage;
import java.util.ArrayList; import WayofTime.alchemicalWizardry.common.Int3;
import java.util.List; import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs; import net.minecraft.block.BlockStairs;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.Int3;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
public class BlockSet import java.util.ArrayList;
import java.util.List;
public class BlockSet
{ {
protected String blockid; protected String blockid;
protected int[] metadata; protected int[] metadata;
protected List<Int3> positions; protected List<Int3> positions;
public BlockSet() public BlockSet()
{ {
this(Blocks.stone); this(Blocks.stone);
} }
public BlockSet(String blockid) public BlockSet(String blockid)
{ {
this.blockid = blockid; this.blockid = blockid;
this.metadata = new int[4]; this.metadata = new int[4];
positions = new ArrayList(); positions = new ArrayList();
} }
public BlockSet(Block block) public BlockSet(Block block)
{ {
this(BlockSet.getPairedIdForBlock(block)); this(BlockSet.getPairedIdForBlock(block));
} }
public BlockSet(Block block, int meta) public BlockSet(Block block, int meta)
{ {
this(block); this(block);
for(int i=0; i<metadata.length; i++) for (int i = 0; i < metadata.length; i++)
{ {
metadata[i] = meta; metadata[i] = meta;
} }
if(block instanceof BlockStairs) if (block instanceof BlockStairs)
{ {
int[] northSet = new int[]{2,3,0,1}; int[] northSet = new int[]{2, 3, 0, 1};
int[] eastSet = new int[]{1,0,2,3}; int[] eastSet = new int[]{1, 0, 2, 3};
int[] southSet = new int[]{3,2,1,0}; int[] southSet = new int[]{3, 2, 1, 0};
int[] westSet = new int[]{0,1,3,2}; int[] westSet = new int[]{0, 1, 3, 2};
int[] northUpSet = new int[]{6,7,4,5}; int[] northUpSet = new int[]{6, 7, 4, 5};
int[] eastUpSet = new int[]{5,4,6,7}; int[] eastUpSet = new int[]{5, 4, 6, 7};
int[] southUpSet = new int[]{7,6,5,4}; int[] southUpSet = new int[]{7, 6, 5, 4};
int[] westUpSet = new int[]{4,5,7,6}; int[] westUpSet = new int[]{4, 5, 7, 6};
switch(meta) switch (meta)
{ {
case 0: case 0:
metadata = westSet; metadata = westSet;
break; break;
case 1: case 1:
metadata = eastSet; metadata = eastSet;
break; break;
case 2: case 2:
metadata = northSet; metadata = northSet;
break; break;
case 3: case 3:
metadata = southSet; metadata = southSet;
break; break;
case 4: case 4:
metadata = westUpSet; metadata = westUpSet;
break; break;
case 5: case 5:
metadata = eastUpSet; metadata = eastUpSet;
break; break;
case 6: case 6:
metadata = northUpSet; metadata = northUpSet;
break; break;
case 7: case 7:
metadata = southUpSet; metadata = southUpSet;
break; break;
} }
} }
} }
public List<Int3> getPositions() public List<Int3> getPositions()
{ {
return positions; return positions;
} }
public void addPositionToBlock(int xOffset, int yOffset, int zOffset) public void addPositionToBlock(int xOffset, int yOffset, int zOffset)
{ {
positions.add(new Int3(xOffset, yOffset, zOffset)); positions.add(new Int3(xOffset, yOffset, zOffset));
} }
public Block getBlock() public Block getBlock()
{ {
return this.getBlockForString(blockid); return this.getBlockForString(blockid);
} }
public static String getPairedIdForBlock(Block block) public static String getPairedIdForBlock(Block block)
{ {
UniqueIdentifier un = GameRegistry.findUniqueIdentifierFor(block); UniqueIdentifier un = GameRegistry.findUniqueIdentifierFor(block);
String name = ""; String name = "";
if(un != null) if (un != null)
{ {
name = un.modId + ":" + un.name; name = un.modId + ":" + un.name;
} }
return name; return name;
} }
public static Block getBlockForString(String str) public static Block getBlockForString(String str)
{ {
String[] parts = str.split(":"); String[] parts = str.split(":");
String modId = parts[0]; String modId = parts[0];
String name = parts[1]; String name = parts[1];
return GameRegistry.findBlock(modId, name); return GameRegistry.findBlock(modId, name);
} }
public int getMetaForDirection(ForgeDirection dir) public int getMetaForDirection(ForgeDirection dir)
{ {
if(metadata.length < 4) if (metadata.length < 4)
{ {
return 0; return 0;
} }
switch(dir) switch (dir)
{ {
case NORTH: case NORTH:
return metadata[0]; return metadata[0];
case SOUTH: case SOUTH:
return metadata[1]; return metadata[1];
case WEST: case WEST:
return metadata[2]; return metadata[2];
case EAST: case EAST:
return metadata[3]; return metadata[3];
default: default:
return 0; return 0;
} }
} }
public void buildAtIndex(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, int index) public void buildAtIndex(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir, int index)
{ {
Block block = this.getBlock(); Block block = this.getBlock();
if(index >= positions.size() || block == null) if (index >= positions.size() || block == null)
{ {
return; return;
} }
Int3 position = positions.get(index); Int3 position = positions.get(index);
int xOff = position.xCoord; int xOff = position.xCoord;
int yOff = position.yCoord; int yOff = position.yCoord;
int zOff = position.zCoord; int zOff = position.zCoord;
int meta = this.getMetaForDirection(dir); int meta = this.getMetaForDirection(dir);
switch(dir) switch (dir)
{ {
case NORTH: case NORTH:
break; break;
case SOUTH: case SOUTH:
xOff *= -1; xOff *= -1;
zOff *= -1; zOff *= -1;
break; break;
case WEST: case WEST:
int temp = zOff; int temp = zOff;
zOff = xOff * -1; zOff = xOff * -1;
xOff = temp; xOff = temp;
break; break;
case EAST: case EAST:
int temp2 = zOff * -1; int temp2 = zOff * -1;
zOff = xOff; zOff = xOff;
xOff = temp2; xOff = temp2;
break; break;
default: default:
} }
world.setBlock(xCoord + xOff, yCoord + yOff, zCoord + zOff, block, meta, 3); world.setBlock(xCoord + xOff, yCoord + yOff, zCoord + zOff, block, meta, 3);
} }
public void buildAll(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir) public void buildAll(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
{ {
for(int i=0; i<positions.size(); i++) for (int i = 0; i < positions.size(); i++)
{ {
this.buildAtIndex(world, xCoord, yCoord, zCoord, dir, i); this.buildAtIndex(world, xCoord, yCoord, zCoord, dir, i);
} }
} }
public boolean isContained(Block block, int defaultMeta) public boolean isContained(Block block, int defaultMeta)
{ {
Block thisBlock = this.getBlock(); Block thisBlock = this.getBlock();
return thisBlock == null ? false : thisBlock.equals(block) && this.metadata[0] == defaultMeta; return thisBlock == null ? false : thisBlock.equals(block) && this.metadata[0] == defaultMeta;
} }
} }

View file

@ -1,183 +1,180 @@
package WayofTime.alchemicalWizardry.common.demonVillage; package WayofTime.alchemicalWizardry.common.demonVillage;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.Int3;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; public class BuildingSchematic
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.Int3;
public class BuildingSchematic
{ {
public String name; public String name;
public int doorX; public int doorX;
public int doorZ; public int doorZ;
public int doorY; public int doorY;
public int buildingTier; public int buildingTier;
public int buildingType; public int buildingType;
public List<BlockSet> blockList; public List<BlockSet> blockList;
public BuildingSchematic() public BuildingSchematic()
{ {
this(""); this("");
} }
public BuildingSchematic(String name) public BuildingSchematic(String name)
{ {
this.name = name; this.name = name;
blockList = new ArrayList(); blockList = new ArrayList();
this.doorX = 0; this.doorX = 0;
this.doorZ = 0; this.doorZ = 0;
this.doorY = 0; this.doorY = 0;
this.buildingTier = 0; this.buildingTier = 0;
this.buildingType = DemonBuilding.BUILDING_HOUSE; this.buildingType = DemonBuilding.BUILDING_HOUSE;
} }
public void addBlockWithMeta(Block block, int meta, int xOffset, int yOffset, int zOffset) public void addBlockWithMeta(Block block, int meta, int xOffset, int yOffset, int zOffset)
{ {
for(BlockSet set : blockList) for (BlockSet set : blockList)
{ {
if(set.isContained(block, meta)) if (set.isContained(block, meta))
{ {
set.addPositionToBlock(xOffset, yOffset, zOffset); set.addPositionToBlock(xOffset, yOffset, zOffset);
return; return;
} }
} }
BlockSet set = new BlockSet(block, meta); BlockSet set = new BlockSet(block, meta);
set.addPositionToBlock(xOffset, yOffset, zOffset); set.addPositionToBlock(xOffset, yOffset, zOffset);
blockList.add(set); blockList.add(set);
} }
public void buildAll(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir) public void buildAll(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
{ {
for(BlockSet set : blockList) for (BlockSet set : blockList)
{ {
set.buildAll(world, xCoord, yCoord, zCoord, dir); set.buildAll(world, xCoord, yCoord, zCoord, dir);
} }
} }
public GridSpaceHolder createGSH() public GridSpaceHolder createGSH()
{ {
GridSpaceHolder holder = new GridSpaceHolder(); GridSpaceHolder holder = new GridSpaceHolder();
for(BlockSet set : blockList) for (BlockSet set : blockList)
{ {
for(Int3 coords : set.getPositions()) for (Int3 coords : set.getPositions())
{ {
int gridX = (int)((coords.xCoord+2*Math.signum(coords.xCoord))/5); int gridX = (int) ((coords.xCoord + 2 * Math.signum(coords.xCoord)) / 5);
int gridZ = (int)((coords.zCoord+2*Math.signum(coords.zCoord))/5); int gridZ = (int) ((coords.zCoord + 2 * Math.signum(coords.zCoord)) / 5);
holder.setGridSpace(gridX, gridZ, new GridSpace(GridSpace.HOUSE,0)); holder.setGridSpace(gridX, gridZ, new GridSpace(GridSpace.HOUSE, 0));
} }
} }
return holder; return holder;
} }
public Int3 getGridSpotOfDoor() public Int3 getGridSpotOfDoor()
{ {
int gridX = (int)((doorX+2*Math.signum(doorX))/5); int gridX = (int) ((doorX + 2 * Math.signum(doorX)) / 5);
int gridZ = (int)((doorZ+2*Math.signum(doorZ))/5); int gridZ = (int) ((doorZ + 2 * Math.signum(doorZ)) / 5);
return new Int3(gridX, doorY, gridZ); return new Int3(gridX, doorY, gridZ);
} }
public List<Int3> getGriddedPositions(ForgeDirection dir) public List<Int3> getGriddedPositions(ForgeDirection dir)
{ {
List<Int3> positionList = new ArrayList(); List<Int3> positionList = new ArrayList();
for(BlockSet blockSet : blockList) for (BlockSet blockSet : blockList)
{ {
for(Int3 pos : blockSet.getPositions()) for (Int3 pos : blockSet.getPositions())
{ {
int xOff = pos.xCoord; int xOff = pos.xCoord;
int zOff = pos.zCoord; int zOff = pos.zCoord;
switch(dir) switch (dir)
{ {
case SOUTH: case SOUTH:
xOff *= -1; xOff *= -1;
zOff *= -1; zOff *= -1;
break; break;
case WEST: case WEST:
int temp = zOff; int temp = zOff;
zOff = xOff * -1; zOff = xOff * -1;
xOff = temp; xOff = temp;
break; break;
case EAST: case EAST:
int temp2 = zOff * -1; int temp2 = zOff * -1;
zOff = xOff; zOff = xOff;
xOff = temp2; xOff = temp2;
break; break;
default: default:
} }
Int3 nextPos = new Int3(xOff, 0, zOff); Int3 nextPos = new Int3(xOff, 0, zOff);
if(!positionList.contains(nextPos)) if (!positionList.contains(nextPos))
{ {
positionList.add(nextPos); positionList.add(nextPos);
} }
} }
} }
return positionList; return positionList;
} }
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir) public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
{ {
GridSpaceHolder grid = this.createGSH(); //GridSpaceHolder is not aware of the buildings - need to use the schematic GridSpaceHolder grid = this.createGSH(); //GridSpaceHolder is not aware of the buildings - need to use the schematic
List<Int3> positionList = getGriddedPositions(dir); List<Int3> positionList = getGriddedPositions(dir);
for(int i=this.getMinY(); i<=this.getMaxY(); i++) for (int i = this.getMinY(); i <= this.getMaxY(); i++)
{ {
for(Int3 pos : positionList) for (Int3 pos : positionList)
{ {
Block block = world.getBlock(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord); Block block = world.getBlock(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
if(block != ModBlocks.blockDemonPortal) if (block != ModBlocks.blockDemonPortal)
{ {
world.setBlockToAir(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord); world.setBlockToAir(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
} }
} }
}
//grid.destroyAllInGridSpaces(world, xCoord, yCoord + i, zCoord, dir); //Deprecated method }
}
} public int getMinY()
{
public int getMinY() int min = 0;
{ for (BlockSet set : blockList)
int min = 0; {
for(BlockSet set : blockList) for (Int3 pos : set.getPositions())
{ {
for(Int3 pos : set.getPositions()) if (pos.yCoord < min)
{ {
if(pos.yCoord < min) min = pos.yCoord;
{ }
min = pos.yCoord; }
} }
}
} return min;
}
return min;
} public int getMaxY()
{
public int getMaxY() int max = 0;
{ for (BlockSet set : blockList)
int max = 0; {
for(BlockSet set : blockList) for (Int3 pos : set.getPositions())
{ {
for(Int3 pos : set.getPositions()) if (pos.yCoord > max)
{ {
if(pos.yCoord > max) max = pos.yCoord;
{ }
max = pos.yCoord; }
} }
} return max;
} }
return max;
}
} }

View file

@ -1,120 +1,120 @@
package WayofTime.alchemicalWizardry.common.demonVillage; package WayofTime.alchemicalWizardry.common.demonVillage;
import WayofTime.alchemicalWizardry.common.Int3;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.Int3;
public class DemonBuilding public class DemonBuilding
{ {
public static final int BUILDING_HOUSE = 0; public static final int BUILDING_HOUSE = 0;
public static final int BUILDING_PORTAL = 1; public static final int BUILDING_PORTAL = 1;
public BuildingSchematic schematic; public BuildingSchematic schematic;
public GridSpaceHolder area; public GridSpaceHolder area;
public int buildingTier; public int buildingTier;
public int buildingType; public int buildingType;
public Int3 doorGridSpace; public Int3 doorGridSpace;
public DemonBuilding(BuildingSchematic schematic) public DemonBuilding(BuildingSchematic schematic)
{ {
this.schematic = schematic; this.schematic = schematic;
this.buildingType = schematic.buildingType; this.buildingType = schematic.buildingType;
this.buildingTier = schematic.buildingTier; this.buildingTier = schematic.buildingTier;
this.area = this.createGSHForSchematic(schematic); this.area = this.createGSHForSchematic(schematic);
this.doorGridSpace = schematic.getGridSpotOfDoor(); this.doorGridSpace = schematic.getGridSpotOfDoor();
} }
public String getName() public String getName()
{ {
return schematic.name; return schematic.name;
} }
public boolean isValid(GridSpaceHolder master, int gridX, int gridZ, ForgeDirection dir) public boolean isValid(GridSpaceHolder master, int gridX, int gridZ, ForgeDirection dir)
{ {
return area.doesContainAll(master, gridX, gridZ, dir); return area.doesContainAll(master, gridX, gridZ, dir);
} }
public void buildAll(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir) public void buildAll(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
{ {
schematic.buildAll(world, xCoord, yCoord, zCoord, dir); schematic.buildAll(world, xCoord, yCoord, zCoord, dir);
} }
public void setAllGridSpaces(int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master) public void setAllGridSpaces(int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master)
{ {
area.setAllGridSpaces(xInit, zInit, yLevel, dir, type, master); area.setAllGridSpaces(xInit, zInit, yLevel, dir, type, master);
} }
public GridSpaceHolder createGSHForSchematic(BuildingSchematic scheme) public GridSpaceHolder createGSHForSchematic(BuildingSchematic scheme)
{ {
switch(this.buildingType) switch (this.buildingType)
{ {
case DemonBuilding.BUILDING_HOUSE: case DemonBuilding.BUILDING_HOUSE:
return scheme.createGSH(); return scheme.createGSH();
case DemonBuilding.BUILDING_PORTAL: case DemonBuilding.BUILDING_PORTAL:
} }
return scheme.createGSH(); return scheme.createGSH();
} }
public Int3 getDoorSpace(ForgeDirection dir) public Int3 getDoorSpace(ForgeDirection dir)
{ {
int x = 0; int x = 0;
int z = 0; int z = 0;
switch(dir) switch (dir)
{ {
case SOUTH: case SOUTH:
x = -doorGridSpace.xCoord; x = -doorGridSpace.xCoord;
z = -doorGridSpace.zCoord; z = -doorGridSpace.zCoord;
break; break;
case WEST: case WEST:
x = doorGridSpace.zCoord; x = doorGridSpace.zCoord;
z = -doorGridSpace.xCoord; z = -doorGridSpace.xCoord;
break; break;
case EAST: case EAST:
x = -doorGridSpace.zCoord; x = -doorGridSpace.zCoord;
z = doorGridSpace.xCoord; z = doorGridSpace.xCoord;
break; break;
default: default:
x = doorGridSpace.xCoord; x = doorGridSpace.xCoord;
z = doorGridSpace.zCoord; z = doorGridSpace.zCoord;
break; break;
} }
return new Int3(x, doorGridSpace.yCoord, z); return new Int3(x, doorGridSpace.yCoord, z);
} }
public Int3 getGridOffsetFromRoad(ForgeDirection sideOfRoad, int yLevel) public Int3 getGridOffsetFromRoad(ForgeDirection sideOfRoad, int yLevel)
{ {
Int3 doorSpace = this.getDoorSpace(sideOfRoad); Int3 doorSpace = this.getDoorSpace(sideOfRoad);
int x = doorSpace.xCoord; int x = doorSpace.xCoord;
int z = doorSpace.zCoord; int z = doorSpace.zCoord;
switch(sideOfRoad) switch (sideOfRoad)
{ {
case SOUTH: case SOUTH:
z++; z++;
break; break;
case EAST: case EAST:
x++; x++;
break; break;
case WEST: case WEST:
x--; x--;
break; break;
default: default:
z--; z--;
break; break;
} }
return new Int3(x, yLevel, z); return new Int3(x, yLevel, z);
} }
public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir) public void destroyAllInField(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
{ {
schematic.destroyAllInField(world, xCoord, yCoord, zCoord, dir); schematic.destroyAllInField(world, xCoord, yCoord, zCoord, dir);
} }
public int getNumberOfGridSpaces() public int getNumberOfGridSpaces()
{ {
return area.getNumberOfGridSpaces(); return area.getNumberOfGridSpaces();
} }
} }

View file

@ -2,21 +2,21 @@ package WayofTime.alchemicalWizardry.common.demonVillage;
import net.minecraft.world.World; import net.minecraft.world.World;
public class DemonCrosspath public class DemonCrosspath
{ {
private int xCoord; private int xCoord;
private int yLevel; private int yLevel;
private int zCoord; private int zCoord;
public DemonCrosspath(int xCoord, int yLevel, int zCoord) public DemonCrosspath(int xCoord, int yLevel, int zCoord)
{ {
this.xCoord = xCoord; this.xCoord = xCoord;
this.yLevel = yLevel; this.yLevel = yLevel;
this.zCoord = zCoord; this.zCoord = zCoord;
} }
public void createCrosspath(World world) public void createCrosspath(World world)
{ {
} }
} }

View file

@ -1,135 +1,135 @@
package WayofTime.alchemicalWizardry.common.demonVillage; package WayofTime.alchemicalWizardry.common.demonVillage;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.Int3;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.Int3;
public class DemonVillagePath public class DemonVillagePath
{ {
public int xi; public int xi;
public int yi; public int yi;
public int zi; public int zi;
public ForgeDirection dir; public ForgeDirection dir;
public int length; public int length;
public DemonVillagePath(int xi, int yi, int zi, ForgeDirection dir, int length) public DemonVillagePath(int xi, int yi, int zi, ForgeDirection dir, int length)
{ {
this.xi = xi; this.xi = xi;
this.yi = yi; this.yi = yi;
this.zi = zi; this.zi = zi;
this.dir = dir; this.dir = dir;
this.length = length; this.length = length;
} }
public Int3 constructFullPath(World world, int clearance, Block block, int meta) public Int3 constructFullPath(World world, int clearance, Block block, int meta)
{ {
int xPos = this.xi; int xPos = this.xi;
int yPos = this.yi; int yPos = this.yi;
int zPos = this.zi; int zPos = this.zi;
int rad = this.getRoadRadius(); int rad = this.getRoadRadius();
for(int i=-rad; i<=rad; i++) for (int i = -rad; i <= rad; i++)
{ {
this.constructPartialPath(world, clearance, block, meta, xPos-rad*dir.offsetX+i*dir.offsetZ, yPos, zPos-rad*dir.offsetZ+i*dir.offsetX, dir, length+2*rad); this.constructPartialPath(world, clearance, block, meta, xPos - rad * dir.offsetX + i * dir.offsetZ, yPos, zPos - rad * dir.offsetZ + i * dir.offsetX, dir, length + 2 * rad);
} }
return this.getFinalLocation(world, clearance); return this.getFinalLocation(world, clearance);
} }
public void constructPartialPath(World world, int clearance, Block roadBlock, int meta, int xi, int yi, int zi, ForgeDirection dir, int length) public void constructPartialPath(World world, int clearance, Block roadBlock, int meta, int xi, int yi, int zi, ForgeDirection dir, int length)
{ {
int xPos = xi; int xPos = xi;
int yPos = yi; int yPos = yi;
int zPos = zi; int zPos = zi;
for(int i=0; i<length; i++) for (int i = 0; i < length; i++)
{ {
int xOffset = i*dir.offsetX; int xOffset = i * dir.offsetX;
int zOffset = i*dir.offsetZ; int zOffset = i * dir.offsetZ;
for(int yOffset=0; yOffset<=clearance; yOffset++) for (int yOffset = 0; yOffset <= clearance; yOffset++)
{ {
int sign = 1; int sign = 1;
Block block1 = world.getBlock(xPos + xOffset, yPos + sign*yOffset, zPos + zOffset); Block block1 = world.getBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset);
Block highBlock1 = world.getBlock(xPos + xOffset, yPos + sign*yOffset + 1, zPos + zOffset); Block highBlock1 = world.getBlock(xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset);
if(!block1.isReplaceable(world, xPos + xOffset, yPos + sign*yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) && highBlock1.isReplaceable(world, xPos + xOffset, yPos + sign*yOffset + 1, zPos + zOffset)) if (!block1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) && highBlock1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset))
{ {
world.setBlock(xPos + xOffset, yPos + sign*yOffset, zPos + zOffset, roadBlock, meta, 3); world.setBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset, roadBlock, meta, 3);
yPos += sign*yOffset; yPos += sign * yOffset;
break; break;
}else } else
{ {
sign = -1; sign = -1;
Block block2 = world.getBlock(xPos + xOffset, yPos + sign*yOffset, zPos + zOffset); Block block2 = world.getBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset);
Block highBlock2 = world.getBlock(xPos + xOffset, yPos + sign*yOffset + 1, zPos + zOffset); Block highBlock2 = world.getBlock(xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset);
if(!block2.isReplaceable(world, xPos + xOffset, yPos + sign*yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) && highBlock2.isReplaceable(world, xPos + xOffset, yPos + sign*yOffset + 1, zPos + zOffset)) if (!block2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) && highBlock2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset))
{ {
world.setBlock(xPos + xOffset, yPos + sign*yOffset, zPos + zOffset, roadBlock, meta, 3); world.setBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset, roadBlock, meta, 3);
yPos += sign*yOffset; yPos += sign * yOffset;
break; break;
} }
} }
} }
} }
} }
public Int3 getFinalLocation(World world, int clearance) public Int3 getFinalLocation(World world, int clearance)
{ {
int xPos = xi; int xPos = xi;
int yPos = yi; int yPos = yi;
int zPos = zi; int zPos = zi;
for(int i=0; i<length; i++) for (int i = 0; i < length; i++)
{ {
int xOffset = i*dir.offsetX; int xOffset = i * dir.offsetX;
int zOffset = i*dir.offsetZ; int zOffset = i * dir.offsetZ;
for(int yOffset=0; yOffset<=clearance; yOffset++) for (int yOffset = 0; yOffset <= clearance; yOffset++)
{ {
int sign = 1; int sign = 1;
Block block1 = world.getBlock(xPos + xOffset, yPos + sign*yOffset, zPos + zOffset); Block block1 = world.getBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset);
Block highBlock1 = world.getBlock(xPos + xOffset, yPos + sign*yOffset + 1, zPos + zOffset); Block highBlock1 = world.getBlock(xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset);
if(!block1.isReplaceable(world, xPos + xOffset, yPos + sign*yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) && highBlock1.isReplaceable(world, xPos + xOffset, yPos + sign*yOffset + 1, zPos + zOffset)) if (!block1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) && highBlock1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset))
{ {
yPos += sign*yOffset; yPos += sign * yOffset;
break; break;
}else } else
{ {
sign = -1; sign = -1;
Block block2 = world.getBlock(xPos + xOffset, yPos + sign*yOffset, zPos + zOffset); Block block2 = world.getBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset);
Block highBlock2 = world.getBlock(xPos + xOffset, yPos + sign*yOffset + 1, zPos + zOffset); Block highBlock2 = world.getBlock(xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset);
if(!block2.isReplaceable(world, xPos + xOffset, yPos + sign*yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) && highBlock2.isReplaceable(world, xPos + xOffset, yPos + sign*yOffset + 1, zPos + zOffset)) if (!block2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) && highBlock2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset))
{ {
yPos += sign*yOffset; yPos += sign * yOffset;
break; break;
} }
} }
} }
} }
return new Int3(xPos,yPos,zPos); return new Int3(xPos, yPos, zPos);
} }
public int getRoadRadius() public int getRoadRadius()
{ {
return 1; return 1;
} }
public boolean isBlockReplaceable(Block block) public boolean isBlockReplaceable(Block block)
{ {
if(block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine) if (block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine)
{ {
return false; return false;
} }
return !block.equals(ModBlocks.blockDemonPortal); return !block.equals(ModBlocks.blockDemonPortal);
} }
} }

View file

@ -2,76 +2,76 @@ package WayofTime.alchemicalWizardry.common.demonVillage;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
public class GridSpace public class GridSpace
{ {
public static final int EMPTY = 0; public static final int EMPTY = 0;
public static final int MAIN_PORTAL = 1; public static final int MAIN_PORTAL = 1;
public static final int MINI_PORTAL = 2; public static final int MINI_PORTAL = 2;
public static final int ROAD = 3; public static final int ROAD = 3;
public static final int CROSSROAD = 4; public static final int CROSSROAD = 4;
public static final int HOUSE = 5; public static final int HOUSE = 5;
private int yLevel; private int yLevel;
private int type; private int type;
public GridSpace() public GridSpace()
{ {
this(EMPTY, -1); this(EMPTY, -1);
} }
public GridSpace(int type, int yLevel) public GridSpace(int type, int yLevel)
{ {
this.type = type; this.type = type;
this.yLevel = yLevel; this.yLevel = yLevel;
} }
public int getGridType() public int getGridType()
{ {
return this.type; return this.type;
} }
public void setGridType(int type) public void setGridType(int type)
{ {
this.type = type; this.type = type;
} }
public int getYLevel() public int getYLevel()
{ {
return this.yLevel; return this.yLevel;
} }
public void setYLevel(int yLevel) public void setYLevel(int yLevel)
{ {
this.yLevel = yLevel; this.yLevel = yLevel;
} }
public boolean isEmpty() public boolean isEmpty()
{ {
return type == this.EMPTY; return type == this.EMPTY;
} }
public static GridSpace getGridFromTag(NBTTagCompound tag) public static GridSpace getGridFromTag(NBTTagCompound tag)
{ {
return new GridSpace(tag.getInteger("type"), tag.getInteger("yLevel")); return new GridSpace(tag.getInteger("type"), tag.getInteger("yLevel"));
} }
public NBTTagCompound getTag() public NBTTagCompound getTag()
{ {
NBTTagCompound tag = new NBTTagCompound(); NBTTagCompound tag = new NBTTagCompound();
tag.setInteger("type", type); tag.setInteger("type", type);
tag.setInteger("yLevel", yLevel); tag.setInteger("yLevel", yLevel);
return tag; return tag;
} }
public boolean isRoadSegment() public boolean isRoadSegment()
{ {
return type == this.ROAD || type == this.CROSSROAD; return type == this.ROAD || type == this.CROSSROAD;
} }
public boolean isBuilding() public boolean isBuilding()
{ {
return type == this.HOUSE; return type == this.HOUSE;
} }
} }

Some files were not shown because too many files have changed in this diff Show more