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;
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.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
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.
* User: Pokefenn
@ -23,8 +23,8 @@ import cpw.mods.fml.relauncher.Side;
*/
public class BloodMagicConfiguration
{
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>();
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 Configuration config;
public static final String CATEGORY_GAMEPLAY = "gameplay";
@ -32,11 +32,11 @@ public class BloodMagicConfiguration
public static void init(File configFile)
{
for (String s : DEFAULT_COLOR_LIST.split(";"))
{
String[] ct = s.split(",");
colorList.add(new ColourThreshold(Integer.valueOf(ct[0].trim()), ct[1].trim()));
}
for (String s : DEFAULT_COLOR_LIST.split(";"))
{
String[] ct = s.split(",");
colorList.add(new ColourThreshold(Integer.valueOf(ct[0].trim()), ct[1].trim()));
}
config = new Configuration(configFile);
@ -59,12 +59,12 @@ public class BloodMagicConfiguration
AlchemicalWizardry.customPotionInhibitID = config.get("Potion ID", "Inhibit", 103).getInt();
AlchemicalWizardry.customPotionFlightID = config.get("Potion ID", "Flight", 104).getInt();
AlchemicalWizardry.customPotionReciprocationID = config.get("Potion ID", "Reciprocation", 105).getInt();
AlchemicalWizardry.customPotionFlameCloakID = config.get("Potion ID","FlameCloak",106).getInt();
AlchemicalWizardry.customPotionIceCloakID = config.get("Potion ID","IceCloak",107).getInt();
AlchemicalWizardry.customPotionHeavyHeartID = config.get("Potion ID","HeavyHeart",108).getInt();
AlchemicalWizardry.customPotionFireFuseID = config.get("Potion ID","FireFuse",109).getInt();
AlchemicalWizardry.customPotionPlanarBindingID = config.get("Potion ID","PlanarBinding",110).getInt();
AlchemicalWizardry.customPotionSoulFrayID = config.get("Potion ID","SoulFray",111).getInt();
AlchemicalWizardry.customPotionFlameCloakID = config.get("Potion ID", "FlameCloak", 106).getInt();
AlchemicalWizardry.customPotionIceCloakID = config.get("Potion ID", "IceCloak", 107).getInt();
AlchemicalWizardry.customPotionHeavyHeartID = config.get("Potion ID", "HeavyHeart", 108).getInt();
AlchemicalWizardry.customPotionFireFuseID = config.get("Potion ID", "FireFuse", 109).getInt();
AlchemicalWizardry.customPotionPlanarBindingID = config.get("Potion ID", "PlanarBinding", 110).getInt();
AlchemicalWizardry.customPotionSoulFrayID = config.get("Potion ID", "SoulFray", 111).getInt();
AlchemicalWizardry.customPotionSoulHardenID = config.get("Potion ID", "SoulHarden", 112).getInt();
AlchemicalWizardry.customPotionDeafID = config.get("Potion ID", "Deaf", 113).getInt();
AlchemicalWizardry.customPotionFeatherFallID = config.get("Potion ID", "FeatherFall", 114).getInt();
@ -80,16 +80,16 @@ 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.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.causeHungerWithRegen = config.get("WimpySettings", "causeHungerWithRegen", true).getBoolean();
// AlchemicalWizardry.lockdownAltar = config.get("WimpySettings", "LockdownAltarWithRegen", true).getBoolean();
AlchemicalWizardry.lockdownAltar = false;
Side side = FMLCommonHandler.instance().getSide();
if(side == Side.CLIENT)
if (side == Side.CLIENT)
{
RenderHelper.xOffset = config.get("ClientSettings", "AlchemyHUDxOffset", 50).getInt();
RenderHelper.yOffset = config.get("ClientSettings", "AlchemyHUDyOffset", 2).getInt();
@ -100,7 +100,7 @@ public class BloodMagicConfiguration
{
//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
{
@ -126,21 +126,21 @@ public class BloodMagicConfiguration
public static void loadBlacklist()
{
AlchemicalWizardry.wellBlacklist=new ArrayList<Class>();
for( Object o : EntityList.stringToClassMapping.entrySet())
{
Entry entry=(Entry) o;
Class curClass=(Class)entry.getValue();
boolean valid=EntityLivingBase.class.isAssignableFrom(curClass) && !Modifier.isAbstract(curClass.getModifiers());
if(valid)
{
boolean blacklisted=config.get("wellOfSufferingBlackList", entry.getKey().toString(), false).getBoolean();
if(blacklisted)
AlchemicalWizardry.wellBlacklist.add(curClass);
}
AlchemicalWizardry.wellBlacklist = new ArrayList<Class>();
for (Object o : EntityList.stringToClassMapping.entrySet())
{
Entry entry = (Entry) o;
Class curClass = (Class) entry.getValue();
boolean valid = EntityLivingBase.class.isAssignableFrom(curClass) && !Modifier.isAbstract(curClass.getModifiers());
if (valid)
{
boolean blacklisted = config.get("wellOfSufferingBlackList", entry.getKey().toString(), false).getBoolean();
if (blacklisted)
AlchemicalWizardry.wellBlacklist.add(curClass);
}
}
config.save();
}
config.save();
}

View file

@ -1,46 +1,9 @@
package WayofTime.alchemicalWizardry;
import net.minecraft.block.Block;
import WayofTime.alchemicalWizardry.common.block.ArmourForge;
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 WayofTime.alchemicalWizardry.common.block.*;
import WayofTime.alchemicalWizardry.common.items.*;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
/**
* Created with IntelliJ IDEA.
@ -54,8 +17,6 @@ public class ModBlocks
public static Block testingBlock;
public static Block bloodStoneBrick;
public static Block largeBloodStoneBrick;
// public static Block lifeEssenceStill;
// public static Block lifeEssenceFlowing;
public static BlockAltar blockAltar;
public static BloodRune bloodRune;
public static SpeedRune speedRune;
@ -96,7 +57,6 @@ public class ModBlocks
efficiencyRune = new EfficiencyRune();
runeOfSacrifice = new RuneOfSacrifice();
runeOfSelfSacrifice = new RuneOfSelfSacrifice();
blockTeleposer = new BlockTeleposer();
spectralBlock = new SpectralBlock();
ritualStone = new RitualStone();
@ -129,8 +89,8 @@ public class ModBlocks
public static void registerBlocksInPre()
{
GameRegistry.registerBlock(ModBlocks.blockAltar, "Altar");
GameRegistry.registerBlock(ModBlocks.bloodRune, ItemBloodRuneBlock.class, "AlchemicalWizardry" + (ModBlocks.bloodRune.getUnlocalizedName().substring(5)));
GameRegistry.registerBlock(ModBlocks.blockAltar, "Altar");
GameRegistry.registerBlock(ModBlocks.bloodRune, ItemBloodRuneBlock.class, "AlchemicalWizardry" + (ModBlocks.bloodRune.getUnlocalizedName().substring(5)));
GameRegistry.registerBlock(ModBlocks.blockLifeEssence, "lifeEssence");
GameRegistry.registerBlock(ModBlocks.speedRune, "speedRune");
GameRegistry.registerBlock(ModBlocks.efficiencyRune, "efficiencyRune");
@ -141,7 +101,7 @@ public class ModBlocks
GameRegistry.registerBlock(ModBlocks.bloodSocket, "bloodSocket");
GameRegistry.registerBlock(ModBlocks.imperfectRitualStone, "imperfectRitualStone");
GameRegistry.registerBlock(ModBlocks.armourForge, "armourForge");
GameRegistry.registerBlock(ModBlocks.armourForge, "armourForge");
GameRegistry.registerBlock(ModBlocks.emptySocket, "emptySocket");
GameRegistry.registerBlock(ModBlocks.bloodStoneBrick, "bloodStoneBrick");
GameRegistry.registerBlock(ModBlocks.largeBloodStoneBrick, "largeBloodStoneBrick");
@ -153,11 +113,11 @@ public class ModBlocks
GameRegistry.registerBlock(ModBlocks.spectralBlock, "spectralBlock");
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.blockSpellEnhancement, ItemSpellEnhancementBlock.class,"AlchemicalWizardry" + (ModBlocks.blockSpellEnhancement.getUnlocalizedName()));
GameRegistry.registerBlock(ModBlocks.blockSpellModifier, ItemSpellModifierBlock.class,"AlchemicalWizardry" + (ModBlocks.blockSpellModifier.getUnlocalizedName()));
GameRegistry.registerBlock(ModBlocks.blockSpellEffect, ItemSpellEffectBlock.class,"AlchemicalWizardry" + (ModBlocks.blockSpellEffect.getUnlocalizedName()));
GameRegistry.registerBlock(ModBlocks.blockSpellEnhancement, ItemSpellEnhancementBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellEnhancement.getUnlocalizedName()));
GameRegistry.registerBlock(ModBlocks.blockSpellModifier, ItemSpellModifierBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellModifier.getUnlocalizedName()));
GameRegistry.registerBlock(ModBlocks.blockSpellEffect, ItemSpellEffectBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellEffect.getUnlocalizedName()));
GameRegistry.registerBlock(ModBlocks.blockSpectralContainer, "spectralContainer");
GameRegistry.registerBlock(ModBlocks.blockDemonPortal, "demonPortalMain");
@ -169,6 +129,5 @@ public class ModBlocks
public static void registerBlocksInInit()
{
//GameRegistry.registerBlock(ModBlocks.blockLifeEssence, "lifeEssence");
}
}

View file

@ -1,82 +1,16 @@
package WayofTime.alchemicalWizardry;
import net.minecraft.creativetab.CreativeTabs;
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.*;
import WayofTime.alchemicalWizardry.common.items.energy.ItemAttunedCrystal;
import WayofTime.alchemicalWizardry.common.items.energy.ItemDestinationClearer;
import WayofTime.alchemicalWizardry.common.items.energy.ItemTankSegmenter;
import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask;
import WayofTime.alchemicalWizardry.common.items.potion.AlchemyReagent;
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.potion.*;
import WayofTime.alchemicalWizardry.common.items.sigil.*;
import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool;
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.
@ -284,12 +218,12 @@ public class ModItems
public static void registerItems()
{
GameRegistry.registerItem(ModItems.weakBloodOrb, "weakBloodOrb");
GameRegistry.registerItem(ModItems.apprenticeBloodOrb, "apprenticeBloodOrb");
GameRegistry.registerItem(ModItems.magicianBloodOrb, "magicianBloodOrb");
GameRegistry.registerItem(ModItems.energyBlaster, "energyBlaster");
GameRegistry.registerItem(ModItems.weakBloodOrb, "weakBloodOrb");
GameRegistry.registerItem(ModItems.apprenticeBloodOrb, "apprenticeBloodOrb");
GameRegistry.registerItem(ModItems.magicianBloodOrb, "magicianBloodOrb");
GameRegistry.registerItem(ModItems.energyBlaster, "energyBlaster");
GameRegistry.registerItem(ModItems.energySword, "energySword");
GameRegistry.registerItem(ModItems.energySword, "energySword");
GameRegistry.registerItem(ModItems.lavaCrystal, "lavaCrystal");
GameRegistry.registerItem(ModItems.waterSigil, "waterSigil");
GameRegistry.registerItem(ModItems.lavaSigil, "lavaSigil");

View file

@ -4,42 +4,42 @@ import net.minecraft.nbt.NBTTagCompound;
public class ColourAndCoords
{
public int colourRed;
public int colourGreen;
public int colourBlue;
public int colourIntensity;
public int colourRed;
public int colourGreen;
public int colourBlue;
public int colourIntensity;
public int xCoord;
public int yCoord;
public int zCoord;
public int xCoord;
public int yCoord;
public int zCoord;
public ColourAndCoords(int red, int green, int blue, int intensity, int x, int y, int z)
{
this.colourRed = red;
this.colourGreen = green;
this.colourBlue = blue;
this.colourIntensity = intensity;
public ColourAndCoords(int red, int green, int blue, int intensity, int x, int y, int z)
{
this.colourRed = red;
this.colourGreen = green;
this.colourBlue = blue;
this.colourIntensity = intensity;
this.xCoord = x;
this.yCoord = y;
this.zCoord = z;
}
this.xCoord = x;
this.yCoord = y;
this.zCoord = z;
}
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"));
}
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"));
}
public NBTTagCompound writeToNBT(NBTTagCompound tag)
{
tag.setInteger("colourRed", colourRed);
tag.setInteger("colourGreen", colourGreen);
tag.setInteger("colourBlue", colourBlue);
tag.setInteger("colourIntensity", colourIntensity);
tag.setInteger("xCoord", xCoord);
tag.setInteger("yCoord", yCoord);
tag.setInteger("zCoord", zCoord);
public NBTTagCompound writeToNBT(NBTTagCompound tag)
{
tag.setInteger("colourRed", colourRed);
tag.setInteger("colourGreen", colourGreen);
tag.setInteger("colourBlue", colourBlue);
tag.setInteger("colourIntensity", colourIntensity);
tag.setInteger("xCoord", xCoord);
tag.setInteger("yCoord", yCoord);
tag.setInteger("zCoord", zCoord);
return tag;
}
return tag;
}
}

View file

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

View file

@ -104,7 +104,7 @@ public class AlchemyRecipe
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;
checkList[j] = true;
@ -138,6 +138,6 @@ public class AlchemyRecipe
public int getOrbLevel()
{
return this.bloodOrbLevel;
return this.bloodOrbLevel;
}
}

View file

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

View file

@ -6,5 +6,5 @@ import net.minecraft.world.World;
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;
import net.minecraftforge.fluids.FluidTankInfo;
public interface IReagentContainer
{
public ReagentStack getReagent();
public ReagentStack getReagent();
public int getReagentStackAmount();

View file

@ -4,11 +4,11 @@ import java.util.Map;
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;
import net.minecraft.item.ItemStack;
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 colourGreen = 0;
private int colourBlue = 0;
private int colourIntensity = 255;
private int colourRed = 0;
private int colourGreen = 0;
private int colourBlue = 0;
private int colourIntensity = 255;
public Reagent(String name)
{
this.name = name;
}
public Reagent(String name)
{
this.name = name;
}
public void setColour(int red, int green, int blue, int intensity)
{
this.colourRed = red;
this.colourGreen = green;
this.colourBlue = blue;
this.colourIntensity = intensity;
}
public void setColour(int red, int green, int blue, int intensity)
{
this.colourRed = red;
this.colourGreen = green;
this.colourBlue = blue;
this.colourIntensity = intensity;
}
public int getColourRed()
{
return colourRed;
}
public int getColourRed()
{
return colourRed;
}
public int getColourGreen()
{
return colourGreen;
}
public int getColourGreen()
{
return colourGreen;
}
public int getColourBlue()
{
return colourBlue;
}
public int getColourBlue()
{
return colourBlue;
}
public int getColourIntensity()
{
return colourIntensity;
}
public int getColourIntensity()
{
return colourIntensity;
}
@Override
public boolean equals(Object o)
{
return o instanceof Reagent ? this == o && name.equals(((Reagent)o).name) : false;
}
@Override
public boolean equals(Object o)
{
return o instanceof Reagent ? this == o && name.equals(((Reagent) o).name) : false;
}
}

View file

@ -1,17 +1,13 @@
package WayofTime.alchemicalWizardry.api.alchemy.energy;
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
{
protected ReagentStack reagentStack;
protected int capacity;
protected ReagentStack reagentStack;
protected int capacity;
public ReagentContainer(int capacity)
public ReagentContainer(int capacity)
{
this(null, capacity);
}
@ -35,9 +31,9 @@ public class ReagentContainer implements IReagentContainer
if (reagent != null)
{
return new ReagentContainer(reagent, capacity);
}else
} else
{
return new ReagentContainer(null, capacity);
return new ReagentContainer(null, capacity);
}
}
@ -115,8 +111,7 @@ public class ReagentContainer implements IReagentContainer
{
reagentStack.amount += resource.amount;
filled = resource.amount;
}
else
} else
{
reagentStack.amount = capacity;
}
@ -150,9 +145,9 @@ public class ReagentContainer implements IReagentContainer
return stack;
}
@Override
public ReagentContainerInfo getInfo()
{
return new ReagentContainerInfo(this);
}
@Override
public ReagentContainerInfo getInfo()
{
return new ReagentContainerInfo(this);
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,32 +4,32 @@ import net.minecraft.item.ItemStack;
public class BindingRecipe
{
public ItemStack requiredItem;
public ItemStack outputItem;
public ItemStack requiredItem;
public ItemStack outputItem;
public BindingRecipe(ItemStack outputItem, ItemStack requiredItem)
{
this.requiredItem = requiredItem;
this.outputItem = outputItem;
}
public BindingRecipe(ItemStack outputItem, ItemStack requiredItem)
{
this.requiredItem = requiredItem;
this.outputItem = outputItem;
}
public boolean doesRequiredItemMatch(ItemStack testStack)
{
if(testStack == null || this.requiredItem == null)
{
return false;
}
public boolean doesRequiredItemMatch(ItemStack testStack)
{
if (testStack == null || this.requiredItem == null)
{
return false;
}
return this.requiredItem.isItemEqual(testStack);
}
return this.requiredItem.isItemEqual(testStack);
}
public ItemStack getResult(ItemStack inputItem)
{
return this.getResult();
}
public ItemStack getResult(ItemStack inputItem)
{
return this.getResult();
}
public ItemStack getResult()
{
return this.outputItem;
}
public ItemStack getResult()
{
return this.outputItem;
}
}

View file

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

View file

@ -1,33 +1,33 @@
package WayofTime.alchemicalWizardry.api.harvest;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.world.World;
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)
{
handlerList.add(handler);
}
public static void registerHarvestHandler(IHarvestHandler handler)
{
handlerList.add(handler);
}
public static boolean harvestBlock(World world, int xCoord, int yCoord, int zCoord)
{
Block block = world.getBlock(xCoord, yCoord, zCoord);
int meta = world.getBlockMetadata(xCoord, yCoord, zCoord);
public static boolean harvestBlock(World world, int xCoord, int yCoord, int zCoord)
{
Block block = world.getBlock(xCoord, yCoord, zCoord);
int meta = world.getBlockMetadata(xCoord, yCoord, zCoord);
for(IHarvestHandler handler : handlerList)
{
if(handler.harvestAndPlant(world, xCoord, yCoord, zCoord, block, meta))
{
return true;
}
}
for (IHarvestHandler handler : handlerList)
{
if (handler.harvestAndPlant(world, xCoord, yCoord, zCoord, block, meta))
{
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.world.World;
import net.minecraftforge.common.IPlantable;
public interface IHarvestHandler
{
/**
* A handler that is used to harvest and replant the block at the specified location
*
* @param world
* @param xCoord
* @param yCoord
* @param zCoord
* @param block block at this given location
* @param meta meta at this given location
* @return true if successfully harvested, false if not
*/
public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta);
/**
* A handler that is used to harvest and replant the block at the specified location
*
* @param world
* @param xCoord
* @param yCoord
* @param zCoord
* @param block block at this given location
* @param meta meta at this given location
* @return true if successfully harvested, false if not
*/
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;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import net.minecraft.block.Block;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
@ -14,214 +9,273 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
/** Shaped Blood Orb Recipe Handler by joshie **/
public class ShapedBloodOrbRecipe implements IRecipe {
private static final int MAX_CRAFT_GRID_WIDTH = 3;
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
private ItemStack output = null;
private Object[] input = null;
public int width = 0;
public int height = 0;
private boolean mirrored = true;
/**
* Shaped Blood Orb Recipe Handler by joshie *
*/
public class ShapedBloodOrbRecipe implements IRecipe
{
private static final int MAX_CRAFT_GRID_WIDTH = 3;
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
public ShapedBloodOrbRecipe(Block result, Object... recipe) {
this(new ItemStack(result), recipe);
}
private ItemStack output = null;
private Object[] input = null;
public int width = 0;
public int height = 0;
private boolean mirrored = true;
public ShapedBloodOrbRecipe(Item result, Object... recipe) {
this(new ItemStack(result), recipe);
}
public ShapedBloodOrbRecipe(Block result, Object... recipe)
{
this(new ItemStack(result), recipe);
}
public ShapedBloodOrbRecipe(ItemStack result, Object... recipe) {
output = result.copy();
public ShapedBloodOrbRecipe(Item result, Object... recipe)
{
this(new ItemStack(result), recipe);
}
String shape = "";
int idx = 0;
public ShapedBloodOrbRecipe(ItemStack result, Object... recipe)
{
output = result.copy();
if (recipe[idx] instanceof Boolean) {
mirrored = (Boolean) recipe[idx];
if (recipe[idx + 1] instanceof Object[]) {
recipe = (Object[]) recipe[idx + 1];
} else {
idx = 1;
}
}
String shape = "";
int idx = 0;
if (recipe[idx] instanceof String[]) {
String[] parts = ((String[]) recipe[idx++]);
if (recipe[idx] instanceof Boolean)
{
mirrored = (Boolean) recipe[idx];
if (recipe[idx + 1] instanceof Object[])
{
recipe = (Object[]) recipe[idx + 1];
} else
{
idx = 1;
}
}
for (String s : parts) {
width = s.length();
shape += s;
}
if (recipe[idx] instanceof String[])
{
String[] parts = ((String[]) recipe[idx++]);
height = parts.length;
} else {
while (recipe[idx] instanceof String) {
String s = (String) recipe[idx++];
shape += s;
width = s.length();
height++;
}
}
for (String s : parts)
{
width = s.length();
shape += s;
}
if (width * height != shape.length()) {
String ret = "Invalid shaped ore recipe: ";
for (Object tmp : recipe) {
ret += tmp + ", ";
}
ret += output;
throw new RuntimeException(ret);
}
height = parts.length;
} else
{
while (recipe[idx] instanceof String)
{
String s = (String) recipe[idx++];
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) {
Character chr = (Character) recipe[idx];
Object in = recipe[idx + 1];
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
if (in instanceof IBloodOrb || (in instanceof ItemStack && ((ItemStack)in).getItem() instanceof IBloodOrb)) { //If the item is an instanceof IBloodOrb then save the level of the orb
if(in instanceof ItemStack) 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);
}
}
for (; idx < recipe.length; idx += 2)
{
Character chr = (Character) recipe[idx];
Object in = recipe[idx + 1];
input = new Object[width * height];
int x = 0;
for (char chr : shape.toCharArray()) {
input[x++] = itemMap.get(chr);
}
}
if (in instanceof IBloodOrb || (in instanceof ItemStack && ((ItemStack) in).getItem() instanceof IBloodOrb))
{ //If the item is an instanceof IBloodOrb then save the level of the orb
if (in instanceof ItemStack)
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) {
output = recipe.getRecipeOutput();
width = recipe.recipeWidth;
height = recipe.recipeHeight;
input = new Object[width * height];
int x = 0;
for (char chr : shape.toCharArray())
{
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++) {
ItemStack ingred = recipe.recipeItems[i];
input = new Object[recipe.recipeItems.length];
if (ingred == null)
continue;
for (int i = 0; i < input.length; i++)
{
ItemStack ingred = recipe.recipeItems[i];
input[i] = recipe.recipeItems[i];
if (ingred == null)
continue;
for (Entry<ItemStack, String> replace : replacements.entrySet()) {
if (OreDictionary.itemMatches(replace.getKey(), ingred, true)) {
input[i] = OreDictionary.getOres(replace.getValue());
break;
}
}
}
}
input[i] = recipe.recipeItems[i];
@Override
public ItemStack getCraftingResult(InventoryCrafting var1) {
return output.copy();
}
for (Entry<ItemStack, String> replace : replacements.entrySet())
{
if (OreDictionary.itemMatches(replace.getKey(), ingred, true))
{
input[i] = OreDictionary.getOres(replace.getValue());
break;
}
}
}
}
@Override
public int getRecipeSize() {
return input.length;
}
@Override
public ItemStack getCraftingResult(InventoryCrafting var1)
{
return output.copy();
}
@Override
public ItemStack getRecipeOutput() {
return output;
}
@Override
public int getRecipeSize()
{
return input.length;
}
@Override
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;
}
@Override
public ItemStack getRecipeOutput()
{
return output;
}
if (mirrored && checkMatch(inv, x, y, true)) {
return true;
}
}
}
@Override
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")
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;
return false;
}
if (subX >= 0 && subY >= 0 && subX < width && subY < height) {
if (mirror) {
target = input[width - subX - 1 + subY * width];
} else {
target = input[subX + subY * width];
}
}
@SuppressWarnings("unchecked")
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;
ItemStack slot = inv.getStackInRowAndColumn(x, y);
//If target is integer, then we should be check the blood orb value of the item instead
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;
if (subX >= 0 && subY >= 0 && subX < width && subY < height)
{
if (mirror)
{
target = input[width - subX - 1 + subY * width];
} else
{
target = input[subX + subY * width];
}
}
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) target).iterator();
while (itr.hasNext() && !matched) {
matched = OreDictionary.itemMatches(itr.next(), slot, false);
}
ItemStack slot = inv.getStackInRowAndColumn(x, y);
//If target is integer, then we should be check the blood orb value of the item instead
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;
if (!matched) {
return false;
}
} else if (target == null && slot != null) {
return false;
}
}
}
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) target).iterator();
while (itr.hasNext() && !matched)
{
matched = OreDictionary.itemMatches(itr.next(), slot, false);
}
return true;
}
if (!matched)
{
return false;
}
} else if (target == null && slot != null)
{
return false;
}
}
}
public ShapedBloodOrbRecipe setMirrored(boolean mirror) {
mirrored = mirror;
return this;
}
return true;
}
public Object[] getInput() {
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;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import net.minecraft.block.Block;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
@ -14,127 +9,166 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
/** Shapeless Blood Orb Recipe Handler by joshie **/
public class ShapelessBloodOrbRecipe implements IRecipe {
private ItemStack output = null;
private ArrayList<Object> input = new ArrayList<Object>();
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
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) {
this(new ItemStack(result), recipe);
}
public ShapelessBloodOrbRecipe(Block result, Object... recipe)
{
this(new ItemStack(result), recipe);
}
public ShapelessBloodOrbRecipe(ItemStack result, Object... recipe) {
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);
}
}
}
public ShapelessBloodOrbRecipe(Item result, Object... recipe)
{
this(new ItemStack(result), recipe);
}
@SuppressWarnings("unchecked")
ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements) {
output = recipe.getRecipeOutput();
public ShapelessBloodOrbRecipe(ItemStack result, Object... recipe)
{
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)) {
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);
}
}
@SuppressWarnings("unchecked")
ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements)
{
output = recipe.getRecipeOutput();
@Override
public int getRecipeSize() {
return input.size();
}
for (ItemStack ingred : ((List<ItemStack>) recipe.recipeItems))
{
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
public ItemStack getRecipeOutput() {
return output;
}
@Override
public int getRecipeSize()
{
return input.size();
}
@Override
public ItemStack getCraftingResult(InventoryCrafting var1) {
return output.copy();
}
@Override
public ItemStack getRecipeOutput()
{
return output;
}
@SuppressWarnings("unchecked")
@Override
public boolean matches(InventoryCrafting var1, World world) {
ArrayList<Object> required = new ArrayList<Object>(input);
@Override
public ItemStack getCraftingResult(InventoryCrafting var1)
{
return output.copy();
}
for (int x = 0; x < var1.getSizeInventory(); x++) {
ItemStack slot = var1.getStackInSlot(x);
@SuppressWarnings("unchecked")
@Override
public boolean matches(InventoryCrafting var1, World world)
{
ArrayList<Object> required = new ArrayList<Object>(input);
if (slot != null) {
boolean inRecipe = false;
Iterator<Object> req = required.iterator();
for (int x = 0; x < var1.getSizeInventory(); x++)
{
ItemStack slot = var1.getStackInSlot(x);
while (req.hasNext()) {
boolean match = false;
if (slot != null)
{
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
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);
}
}
Object next = req.next();
if (match) {
inRecipe = true;
required.remove(next);
break;
}
}
//If target is integer, then we should be check the blood orb value of the item instead
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 (!inRecipe) {
return false;
}
}
}
if (match)
{
inRecipe = true;
required.remove(next);
break;
}
}
return required.isEmpty();
}
if (!inRecipe)
{
return false;
}
}
}
public ArrayList<Object> getInput() {
return this.input;
}
return required.isEmpty();
}
public ArrayList<Object> getInput()
{
return this.input;
}
}

View file

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

View file

@ -1,12 +1,12 @@
package WayofTime.alchemicalWizardry.api.rituals;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ISegmentedReagentHandler;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.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();

View file

@ -1,11 +1,11 @@
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.ReagentStack;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.List;
public abstract class RitualEffect
{
@ -13,7 +13,7 @@ public abstract class RitualEffect
public boolean startRitual(IMasterRitualStone ritualStone, EntityPlayer player)
{
return true;
return true;
}
public void onRitualBroken(IMasterRitualStone ritualStone)
@ -32,25 +32,25 @@ public abstract class RitualEffect
public boolean canDrainReagent(IMasterRitualStone ritualStone, Reagent reagent, int amount, boolean doDrain)
{
if(ritualStone == null || reagent == null || amount == 0)
{
return false;
}
if (ritualStone == null || reagent == null || amount == 0)
{
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(doDrain)
{
ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, true);
}
if (stack != null && stack.amount >= amount)
{
if (doDrain)
{
ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, true);
}
return true;
}
return true;
}
return false;
return false;
}
}

View file

@ -1,15 +1,15 @@
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.LinkedList;
import java.util.List;
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
{
private int crystalLevel;
@ -19,8 +19,8 @@ public class Rituals
private MRSRenderer customRenderer;
public static Map<String,Rituals> ritualMap = new HashMap();
public static List<String> keyList = new LinkedList();
public static Map<String, Rituals> ritualMap = new HashMap();
public static List<String> keyList = new LinkedList();
public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer)
{
@ -35,87 +35,86 @@ public class Rituals
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
* @param key Unique identification key - must be different from all others to properly register
* @param crystalLevel Crystal level required to activate
* @param actCost LP amount required to activate
* @param effect The effect that will be ticked
* @param name The name of the ritual
* @return Returns true if properly registered, or false if the key is already used
*
* @param key Unique identification key - must be different from all others to properly register
* @param crystalLevel Crystal level required to activate
* @param actCost LP amount required to activate
* @param effect The effect that will be ticked
* @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)
{
if(ritualMap.containsKey(key))
{
return false;
}
else
{
Rituals ritual = new Rituals(crystalLevel, actCost, effect, name, renderer);
ritual.removeRitualFromList();
ritualMap.put(key, ritual);
keyList.add(key);
return true;
}
if (ritualMap.containsKey(key))
{
return false;
} else
{
Rituals ritual = new Rituals(crystalLevel, actCost, effect, name, renderer);
ritual.removeRitualFromList();
ritualMap.put(key, ritual);
keyList.add(key);
return true;
}
}
public static boolean registerRitual(String key, int crystalLevel, int actCost, RitualEffect effect, String name)
{
if(ritualMap.containsKey(key))
{
return false;
}
else
{
Rituals ritual = new Rituals(crystalLevel, actCost, effect, name);
ritual.removeRitualFromList();
ritualMap.put(key, ritual);
keyList.add(key);
return true;
}
if (ritualMap.containsKey(key))
{
return false;
} else
{
Rituals ritual = new Rituals(crystalLevel, actCost, effect, name);
ritual.removeRitualFromList();
ritualMap.put(key, ritual);
keyList.add(key);
return true;
}
}
public void removeRitualFromList()
{
if(ritualMap.containsValue(this))
{
ritualMap.remove(ritualMap.remove(this.name));
}
if(keyList.contains(this.name))
{
keyList.remove(this.name);
}
if (ritualMap.containsValue(this))
{
ritualMap.remove(ritualMap.remove(this.name));
}
if (keyList.contains(this.name))
{
keyList.remove(this.name);
}
}
public static String checkValidRitual(World world, int x, int y, int z)
{
for(String key : ritualMap.keySet())
{
if(checkRitualIsValid(world,x,y,z,key))
{
return key;
}
}
for (String key : ritualMap.keySet())
{
if (checkRitualIsValid(world, x, y, z, key))
{
return key;
}
}
return "";
return "";
}
public static boolean canCrystalActivate(String ritualID, int crystalLevel)
{
if(ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if(ritual != null)
{
return ritual.getCrystalLevel() <= crystalLevel;
}
}
if (ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if (ritual != null)
{
return ritual.getCrystalLevel() <= crystalLevel;
}
}
return false;
return false;
}
public static boolean checkRitualIsValid(World world, int x, int y, int z, String ritualID)
@ -170,7 +169,7 @@ public class Rituals
case 2:
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))
{
@ -188,7 +187,7 @@ public class Rituals
case 3:
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))
{
@ -206,9 +205,9 @@ public class Rituals
case 4:
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;
}
@ -240,48 +239,48 @@ public class Rituals
public static int getCostForActivation(String ritualID)
{
if(ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if(ritual != null)
{
return ritual.actCost;
}
}
if (ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if (ritual != null)
{
return ritual.actCost;
}
}
return 0;
return 0;
}
public static int getInitialCooldown(String ritualID)
{
if(ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if(ritual != null && ritual.effect != null)
{
return ritual.effect.getInitialCooldown();
}
}
if (ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if (ritual != null && ritual.effect != null)
{
return ritual.effect.getInitialCooldown();
}
}
return 0;
return 0;
}
public static List<RitualComponent> getRitualList(String ritualID)
{
if(ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if(ritual != null)
{
return ritual.obtainComponents();
}else
{
return null;
}
}else
{
return null;
}
if (ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if (ritual != null)
{
return ritual.obtainComponents();
} else
{
return null;
}
} else
{
return null;
}
}
private List<RitualComponent> obtainComponents()
@ -296,50 +295,50 @@ public class Rituals
private MRSRenderer getRenderer()
{
return this.customRenderer;
return this.customRenderer;
}
public static void performEffect(IMasterRitualStone ritualStone, String ritualID)
{
if(ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if(ritual != null && ritual.effect != null)
{
ritual.effect.performEffect(ritualStone);
}
}
if (ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if (ritual != null && ritual.effect != null)
{
ritual.effect.performEffect(ritualStone);
}
}
}
public static boolean startRitual(IMasterRitualStone ritualStone, String ritualID, EntityPlayer player)
{
if(ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if(ritual != null && ritual.effect != null)
{
return ritual.effect.startRitual(ritualStone, player);
}
}
if (ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if (ritual != null && ritual.effect != null)
{
return ritual.effect.startRitual(ritualStone, player);
}
}
return false;
return false;
}
public static void onRitualBroken(IMasterRitualStone ritualStone, String ritualID)
{
if(ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if(ritual != null && ritual.effect != null)
{
ritual.effect.onRitualBroken(ritualStone);
}
}
if (ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if (ritual != null && ritual.effect != null)
{
ritual.effect.onRitualBroken(ritualStone);
}
}
}
public static int getNumberOfRituals()
{
return ritualMap.size();
return ritualMap.size();
}
public String getRitualName()
@ -349,54 +348,54 @@ public class Rituals
public static String getNameOfRitual(String id)
{
if(ritualMap.containsKey(id))
{
Rituals ritual = ritualMap.get(id);
if(ritual != null)
{
return ritual.getRitualName();
}
}
if (ritualMap.containsKey(id))
{
Rituals ritual = ritualMap.get(id);
if (ritual != null)
{
return ritual.getRitualName();
}
}
return "";
return "";
}
public static String getNextRitualKey(String key)
{
boolean hasSpotted = false;
String firstKey = "";
boolean hasSpotted = false;
String firstKey = "";
for(String str : keyList)
{
if(firstKey.equals(""))
{
firstKey = str;
}
if(hasSpotted)
{
return str;
}
if(str.equals(key))
{
hasSpotted = true;
}
}
for (String str : keyList)
{
if (firstKey.equals(""))
{
firstKey = str;
}
if (hasSpotted)
{
return str;
}
if (str.equals(key))
{
hasSpotted = true;
}
}
return firstKey;
return firstKey;
}
public static String getPreviousRitualKey(String key)
{
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;
}
if(hasSpotted)
if (hasSpotted)
{
return lastKey;
}
@ -408,15 +407,15 @@ public class Rituals
public static MRSRenderer getRendererForKey(String ritualID)
{
if(ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if(ritual != null)
{
return ritual.getRenderer();
}
}
if (ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if (ritual != null)
{
return ritual.getRenderer();
}
}
return null;
return null;
}
}

View file

@ -1,7 +1,6 @@
package WayofTime.alchemicalWizardry.api.soulNetwork;
import java.util.UUID;
import com.mojang.authlib.GameProfile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -11,38 +10,36 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import java.util.UUID;
public class SoulNetworkHandler
{
public static UUID getUUIDFromPlayer(EntityPlayer player)
{
return player.getPersistentID();
}
public static UUID getUUIDFromPlayer(EntityPlayer player)
{
return player.getPersistentID();
}
public static EntityPlayer getPlayerFromUUID(UUID uuid)
{
MinecraftServer server = MinecraftServer.getServer();
GameProfile gameProfile;
gameProfile = server.func_152358_ax().func_152652_a(uuid);
// LogHelper.info("player is " + gameProfile.getName() + " : " + gameProfile.getId());
public static EntityPlayer getPlayerFromUUID(UUID uuid)
{
MinecraftServer server = MinecraftServer.getServer();
GameProfile gameProfile;
gameProfile = server.func_152358_ax().func_152652_a(uuid);
return null;
}
return null;
}
public static int syphonFromNetwork(ItemStack ist, int damageToBeDone)
{
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
public static int syphonFromNetwork(ItemStack ist, int damageToBeDone)
{
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
{
String ownerName = ist.getTagCompound().getString("ownerName");
return syphonFromNetwork(ownerName, damageToBeDone);
}
return 0;
}
return 0;
}
public static int syphonFromNetwork(String ownerName, int damageToBeDone)
{
public static int syphonFromNetwork(String ownerName, int damageToBeDone)
{
if (MinecraftServer.getServer() == null)
{
return 0;
@ -65,32 +62,32 @@ public class SoulNetworkHandler
}
return 0;
}
}
/**
* Master method used to syphon from the player's network, and will damage them accordingly if they do not have enough LP.
* Does not drain on the client side.
*
* @param ist Owned itemStack
* @param player Player using the item
* @param damageToBeDone
* @return True if server-sided, false if client-sided
*/
public static boolean syphonAndDamageFromNetwork(ItemStack ist, EntityPlayer player, int damageToBeDone)
/**
* Master method used to syphon from the player's network, and will damage them accordingly if they do not have enough LP.
* Does not drain on the client side.
*
* @param ist Owned itemStack
* @param player Player using the item
* @param damageToBeDone
* @return True if server-sided, false if client-sided
*/
public static boolean syphonAndDamageFromNetwork(ItemStack ist, EntityPlayer player, int damageToBeDone)
{
if(player.worldObj.isRemote)
{
return false;
}
if (player.worldObj.isRemote)
{
return false;
}
int amount = SoulNetworkHandler.syphonFromNetwork(ist, damageToBeDone);
int amount = SoulNetworkHandler.syphonFromNetwork(ist, damageToBeDone);
hurtPlayer(player, damageToBeDone-amount);
hurtPlayer(player, damageToBeDone - amount);
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("")))
{
@ -102,7 +99,7 @@ public class SoulNetworkHandler
return false;
}
public static boolean canSyphonFromOnlyNetwork(String ownerName, int damageToBeDone)
public static boolean canSyphonFromOnlyNetwork(String ownerName, int damageToBeDone)
{
if (MinecraftServer.getServer() == null)
{
@ -121,9 +118,9 @@ public class SoulNetworkHandler
return data.currentEssence >= damageToBeDone;
}
public static int getCurrentEssence(String ownerName)
{
if (MinecraftServer.getServer() == null)
public static int getCurrentEssence(String ownerName)
{
if (MinecraftServer.getServer() == null)
{
return 0;
}
@ -138,11 +135,11 @@ public class SoulNetworkHandler
}
return data.currentEssence;
}
}
public static void setCurrentEssence(String ownerName, int essence)
{
if (MinecraftServer.getServer() == null)
public static void setCurrentEssence(String ownerName, int essence)
{
if (MinecraftServer.getServer() == null)
{
return;
}
@ -158,19 +155,19 @@ public class SoulNetworkHandler
data.currentEssence = essence;
data.markDirty();
}
}
/**
* A method to add to an owner's network up to a maximum value.
*
* @param ownerName
* @param addedEssence
* @param maximum
* @return amount added to the network
*/
public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence, int maximum)
{
if (MinecraftServer.getServer() == null)
/**
* A method to add to an owner's network up to a maximum value.
*
* @param ownerName
* @param addedEssence
* @param maximum
* @return amount added to the network
*/
public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence, int maximum)
{
if (MinecraftServer.getServer() == null)
{
return 0;
}
@ -186,18 +183,18 @@ public class SoulNetworkHandler
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;
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)
{
@ -228,7 +225,7 @@ public class SoulNetworkHandler
}
}
public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player)
public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player)
{
if (item.stackTagCompound == null)
{
@ -255,22 +252,22 @@ public class SoulNetworkHandler
}
public static String getUsername(EntityPlayer player)
{
return player.getDisplayName();
}
{
return player.getDisplayName();
}
public static EntityPlayer getPlayerForUsername(String str)
{
if(MinecraftServer.getServer() == null)
{
return null;
}
return MinecraftServer.getServer().getConfigurationManager().func_152612_a(str);
}
{
if (MinecraftServer.getServer() == null)
{
return null;
}
return MinecraftServer.getServer().getConfigurationManager().func_152612_a(str);
}
public static void causeNauseaToPlayer(ItemStack stack)
{
if (stack.getTagCompound() != null && !(stack.getTagCompound().getString("ownerName").equals("")))
if (stack.getTagCompound() != null && !(stack.getTagCompound().getString("ownerName").equals("")))
{
String ownerName = stack.getTagCompound().getString("ownerName");
@ -280,7 +277,7 @@ public class SoulNetworkHandler
public static void causeNauseaToPlayer(String ownerName)
{
EntityPlayer entityOwner = SoulNetworkHandler.getPlayerForUsername(ownerName);
EntityPlayer entityOwner = SoulNetworkHandler.getPlayerForUsername(ownerName);
if (entityOwner == null)
{

View file

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

View file

@ -1,11 +1,5 @@
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.client.renderer.RenderHelper;
import cpw.mods.fml.client.FMLClientHandler;
@ -13,23 +7,28 @@ import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
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
{
private Minecraft mcClient = FMLClientHandler.instance().getClient();
private Minecraft mcClient = FMLClientHandler.instance().getClient();
@SubscribeEvent
public void onPlayerSoundEvent(SoundEvent event)
{
if(Minecraft.getMinecraft() != null)
{
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (Minecraft.getMinecraft() != null)
{
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if(player != null && player.isPotionActive(AlchemicalWizardry.customPotionDeaf))
{
event.setResult(Result.DENY);
}
}
if (player != null && player.isPotionActive(AlchemicalWizardry.customPotionDeaf))
{
event.setResult(Result.DENY);
}
}
}
@SubscribeEvent
@ -47,12 +46,12 @@ public class ClientEventHandler
@SubscribeEvent
public void onRenderLivingPlayerPre(RenderPlayerEvent.Pre event)
{
GL11.glDisable(2929);
GL11.glDisable(2929);
}
@SubscribeEvent
public void onRenderLivingPlayerPost(RenderPlayerEvent.Post event)
{
GL11.glEnable(2929);
GL11.glEnable(2929);
}
}

View file

@ -1,89 +1,29 @@
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.common.CommonProxy;
import WayofTime.alchemicalWizardry.common.EntityAirElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityBileDemon;
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.mob.*;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaMainProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityMeteor;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityParticleBeam;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderAlchemicCalcinator;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderConduit;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderCrystalBelljar;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderMasterStone;
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.block.*;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.*;
import WayofTime.alchemicalWizardry.common.renderer.mob.*;
import WayofTime.alchemicalWizardry.common.renderer.model.*;
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBazookaMainProjectile;
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBlastProjectile;
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderMeteor;
import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
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 WayofTime.alchemicalWizardry.common.tileEntity.*;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
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
{
@ -93,39 +33,24 @@ public class ClientProxy extends CommonProxy
@Override
public void registerRenderers()
{
//altarRenderType = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerEntityRenderingHandler(EnergyBlastProjectile.class, new RenderEnergyBlastProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntityEnergyBazookaMainProjectile.class, new RenderEnergyBazookaMainProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntitySpellProjectile.class, new RenderEnergyBlastProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntityParticleBeam.class, new RenderEnergyBlastProjectile());
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));
//EntityRegistry.registerGlobalEntityID(EntityLowerGuardian.class, "AlchemicalWizardry.LowerGuardian", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
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));
//EntityRegistry.registerGlobalEntityID(EntityWingedFireDemon.class, "AlchemicalWizardry.WingedFireDemon", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
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));
//EntityRegistry.registerGlobalEntityID(EntityIceDemon.class, "AlchemicalWizardry.IceDemon", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
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));
//EntityRegistry.registerGlobalEntityID(EntityShade.class, "AlchemicalWizardry.Shade", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
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));
//EntityRegistry.registerGlobalEntityID(EntityWaterElemental.class, "AlchemicalWizardry.WaterElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
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));
//EntityRegistry.registerGlobalEntityID(EntityFireElemental.class, "AlchemicalWizardry.FireElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
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));
//EntityRegistry.registerGlobalEntityID(EntityHolyElemental.class, "AlchemicalWizardry.HolyElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityHolyElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
ClientRegistry.bindTileEntitySpecialRenderer(TEAltar.class, new TEAltarRenderer());
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.blockAlchemicCalcinator), new TEAlchemicalCalcinatorItemRenderer());
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockCrystalBelljar), new TEBellJarItemRenderer());
//RenderingRegistry.registerEntityRenderingHandler(FireProjectile.class, new RenderFireProjectile());
//RenderingRegistry.registerBlockHandler(new AltarRenderer());
ShaderHelper.initShaders();
ShaderHelper.initShaders();
}
@Override
@ -165,14 +86,12 @@ public class ClientProxy extends CommonProxy
@Override
public void InitRendering()
{
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockAltar), new TEAltarItemRenderer());
//MinecraftForgeClient.registerItemRenderer(AlchemicalWizardry.blockWritingTable.blockID, new TEWritingTableItemRenderer());
}
@Override
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;
import java.util.List;
/**
* 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
*/
public class ColourThreshold implements Comparable<ColourThreshold>
{
public int threshold;
public int threshold;
public String colorCode;
public ColourThreshold(int t, String c)

View file

@ -1,28 +1,26 @@
package WayofTime.alchemicalWizardry.client.renderer;
import WayofTime.alchemicalWizardry.BloodMagicConfiguration;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.BloodMagicConfiguration;
public class HUDElement
{
public final ItemStack itemStack;
public final int iconW;
public final int iconH;
public final int padW;
public final int iconW;
public final int iconH;
public final int padW;
public final int value;
private int elementW;
private int elementH;
private String itemName = "";
private int itemNameW;
private String itemDamage = "";
private int itemDamageW;
private Minecraft mc = Minecraft.getMinecraft();
private int elementW;
private int elementH;
private String itemName = "";
private int itemNameW;
private String itemDamage = "";
private int itemDamageW;
private Minecraft mc = Minecraft.getMinecraft();
private static final int offset = 5;
@ -31,7 +29,7 @@ public class HUDElement
public boolean showDamageOverlay = 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)
{
@ -76,12 +74,11 @@ public class HUDElement
boolean showMaxDamage = 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;
}
else if (showValue)
} else if (showValue)
itemDamage = "\247" + ColourThreshold.getColorCode(BloodMagicConfiguration.colorList,
(thresholdPercent ? damage * 100 / maxDamage : damage)) + damage +
(showMaxDamage ? "/" + maxDamage : "");
@ -115,7 +112,7 @@ public class HUDElement
//if (ArmorStatusHUD.alignMode.toLowerCase().contains("right"))
boolean toRight = true;
if(toRight)
if (toRight)
{
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x - (iconW + padW), y);
HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x - (iconW + padW), y, showDamageOverlay, showItemCount);
@ -127,8 +124,7 @@ public class HUDElement
mc.fontRenderer.drawStringWithShadow(itemName + "\247r", x - (padW + iconW + padW) - itemNameW, y, 0xffffff);
mc.fontRenderer.drawStringWithShadow(itemDamage + "\247r", x - (padW + iconW + padW) - itemDamageW,
y + (enableItemName ? elementH / 2 : elementH / 4), 0xffffff);
}
else
} else
{
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x, y);
HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x, y, showDamageOverlay, showItemCount);

View file

@ -9,7 +9,6 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
/**
@ -18,8 +17,8 @@ import org.lwjgl.opengl.GL11;
*/
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,
0, 42, 10752, 10794, 2752512, 2752554, 2763264, 2763306, 1381653, 1381695, 1392405, 1392447, 4134165, 4134207, 4144917, 4144959 };
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};
public static int getColorCode(char c, boolean isLighter)
{
@ -31,19 +30,19 @@ public final class HUDUtils
* and filler. It is assumed that the desired texture ResourceLocation object has been bound using
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
*
* @param x x axis offset
* @param y y axis offset
* @param u bound resource location image x offset
* @param v bound resource location image y offset
* @param width the desired box width
* @param height the desired box height
* @param textureWidth the width of the box texture in the resource location image
* @param x x axis offset
* @param y y axis offset
* @param u bound resource location image x offset
* @param v bound resource location image y offset
* @param width the desired box width
* @param height the desired box height
* @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 borderSize the size of the box's borders
* @param zLevel the zLevel to draw at
* @param borderSize the size of the box's borders
* @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,
int borderSize, float zLevel)
int borderSize, float zLevel)
{
drawContinuousTexturedBox(x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel);
}
@ -53,20 +52,20 @@ public final class HUDUtils
* and filler. The provided ResourceLocation object will be bound using
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
*
* @param res the ResourceLocation object that contains the desired image
* @param x x axis offset
* @param y y axis offset
* @param u bound resource location image x offset
* @param v bound resource location image y offset
* @param width the desired box width
* @param height the desired box height
* @param textureWidth the width of the box texture in the resource location image
* @param res the ResourceLocation object that contains the desired image
* @param x x axis offset
* @param y y axis offset
* @param u bound resource location image x offset
* @param v bound resource location image y offset
* @param width the desired box width
* @param height the desired box height
* @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 borderSize the size of the box's borders
* @param zLevel the zLevel to draw at
* @param borderSize the size of the box's borders
* @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,
int borderSize, float zLevel)
int borderSize, float zLevel)
{
drawContinuousTexturedBox(res, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel);
}
@ -76,23 +75,23 @@ public final class HUDUtils
* and filler. The provided ResourceLocation object will be bound using
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
*
* @param res the ResourceLocation object that contains the desired image
* @param x x axis offset
* @param y y axis offset
* @param u bound resource location image x offset
* @param v bound resource location image y offset
* @param width the desired box width
* @param height the desired box height
* @param textureWidth the width of the box texture in the resource location image
* @param res the ResourceLocation object that contains the desired image
* @param x x axis offset
* @param y y axis offset
* @param u bound resource location image x offset
* @param v bound resource location image y offset
* @param width the desired box width
* @param height the desired box height
* @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 topBorder the size of the box's top border
* @param bottomBorder the size of the box's bottom border
* @param leftBorder the size of the box's left border
* @param rightBorder the size of the box's right border
* @param zLevel the zLevel to draw at
* @param topBorder the size of the box's top border
* @param bottomBorder the size of the box's bottom border
* @param leftBorder the size of the box's left border
* @param rightBorder the size of the box's right border
* @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,
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);
drawContinuousTexturedBox(x, y, u, v, width, height, textureWidth, textureHeight, topBorder, bottomBorder, leftBorder, rightBorder, zLevel);
@ -103,22 +102,22 @@ public final class HUDUtils
* and filler. It is assumed that the desired texture ResourceLocation object has been bound using
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
*
* @param x x axis offset
* @param y y axis offset
* @param u bound resource location image x offset
* @param v bound resource location image y offset
* @param width the desired box width
* @param height the desired box height
* @param textureWidth the width of the box texture in the resource location image
* @param x x axis offset
* @param y y axis offset
* @param u bound resource location image x offset
* @param v bound resource location image y offset
* @param width the desired box width
* @param height the desired box height
* @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 topBorder the size of the box's top border
* @param bottomBorder the size of the box's bottom border
* @param leftBorder the size of the box's left border
* @param rightBorder the size of the box's right border
* @param zLevel the zLevel to draw at
* @param topBorder the size of the box's top border
* @param bottomBorder the size of the box's bottom border
* @param leftBorder the size of the box's left border
* @param rightBorder the size of the box's right border
* @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,
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.glEnable(GL11.GL_BLEND);

View file

@ -1,83 +1,79 @@
package WayofTime.alchemicalWizardry.client.renderer;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
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.gui.GuiChat;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles;
import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import java.util.ArrayList;
import java.util.List;
public class RenderHelper
{
public static boolean showEquippedItem = true;
public static boolean enableItemName = false;
public static boolean enabled = true;
public static boolean showInChat = true;
public static boolean showEquippedItem = true;
public static boolean enableItemName = false;
public static boolean enabled = true;
public static boolean showInChat = true;
private static int xOffsetDefault = +50;
public static int xOffset = xOffsetDefault;
private static int yOffsetDefault = 2;
public static int yOffset = yOffsetDefault;
private static int yOffsetBottomCenterDefault = 41;
public static int yOffsetBottomCenter = yOffsetBottomCenterDefault;
private static boolean applyXOffsetToCenterDefault = true;
public static boolean applyXOffsetToCenter = applyXOffsetToCenterDefault;
private static boolean applyYOffsetToMiddleDefault = false;
public static boolean applyYOffsetToMiddle = applyYOffsetToMiddleDefault;
private static int xOffsetDefault = +50;
public static int xOffset = xOffsetDefault;
private static int yOffsetDefault = 2;
public static int yOffset = yOffsetDefault;
private static int yOffsetBottomCenterDefault = 41;
public static int yOffsetBottomCenter = yOffsetBottomCenterDefault;
private static boolean applyXOffsetToCenterDefault = true;
public static boolean applyXOffsetToCenter = applyXOffsetToCenterDefault;
private static boolean applyYOffsetToMiddleDefault = false;
public static boolean applyYOffsetToMiddle = applyYOffsetToMiddleDefault;
public static String listMode = "horizontal";
public static String alignMode = "bottomcenter";
public static String listMode = "horizontal";
public static String alignMode = "bottomcenter";
private static ScaledResolution scaledResolution;
private static ScaledResolution scaledResolution;
public static boolean onTickInGame(Minecraft mc)
{
if (enabled && (mc.inGameHasFocus || mc.currentScreen == null || (mc.currentScreen instanceof GuiChat && showInChat))
&& !mc.gameSettings.showDebugInfo)
{
EntityPlayer player = mc.thePlayer;
World world = mc.theWorld;
if(SpellHelper.canPlayerSeeAlchemy(player))
{
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
EntityPlayer player = mc.thePlayer;
World world = mc.theWorld;
if (SpellHelper.canPlayerSeeAlchemy(player))
{
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
scaledResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
displayArmorStatus(mc);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
}
}
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;
World world = mc.theWorld;
MovingObjectPosition movingobjectposition = mc.objectMouseOver;
World world = mc.theWorld;
if (movingobjectposition == null)
{
return elements;
return elements;
} else
{
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
int x = movingobjectposition.blockX;
int y = movingobjectposition.blockY;
@ -85,29 +81,29 @@ public class RenderHelper
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));
if(infos != null)
if (infos != null)
{
for(ReagentContainerInfo info : infos)
{
if(info == null || info.reagent == null || info.reagent.reagent == null)
{
continue;
}
for (ReagentContainerInfo info : infos)
{
if (info == null || info.reagent == null || info.reagent.reagent == null)
{
continue;
}
ItemStack itemStack = ReagentRegistry.getItemForReagent(info.reagent.reagent);
ItemStack itemStack = ReagentRegistry.getItemForReagent(info.reagent.reagent);
if (itemStack != null)
elements.add(new HUDElement(itemStack, 16, 16, 2, info.reagent.amount));
}
}
}
}
}
@ -115,7 +111,7 @@ public class RenderHelper
return elements;
}
private static int getX(int width)
private static int getX(int width)
{
if (alignMode.toLowerCase().contains("center"))
return scaledResolution.getScaledWidth() / 2 - width / 2 + (applyXOffsetToCenter ? xOffset : 0);
@ -137,7 +133,7 @@ public class RenderHelper
return yOffset;
}
private static int getElementsWidth(List<HUDElement> elements)
private static int getElementsWidth(List<HUDElement> elements)
{
int r = 0;
for (HUDElement he : elements)
@ -163,8 +159,7 @@ public class RenderHelper
e.renderToHud((alignMode.toLowerCase().contains("right") ? getX(0) : getX(e.width())), yBase);
yBase += yOffset;
}
}
else if (listMode.equalsIgnoreCase("horizontal"))
} else if (listMode.equalsIgnoreCase("horizontal"))
{
int totalWidth = getElementsWidth(elements);
int yBase = getY(1, yOffset);
@ -176,9 +171,9 @@ public class RenderHelper
e.renderToHud(xBase + prevX + (alignMode.toLowerCase().contains("right") ? e.width() : 0), yBase);
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;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
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;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
@ -26,19 +28,13 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
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;
import java.util.*;
public class AlchemicalWizardryEventHooks
{
public static Map<String,Boolean> playerFlightBuff = new HashMap();
public static Map<String,Boolean> playerBoostStepHeight = new HashMap();
public static Map<String, Boolean> playerFlightBuff = new HashMap();
public static Map<String, Boolean> playerBoostStepHeight = new HashMap();
public static List<String> playersWith1Step = new ArrayList();
public static Map<Integer, List<CoordAndRange>> respawnMap = new HashMap();
@ -47,115 +43,115 @@ public class AlchemicalWizardryEventHooks
@SubscribeEvent
public void onPlayerDamageEvent(LivingAttackEvent event)
{
if(event.source.isProjectile())
{
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionProjProt) && event.isCancelable())
{
event.setCanceled(true);
}
}
if (event.source.isProjectile())
{
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionProjProt) && event.isCancelable())
{
event.setCanceled(true);
}
}
}
@SubscribeEvent
public void onLivingSpawnEvent(CheckSpawn event)
{
if(!(event.entityLiving instanceof EntityMob))
{
return;
}
if (!(event.entityLiving instanceof EntityMob))
{
return;
}
String respawnRitual = "AW028SpawnWard";
String respawnRitual = "AW028SpawnWard";
Integer dimension = new Integer(event.world.provider.dimensionId);
if(respawnMap.containsKey(dimension))
{
List<CoordAndRange> list = respawnMap.get(dimension);
Integer dimension = new Integer(event.world.provider.dimensionId);
if (respawnMap.containsKey(dimension))
{
List<CoordAndRange> list = respawnMap.get(dimension);
if(list != null)
{
for(CoordAndRange coords : list)
{
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
if (list != null)
{
for (CoordAndRange coords : list)
{
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
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)
{
switch(event.getResult())
{
case ALLOW:
event.setResult(Result.DEFAULT);
break;
case DEFAULT:
event.setResult(Result.DENY);
break;
case DENY:
break;
default:
break;
}
break;
}
}else
{
list.remove(coords);
}
}
}
}
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)
{
switch (event.getResult())
{
case ALLOW:
event.setResult(Result.DEFAULT);
break;
case DEFAULT:
event.setResult(Result.DENY);
break;
case DENY:
break;
default:
break;
}
break;
}
} else
{
list.remove(coords);
}
}
}
}
if(event.entityLiving instanceof EntityCreeper)
{
return;
}
if (event.entityLiving instanceof EntityCreeper)
{
return;
}
String forceSpawnRitual = "AW029VeilOfEvil";
String forceSpawnRitual = "AW029VeilOfEvil";
if(forceSpawnMap.containsKey(dimension))
{
List<CoordAndRange> list = forceSpawnMap.get(dimension);
if (forceSpawnMap.containsKey(dimension))
{
List<CoordAndRange> list = forceSpawnMap.get(dimension);
if(list != null)
{
for(CoordAndRange coords : list)
{
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
if (list != null)
{
for (CoordAndRange coords : list)
{
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
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)
{
switch(event.getResult())
{
case ALLOW:
break;
case DEFAULT:
event.setResult(Result.ALLOW);
break;
case DENY:
event.setResult(Result.DEFAULT);
break;
default:
break;
}
break;
}
}else
{
list.remove(coords);
}
}
}
}
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)
{
switch (event.getResult())
{
case ALLOW:
break;
case DEFAULT:
event.setResult(Result.ALLOW);
break;
case DENY:
event.setResult(Result.DEFAULT);
break;
default:
break;
}
break;
}
} else
{
list.remove(coords);
}
}
}
}
}
@SubscribeEvent
public void onPlayerRespawnEvent(PlayerRespawnEvent event)
{
if(AlchemicalWizardry.respawnWithDebuff)
{
event.player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionSoulFray.id, 20*60*5,0));
}
if (AlchemicalWizardry.respawnWithDebuff)
{
event.player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionSoulFray.id, 20 * 60 * 5, 0));
}
}
@SubscribeEvent
@ -167,19 +163,19 @@ public class AlchemicalWizardryEventHooks
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
public void onEndermanTeleportEvent(EnderTeleportEvent event)
{
if(event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding) && event.isCancelable())
{
event.setCanceled(true);
}
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding) && event.isCancelable())
{
event.setCanceled(true);
}
}
@SubscribeEvent
@ -199,17 +195,17 @@ public class AlchemicalWizardryEventHooks
}
}
if(entityAttacked.isPotionActive(AlchemicalWizardry.customPotionFlameCloak))
if (entityAttacked.isPotionActive(AlchemicalWizardry.customPotionFlameCloak))
{
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))
{
entityAttacking.attackEntityFrom(DamageSource.inFire, 2*i+2);
entityAttacking.setFire(3);
}
if (entityAttacking != null && entityAttacking instanceof EntityLivingBase && !entityAttacking.isImmuneToFire() && !((EntityLivingBase) entityAttacking).isPotionActive(Potion.fireResistance))
{
entityAttacking.attackEntityFrom(DamageSource.inFire, 2 * i + 2);
entityAttacking.setFire(3);
}
}
}
@ -237,13 +233,13 @@ public class AlchemicalWizardryEventHooks
double z = entityLiving.posZ;
Vec3 blockVector = SpellHelper.getEntityBlockVector(entityLiving);
int xPos = (int)(blockVector.xCoord);
int yPos = (int)(blockVector.yCoord);
int zPos = (int)(blockVector.zCoord);
int xPos = (int) (blockVector.xCoord);
int yPos = (int) (blockVector.yCoord);
int zPos = (int) (blockVector.zCoord);
if(entityLiving instanceof EntityPlayer)
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)
@ -266,7 +262,7 @@ public class AlchemicalWizardryEventHooks
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionFeatherFall))
{
event.entityLiving.fallDistance = 0;
event.entityLiving.fallDistance = 0;
}
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionDrowning))
@ -293,8 +289,8 @@ public class AlchemicalWizardryEventHooks
EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving;
entityPlayer.stepHeight = 1.0f;
if((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F)
entityPlayer.moveFlying(0F, 1F, entityPlayer.capabilities.isFlying ? (percentIncrease/2.0f) : percentIncrease);
if ((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F)
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 posY = (int) Math.round(entity.posY);
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);
List list = event.entityLiving.worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb);
Iterator iterator = list.iterator();
@ -334,23 +330,23 @@ public class AlchemicalWizardryEventHooks
} else if (projectile instanceof EnergyBlastProjectile)
{
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 delY = projectile.posY - entity.posY;
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());
delZ = -projectile.posZ + throwingEntity.posZ;
}
@ -376,7 +372,6 @@ public class AlchemicalWizardryEventHooks
String ownerName = SpellHelper.getUsername(entityPlayer);
playerFlightBuff.put(ownerName, true);
entityPlayer.capabilities.allowFlying = true;
//entityPlayer.sendPlayerAbilities();
}
} else
{
@ -404,74 +399,74 @@ 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();
double range = i*0.5;
double range = i * 0.5;
List<Entity> entities = SpellHelper.getEntitiesInRange(entityLiving.worldObj, x, y, z, range, range);
if(entities!=null)
{
for(Entity entity : entities)
{
if(!entity.equals(entityLiving)&&!entity.isImmuneToFire()&&!(entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.fireResistance)))
{
entity.setFire(3);
}
}
}
List<Entity> entities = SpellHelper.getEntitiesInRange(entityLiving.worldObj, x, y, z, range, range);
if (entities != null)
{
for (Entity entity : entities)
{
if (!entity.equals(entityLiving) && !entity.isImmuneToFire() && !(entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isPotionActive(Potion.fireResistance)))
{
entity.setFire(3);
}
}
}
}
if(entityLiving.isPotionActive(AlchemicalWizardry.customPotionIceCloak))
if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionIceCloak))
{
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);
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);
int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionIceCloak).getAmplifier();
int horizRange = r+1;
int vertRange = 1;
int horizRange = r + 1;
int vertRange = 1;
if(!entityLiving.worldObj.isRemote)
{
for(int i=-horizRange; i<=horizRange;i++)
{
for(int k=-horizRange; k<=horizRange;k++)
{
for(int j=-vertRange-1; j<=vertRange-1; j++)
{
SpellHelper.freezeWaterBlock(entityLiving.worldObj, xPos+i, yPos+j, zPos+k);
}
}
}
}
if (!entityLiving.worldObj.isRemote)
{
for (int i = -horizRange; i <= horizRange; i++)
{
for (int k = -horizRange; k <= horizRange; k++)
{
for (int j = -vertRange - 1; j <= vertRange - 1; j++)
{
SpellHelper.freezeWaterBlock(entityLiving.worldObj, xPos + i, yPos + j, zPos + k);
}
}
}
}
}
if(entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart))
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);
double decrease = 0.025 * (i + 1);
if(entityLiving.motionY>-0.9)
{
entityLiving.motionY-=decrease;
}
if (entityLiving.motionY > -0.9)
{
entityLiving.motionY -= decrease;
}
}
if(entityLiving.isPotionActive(AlchemicalWizardry.customPotionFireFuse))
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);
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 radius = r+1;
int radius = r + 1;
if(entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getDuration()<=2)
{
entityLiving.worldObj.createExplosion(null, x, y, z, radius, false);
}
if (entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getDuration() <= 2)
{
entityLiving.worldObj.createExplosion(null, x, y, z, radius, false);
}
}
}
}

View file

@ -1,5 +1,9 @@
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.item.Item;
import net.minecraft.item.ItemStack;
@ -7,10 +11,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
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
{
@ -18,19 +18,15 @@ public class AlchemicalWizardryFuelHandler implements IFuelHandler
public int getBurnTime(ItemStack fuel)
{
ItemStack itemStack = fuel;
if(itemStack == null)
if (itemStack == null)
{
return 0;
return 0;
}
Item fuelItem = itemStack.getItem();
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();
if (item.hasEnoughEssence(fuel))

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;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
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.entity.projectile.*;
import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.world.World;
public class CommonProxy
{
@ -49,7 +35,6 @@ public class CommonProxy
public void registerEvents()
{
}
public void registerSoundHandler()

View file

@ -2,24 +2,24 @@ package WayofTime.alchemicalWizardry.common;
public class CoordAndRange
{
public int xCoord;
public int yCoord;
public int zCoord;
public int horizRadius;
public int vertRadius;
public int xCoord;
public int yCoord;
public int zCoord;
public int horizRadius;
public int vertRadius;
public CoordAndRange(int x, int y, int z, int horiz, int vert)
{
this.xCoord = x;
this.yCoord = y;
this.zCoord = z;
this.horizRadius = horiz;
this.vertRadius = vert;
}
public CoordAndRange(int x, int y, int z, int horiz, int vert)
{
this.xCoord = x;
this.yCoord = y;
this.zCoord = z;
this.horizRadius = horiz;
this.vertRadius = vert;
}
@Override
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;
}
@Override
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;
}
}

View file

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

View file

@ -1,15 +1,14 @@
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.EntityLivingBase;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
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
{
@ -22,7 +21,7 @@ public class EntityAirElemental extends EntityElemental implements IMob
{
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));
} else if (target instanceof EntityLivingBase)
{

View file

@ -5,34 +5,34 @@ import net.minecraft.nbt.NBTTagCompound;
public class Int3
{
public int xCoord;
public int yCoord;
public int zCoord;
public int xCoord;
public int yCoord;
public int zCoord;
public Int3(int xCoord, int yCoord, int zCoord)
{
this.xCoord = xCoord;
this.yCoord = yCoord;
this.zCoord = zCoord;
}
public Int3(int xCoord, int yCoord, int zCoord)
{
this.xCoord = xCoord;
this.yCoord = yCoord;
this.zCoord = zCoord;
}
public static Int3 readFromNBT(NBTTagCompound tag)
{
return new Int3(tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord"));
}
public static Int3 readFromNBT(NBTTagCompound tag)
{
return new Int3(tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord"));
}
public NBTTagCompound writeToNBT(NBTTagCompound tag)
{
tag.setInteger("xCoord", xCoord);
tag.setInteger("yCoord", yCoord);
tag.setInteger("zCoord", zCoord);
public NBTTagCompound writeToNBT(NBTTagCompound tag)
{
tag.setInteger("xCoord", xCoord);
tag.setInteger("yCoord", yCoord);
tag.setInteger("zCoord", zCoord);
return tag;
}
return tag;
}
@Override
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;
}
@Override
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;
}
}

View file

@ -1,14 +1,14 @@
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.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
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
{
@ -30,7 +30,7 @@ public class LifeBucketHandler
{
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);
return new ItemStack(ModItems.bucketLife);

View file

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

View file

@ -1,11 +1,11 @@
package WayofTime.alchemicalWizardry.common;
import WayofTime.alchemicalWizardry.ModItems;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import WayofTime.alchemicalWizardry.ModItems;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
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

@ -4,24 +4,24 @@ import net.minecraft.potion.Potion;
public class CombinedPotionComponent
{
public Potion result;
public Potion pot1;
public Potion pot2;
public Potion result;
public Potion pot1;
public Potion pot2;
public CombinedPotionComponent(Potion result, Potion pot1, Potion pot2)
{
this.result = result;
this.pot1 = pot1;
this.pot2 = pot2;
}
public CombinedPotionComponent(Potion result, Potion pot1, Potion pot2)
{
this.result = result;
this.pot1 = pot1;
this.pot2 = pot2;
}
public boolean isRecipeValid(Potion test1, Potion test2)
{
return (test1 == pot1 && test2 == pot2) || (test1 == pot2 && test2 == pot1);
}
public boolean isRecipeValid(Potion test1, Potion test2)
{
return (test1 == pot1 && test2 == pot2) || (test1 == pot2 && test2 == pot1);
}
public boolean isRecipeValid(int test1, int test2)
{
return (test1 == pot1.id && test2 == pot2.id) || (test1 == pot2.id && test2 == pot1.id);
}
public boolean isRecipeValid(int test1, int test2)
{
return (test1 == pot1.id && test2 == pot2.id) || (test1 == pot2.id && test2 == pot1.id);
}
}

View file

@ -1,182 +1,182 @@
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.List;
import net.minecraft.item.ItemStack;
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)
{
potionList.add(new CombinedPotionComponent(result, pot1, pot2));
}
public static void registerCombinedPotionRecipe(Potion result, Potion pot1, Potion pot2)
{
potionList.add(new CombinedPotionComponent(result, pot1, pot2));
}
public static boolean isRecipeValid(Potion pot1, Potion pot2)
{
for(CombinedPotionComponent recipe : potionList)
{
if(recipe.isRecipeValid(pot1, pot2))
{
return true;
}
}
public static boolean isRecipeValid(Potion pot1, Potion pot2)
{
for (CombinedPotionComponent recipe : potionList)
{
if (recipe.isRecipeValid(pot1, pot2))
{
return true;
}
}
return false;
}
return false;
}
public static boolean isRecipeValid(int pot1, int pot2)
{
for(CombinedPotionComponent recipe : potionList)
{
if(recipe.isRecipeValid(pot1, pot2))
{
return true;
}
}
public static boolean isRecipeValid(int pot1, int pot2)
{
for (CombinedPotionComponent recipe : potionList)
{
if (recipe.isRecipeValid(pot1, pot2))
{
return true;
}
}
return false;
}
return false;
}
public static Potion getPotion(Potion pot1, Potion pot2)
{
for(CombinedPotionComponent recipe : potionList)
{
if(recipe.isRecipeValid(pot1, pot2))
{
return recipe.result;
}
}
public static Potion getPotion(Potion pot1, Potion pot2)
{
for (CombinedPotionComponent recipe : potionList)
{
if (recipe.isRecipeValid(pot1, pot2))
{
return recipe.result;
}
}
return null;
}
return null;
}
public static Potion getPotion(int pot1, int pot2)
{
for(CombinedPotionComponent recipe : potionList)
{
if(recipe.isRecipeValid(pot1, pot2))
{
return recipe.result;
}
}
public static Potion getPotion(int pot1, int pot2)
{
for (CombinedPotionComponent recipe : potionList)
{
if (recipe.isRecipeValid(pot1, pot2))
{
return recipe.result;
}
}
return null;
}
return null;
}
public static ItemStack applyPotionEffect(ItemStack stack)
{
if(stack == null || !(stack.getItem() instanceof AlchemyFlask))
{
return null;
}
public static ItemStack applyPotionEffect(ItemStack stack)
{
if (stack == null || !(stack.getItem() instanceof AlchemyFlask))
{
return null;
}
List<AlchemyPotionHelper> list = AlchemyFlask.getEffects(stack);
if(list == null)
{
return stack;
}
List<AlchemyPotionHelper> list = AlchemyFlask.getEffects(stack);
if (list == null)
{
return stack;
}
boolean isDone = false;
boolean isDone = false;
for(AlchemyPotionHelper helper1 : list)
{
if(isDone)
{
continue;
}
for (AlchemyPotionHelper helper1 : list)
{
if (isDone)
{
continue;
}
for(int i=0; i<list.size(); i++)
{
if(isDone)
{
continue;
}
for (int i = 0; i < list.size(); i++)
{
if (isDone)
{
continue;
}
AlchemyPotionHelper helper2 = list.get(i);
AlchemyPotionHelper helper2 = list.get(i);
PotionEffect potEffect = getResultantPotion(helper1, helper2);
PotionEffect potEffect = getResultantPotion(helper1, helper2);
if(potEffect != null)
{
AlchemyPotionHelper potHelper = new AlchemyPotionHelper(potEffect.getPotionID(), potEffect.getDuration(), 0, potEffect.getAmplifier());
if (potEffect != null)
{
AlchemyPotionHelper potHelper = new AlchemyPotionHelper(potEffect.getPotionID(), potEffect.getDuration(), 0, potEffect.getAmplifier());
list.remove(helper1);
list.remove(helper2);
list.remove(helper1);
list.remove(helper2);
list.add(potHelper);
list.add(potHelper);
isDone = true;
}
}
}
isDone = true;
}
}
}
if(isDone)
{
AlchemyFlask.setEffects(stack, list);
if (isDone)
{
AlchemyFlask.setEffects(stack, list);
return stack;
}
return stack;
}
return null;
}
return null;
}
public static boolean hasCombinablePotionEffect(ItemStack stack)
{
if(stack == null || !(stack.getItem() instanceof AlchemyFlask))
{
return false;
}
public static boolean hasCombinablePotionEffect(ItemStack stack)
{
if (stack == null || !(stack.getItem() instanceof AlchemyFlask))
{
return false;
}
List<AlchemyPotionHelper> list = AlchemyFlask.getEffects(stack);
if(list == null)
{
return false;
}
List<AlchemyPotionHelper> list = AlchemyFlask.getEffects(stack);
if (list == null)
{
return false;
}
for(AlchemyPotionHelper helper1 : list)
{
for(AlchemyPotionHelper helper2 : list)
{
int pot1 = helper1.getPotionID();
int pot2 = helper2.getPotionID();
for (AlchemyPotionHelper helper1 : list)
{
for (AlchemyPotionHelper helper2 : list)
{
int pot1 = helper1.getPotionID();
int pot2 = helper2.getPotionID();
if(isRecipeValid(pot1, pot2))
{
return true;
}
}
}
if (isRecipeValid(pot1, pot2))
{
return true;
}
}
}
return false;
}
return false;
}
public static PotionEffect getResultantPotion(AlchemyPotionHelper potE1, AlchemyPotionHelper potE2)
{
if(potE1 == null || potE2 == null)
{
return null;
}
public static PotionEffect getResultantPotion(AlchemyPotionHelper potE1, AlchemyPotionHelper potE2)
{
if (potE1 == null || potE2 == null)
{
return null;
}
int pot1 = potE1.getPotionID();
int pot2 = potE2.getPotionID();
int pot1 = potE1.getPotionID();
int pot2 = potE2.getPotionID();
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 amplifier = (potE1.getConcentration() + potE2.getConcentration())/2;
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 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

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

View file

@ -1,8 +1,14 @@
package WayofTime.alchemicalWizardry.common.block;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
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.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@ -14,16 +20,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
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.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
public class ArmourForge extends Block
{
@ -39,8 +38,6 @@ public class ArmourForge extends Block
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("armourForge");
//setUnlocalizedName("armourForge");
// TODO Auto-generated constructor stub
}
@Override
@ -160,7 +157,6 @@ public class ArmourForge extends Block
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);
}

View file

@ -1,7 +1,9 @@
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.BlockContainer;
import net.minecraft.block.material.Material;
@ -12,29 +14,27 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
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 java.util.Random;
public class BlockAlchemicCalcinator extends BlockContainer
{
public BlockAlchemicCalcinator()
{
super(Material.rock);
setHardness(2.0F);
public BlockAlchemicCalcinator()
{
super(Material.rock);
setHardness(2.0F);
setResistance(5.0F);
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("alchemicCalcinator");
}
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("alchemicCalcinator");
}
@Override
public TileEntity createNewTileEntity(World world, int meta)
{
return new TEAlchemicCalcinator();
}
@Override
public TileEntity createNewTileEntity(World world, int meta)
{
return new TEAlchemicCalcinator();
}
@Override
@Override
public boolean renderAsNormalBlock()
{
return false;
@ -111,10 +111,10 @@ 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)
{
TEAlchemicCalcinator tileEntity = (TEAlchemicCalcinator) world.getTileEntity(x, y, z);
TEAlchemicCalcinator tileEntity = (TEAlchemicCalcinator) world.getTileEntity(x, y, z);
if (tileEntity == null || player.isSneaking())
{
@ -125,40 +125,39 @@ public class BlockAlchemicCalcinator extends BlockContainer
if (playerItem != null)
{
if(playerItem.getItem() instanceof IReagentManipulator)
{
return false;
}
if (playerItem.getItem() instanceof IReagentManipulator)
{
return false;
}
if(playerItem.getItem() instanceof IBloodOrb)
{
if(tileEntity.getStackInSlot(0) == null)
{
ItemStack newItem = playerItem.copy();
if (playerItem.getItem() instanceof IBloodOrb)
{
if (tileEntity.getStackInSlot(0) == null)
{
ItemStack newItem = playerItem.copy();
newItem.stackSize = 1;
--playerItem.stackSize;
tileEntity.setInventorySlotContents(0, newItem);
}
}
else if(tileEntity.getStackInSlot(1) == null)
{
ItemStack newItem = playerItem.copy();
}
} else if (tileEntity.getStackInSlot(1) == null)
{
ItemStack newItem = playerItem.copy();
newItem.stackSize = 1;
--playerItem.stackSize;
tileEntity.setInventorySlotContents(1, newItem);
}
}
} else if (playerItem == null)
{
if(tileEntity.getStackInSlot(1) != null)
{
if (tileEntity.getStackInSlot(1) != null)
{
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(1));
tileEntity.setInventorySlotContents(1, null);
}else if(tileEntity.getStackInSlot(0) != null)
{
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
} else if (tileEntity.getStackInSlot(0) != null)
{
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
tileEntity.setInventorySlotContents(0, null);
}
}
}
tileEntity.getWorldObj().markBlockForUpdate(x, y, z);

View file

@ -1,9 +1,12 @@
package WayofTime.alchemicalWizardry.common.block;
import java.util.Random;
import javax.swing.Icon;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
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.BlockContainer;
import net.minecraft.block.material.Material;
@ -15,17 +18,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
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;
import java.util.Random;
public class BlockAltar extends BlockContainer
{
@ -45,8 +40,6 @@ public class BlockAltar extends BlockContainer
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("bloodAltar");
//setUnlocalizedName("blockAltar");
//func_111022_d("AlchemicalWizardry:blocks");
}
@Override
@ -67,14 +60,8 @@ public class BlockAltar extends BlockContainer
{
case 0:
return bottomIcon;
case 1:
return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default:
return sideIcon2;
}
@ -83,13 +70,13 @@ public class BlockAltar extends BlockContainer
@Override
public boolean hasComparatorInputOverride()
{
return true;
return true;
}
@Override
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)
{
@ -113,8 +100,6 @@ public class BlockAltar extends BlockContainer
{
TEAltar tileEntity = (TEAltar) world.getTileEntity(x, y, z);
// world.scheduleBlockUpdate(x, y, z, this.blockID, 0);
if (tileEntity == null || player.isSneaking())
{
return false;
@ -129,26 +114,24 @@ public class BlockAltar extends BlockContainer
if (player.worldObj.isRemote)
{
world.markBlockForUpdate(x, y, z);
}else
} else
{
tileEntity.sendChatInfoToPlayer(player);
tileEntity.sendChatInfoToPlayer(player);
}
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);
}else
world.markBlockForUpdate(x, y, z);
} else
{
tileEntity.sendMoreChatInfoToPlayer(player);
tileEntity.sendMoreChatInfoToPlayer(player);
}
return true;
}
else if (playerItem.getItem().equals(ModItems.sigilOfHolding))
} else if (playerItem.getItem().equals(ModItems.sigilOfHolding))
{
ItemStack item = ((SigilOfHolding) playerItem.getItem()).getCurrentItem(playerItem);
@ -156,22 +139,21 @@ public class BlockAltar extends BlockContainer
{
if (player.worldObj.isRemote)
{
world.markBlockForUpdate(x, y, z);
}else
world.markBlockForUpdate(x, y, z);
} else
{
tileEntity.sendChatInfoToPlayer(player);
tileEntity.sendChatInfoToPlayer(player);
}
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);
}else
world.markBlockForUpdate(x, y, z);
} else
{
tileEntity.sendMoreChatInfoToPlayer(player);
tileEntity.sendMoreChatInfoToPlayer(player);
}
return true;
@ -183,27 +165,16 @@ public class BlockAltar extends BlockContainer
{
ItemStack newItem = playerItem.copy();
newItem.stackSize = 1;
// if(newItem.getMaxDamage()==0)
// {
// newItem.setItemDamage(0);
// }
--playerItem.stackSize;
tileEntity.setInventorySlotContents(0, newItem);
tileEntity.startCycle();
} 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));
tileEntity.setInventorySlotContents(0, null);
tileEntity.setActive();
}
world.markBlockForUpdate(x, y, z);
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
return true;
}
@ -294,21 +265,9 @@ public class BlockAltar extends BlockContainer
}
}
// @Override
// public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
// {
// return 1;
// }
// @Override
// public boolean canProvidePower()
// {
// return true;
// }
@Override
public TileEntity createNewTileEntity(World var1, int var2)
{
return new TEAltar();
}
@Override
public TileEntity createNewTileEntity(World var1, int var2)
{
return new TEAltar();
}
}

View file

@ -1,7 +1,7 @@
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.material.Material;
import net.minecraft.entity.EntityLivingBase;
@ -9,84 +9,43 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
import java.util.ArrayList;
public class BlockBelljar extends BlockContainer
{
public BlockBelljar()
{
super(Material.glass);
setHardness(2.0F);
public BlockBelljar()
{
super(Material.glass);
setHardness(2.0F);
setResistance(5.0F);
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("crystalBelljar");
}
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("crystalBelljar");
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack)
{
TileEntity tile = world.getTileEntity(x, y, z);
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack)
{
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TEBellJar)
{
NBTTagCompound tag = stack.getTagCompound();
if(tag != null)
{
((TEBellJar) tile).readTankNBTOnPlace(tag);
}
}
}
if (tile instanceof TEBellJar)
{
NBTTagCompound tag = stack.getTagCompound();
if (tag != null)
{
((TEBellJar) tile).readTankNBTOnPlace(tag);
}
}
}
// @Override
// public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
// {
// if(world.isRemote)
// {
// return;
// }
//
// 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 TileEntity createNewTileEntity(World world, int meta)
{
return new TEBellJar();
}
@Override
@Override
public boolean renderAsNormalBlock()
{
return false;
@ -113,45 +72,44 @@ public class BlockBelljar extends BlockContainer
@Override
public boolean hasComparatorInputOverride()
{
return true;
return true;
}
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int meta)
{
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TEBellJar)
{
return ((TEBellJar) tile).getRSPowerOutput();
}
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TEBellJar)
{
return ((TEBellJar) tile).getRSPowerOutput();
}
return 15;
}
@Override
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player)
{
this.dropBlockAsItem(world, x, y, z, meta, 0);
super.onBlockHarvested(world, x, y, z, meta, player);
this.dropBlockAsItem(world, x, y, z, meta, 0);
super.onBlockHarvested(world, x, y, z, meta, player);
}
@Override
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)
{
ItemStack drop = new ItemStack(this);
NBTTagCompound tag = new NBTTagCompound();
((TEBellJar)tile).writeTankNBT(tag);
drop.stackTagCompound = tag;
if (tile instanceof TEBellJar)
{
ItemStack drop = new ItemStack(this);
NBTTagCompound tag = new NBTTagCompound();
((TEBellJar) tile).writeTankNBT(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;
import java.util.List;
import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@ -10,15 +9,15 @@ import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
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 BlockBloodLightSource()
{
super(Material.cloth);
//setCreativeTab(AlchemicalWizardry.tabBloodMagic);
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)
{
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)

View file

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

View file

@ -1,43 +1,42 @@
package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEDemonPortal;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
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 BlockDemonPortal()
{
super(Material.rock);
public BlockDemonPortal()
{
super(Material.rock);
setHardness(2.0F);
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("demonPortal");
}
}
@Override
public TileEntity createNewTileEntity(World var1, int var2)
{
return new TEDemonPortal();
}
@Override
public TileEntity createNewTileEntity(World var1, int var2)
{
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)
{
if(world.isRemote)
{
return false;
}
if (world.isRemote)
{
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;
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.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@ -9,11 +14,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
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
{
@ -47,14 +47,8 @@ public class BlockHomHeart extends BlockContainer
{
case 0:
return bottomIcon;
case 1:
return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default:
return sideIcon;
}

View file

@ -1,5 +1,10 @@
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.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@ -8,11 +13,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
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
{
@ -23,7 +23,6 @@ public class BlockMasterStone extends BlockContainer
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("blockMasterStone");
// TODO Auto-generated constructor stub
}
@Override
@ -36,13 +35,13 @@ public class BlockMasterStone extends BlockContainer
@Override
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player)
{
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TEMasterStone)
{
((TEMasterStone) tile).useOnRitualBroken();
}
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TEMasterStone)
{
((TEMasterStone) tile).useOnRitualBroken();
}
super.onBlockHarvested(world, x, y, z, meta, player);
super.onBlockHarvested(world, x, y, z, meta, player);
}
@Override

View file

@ -1,20 +1,13 @@
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.common.tileEntity.TEOrientable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer;
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
{
@ -24,16 +17,8 @@ public class BlockOrientable extends BlockContainer
setHardness(2.0F);
setResistance(5.0F);
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
public TileEntity createNewTileEntity(World world, int dunno)
{
@ -43,7 +28,7 @@ public class BlockOrientable extends BlockContainer
@Override
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)
{
return false;
@ -54,44 +39,44 @@ public class BlockOrientable extends BlockContainer
if (tile instanceof TEOrientable)
{
TEOrientable newTile = (TEOrientable)tile;
if(player.isSneaking())
{
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getInputDirection())+1;
TEOrientable newTile = (TEOrientable) tile;
if (player.isSneaking())
{
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getInputDirection()) + 1;
if(nextSide>5)
{
nextSide = 0;
}
if(ForgeDirection.getOrientation(nextSide)==newTile.getOutputDirection())
{
nextSide++;
if(nextSide>5)
{
nextSide = 0;
}
}
if (nextSide > 5)
{
nextSide = 0;
}
if (ForgeDirection.getOrientation(nextSide) == newTile.getOutputDirection())
{
nextSide++;
if (nextSide > 5)
{
nextSide = 0;
}
}
newTile.setInputDirection(ForgeDirection.getOrientation(nextSide));
}else
{
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getOutputDirection())+1;
newTile.setInputDirection(ForgeDirection.getOrientation(nextSide));
} else
{
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getOutputDirection()) + 1;
if(nextSide>5)
{
nextSide = 0;
}
if(ForgeDirection.getOrientation(nextSide)==newTile.getInputDirection())
{
nextSide++;
if(nextSide>5)
{
nextSide = 0;
}
}
if (nextSide > 5)
{
nextSide = 0;
}
if (ForgeDirection.getOrientation(nextSide) == newTile.getInputDirection())
{
nextSide++;
if (nextSide > 5)
{
nextSide = 0;
}
}
newTile.setOutputDirection(ForgeDirection.getOrientation(nextSide));
}
newTile.setOutputDirection(ForgeDirection.getOrientation(nextSide));
}
}
world.markBlockForUpdate(x, y, z);
@ -100,84 +85,114 @@ public class BlockOrientable extends BlockContainer
public int getTextureIndexForSideAndOrientation(int side, ForgeDirection input, ForgeDirection output)
{
if(ForgeDirection.getOrientation(side) == input)
{
return 0;
}
if(ForgeDirection.getOrientation(side) == output)
{
return 1;
}
if(ForgeDirection.getOrientation(side) == output.getOpposite())
{
return 6;
}
if (ForgeDirection.getOrientation(side) == input)
{
return 0;
}
if (ForgeDirection.getOrientation(side) == output)
{
return 1;
}
if (ForgeDirection.getOrientation(side) == output.getOpposite())
{
return 6;
}
switch(side)
{
case 0: //BOTTOM
switch(output)
{
case NORTH: return 2; //UP
case SOUTH: return 3; //DOWN
case EAST: return 4; //LEFT
case WEST: return 5; //RIGHT
default: break;
}
break;
case 1: //TOP
switch(output)
{
case NORTH: return 2; //UP
case SOUTH: return 3; //DOWN
case EAST: return 5;
case WEST: return 4;
default: break;
}
break;
case 2: //NORTH
switch(output)
{
case DOWN: return 3;
case UP: return 2;
case EAST: return 4;
case WEST: return 5;
default: break;
}
break;
case 3: //SOUTH
switch(output)
{
case DOWN: return 3;
case UP: return 2;
case EAST: return 5;
case WEST: return 4;
default: break;
}
break;
case 4: //WEST
switch(output)
{
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;
}
switch (side)
{
case 0: //BOTTOM
switch (output)
{
case NORTH:
return 2; //UP
case SOUTH:
return 3; //DOWN
case EAST:
return 4; //LEFT
case WEST:
return 5; //RIGHT
default:
break;
}
break;
case 1: //TOP
switch (output)
{
case NORTH:
return 2; //UP
case SOUTH:
return 3; //DOWN
case EAST:
return 5;
case WEST:
return 4;
default:
break;
}
break;
case 2: //NORTH
switch (output)
{
case DOWN:
return 3;
case UP:
return 2;
case EAST:
return 4;
case WEST:
return 5;
default:
break;
}
break;
case 3: //SOUTH
switch (output)
{
case DOWN:
return 3;
case UP:
return 2;
case EAST:
return 5;
case WEST:
return 4;
default:
break;
}
break;
case 4: //WEST
switch (output)
{
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;
return 0;
}
@Override

View file

@ -1,7 +1,9 @@
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.BlockContainer;
import net.minecraft.block.material.Material;
@ -16,10 +18,8 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
public class BlockPedestal extends BlockContainer
{
@ -39,7 +39,6 @@ public class BlockPedestal extends BlockContainer
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("bloodPedestal");
//func_111022_d("AlchemicalWizardry:blocks");
}
@Override
@ -60,14 +59,8 @@ public class BlockPedestal extends BlockContainer
{
case 0:
return bottomIcon;
case 1:
return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default:
return sideIcon2;
}
@ -93,18 +86,11 @@ public class BlockPedestal extends BlockContainer
tileEntity.setInventorySlotContents(0, newItem);
} 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));
tileEntity.setInventorySlotContents(0, null);
tileEntity.setActive();
}
world.markBlockForUpdate(x, y, z);
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
return true;
}

View file

@ -1,7 +1,9 @@
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.BlockContainer;
import net.minecraft.block.material.Material;
@ -16,10 +18,8 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
public class BlockPlinth extends BlockContainer
{
@ -39,7 +39,6 @@ public class BlockPlinth extends BlockContainer
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("bloodPlinth");
//func_111022_d("AlchemicalWizardry:blocks");
}
@Override
@ -60,14 +59,8 @@ public class BlockPlinth extends BlockContainer
{
case 0:
return bottomIcon;
case 1:
return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default:
return sideIcon2;
}
@ -93,18 +86,11 @@ public class BlockPlinth extends BlockContainer
tileEntity.setInventorySlotContents(0, newItem);
} 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));
tileEntity.setInventorySlotContents(0, null);
tileEntity.setActive();
}
world.markBlockForUpdate(x, y, z);
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
return true;
}

View file

@ -1,83 +1,67 @@
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.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
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 BlockReagentConduit()
{
super(Material.cloth);
setHardness(2.0F);
public BlockReagentConduit()
{
super(Material.cloth);
setHardness(2.0F);
setResistance(5.0F);
this.setBlockName("blockReagentConduit");
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
this.setBlockName("blockReagentConduit");
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
}
@Override
@Override
@SideOnly(Side.CLIENT)
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)
{
return new TEReagentConduit();
}
@Override
@Override
public boolean canProvidePower()
{
return true;
}
// @Override
// @SideOnly(Side.CLIENT)
// public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
// {
// if (this.equals(ModBlocks.blockSpellParadigm))
// {
// par3List.add(new ItemStack(par1, 1, 0));
// par3List.add(new ItemStack(par1, 1, 1));
// par3List.add(new ItemStack(par1, 1, 2));
// par3List.add(new ItemStack(par1, 1, 3));
// } else
// {
// super.getSubBlocks(par1, par2CreativeTabs, par3List);
// }
// }
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
{
return super.onBlockActivated(world, x, y, z, player, side, what, these, are);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
{
return super.onBlockActivated(world, x, y, z, player, side, what, these, are);
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public int getRenderType()
{
return -1;
}
@Override
public int getRenderType()
{
return -1;
}
}

View file

@ -1,43 +1,42 @@
package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TESchematicSaver;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
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 BlockSchematicSaver()
{
super(Material.rock);
public BlockSchematicSaver()
{
super(Material.rock);
setHardness(2.0F);
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("schematicSaver");
}
}
@Override
public TileEntity createNewTileEntity(World var1, int var2)
{
return new TESchematicSaver();
}
@Override
public TileEntity createNewTileEntity(World var1, int var2)
{
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)
{
if(world.isRemote)
{
return false;
}
if (world.isRemote)
{
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;
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.BlockContainer;
import net.minecraft.block.material.Material;
@ -14,11 +17,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
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 java.util.Random;
public class BlockSocket extends BlockContainer
{
@ -59,14 +59,8 @@ public class BlockSocket extends BlockContainer
{
case 0:
return bottomIcon;
case 1:
return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default:
return sideIcon2;
}
@ -83,7 +77,6 @@ public class BlockSocket extends BlockContainer
}
ItemStack playerItem = player.getCurrentEquippedItem();
if (tileEntity.getStackInSlot(0) == null && playerItem != null)
{
if (playerItem.getItem() instanceof ArmourUpgrade)
@ -95,18 +88,11 @@ public class BlockSocket extends BlockContainer
}
} 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));
tileEntity.setInventorySlotContents(0, null);
tileEntity.setActive();
}
world.markBlockForUpdate(x, y, z);
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
return true;
}

View file

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

View file

@ -1,7 +1,7 @@
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.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
@ -9,25 +9,25 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
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 BlockSpellEffect()
{
super();
this.setBlockName("blockSpellEffect");
}
public BlockSpellEffect()
{
super();
this.setBlockName("blockSpellEffect");
}
@Override
@Override
public TileEntity createNewTileEntity(World world, int meta)
{
return new TESpellEffectBlock();
}
@Override
@Override
public boolean renderAsNormalBlock()
{
return false;
@ -45,15 +45,15 @@ public class BlockSpellEffect extends BlockOrientable
return false;
}
@SideOnly(Side.CLIENT)
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
if (this.equals(ModBlocks.blockSpellEffect))
{
for(int i=0; i<4; i++)
{
par3List.add(new ItemStack(par1, 1, i));
}
for (int i = 0; i < 4; i++)
{
par3List.add(new ItemStack(par1, 1, i));
}
} else
{
super.getSubBlocks(par1, par2CreativeTabs, par3List);

View file

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

View file

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

View file

@ -1,40 +1,38 @@
package WayofTime.alchemicalWizardry.common.block;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
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;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
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;
import java.util.List;
public class BlockSpellParadigm extends BlockOrientable
{
public static final float minPos = (3f/16f);
public static final float maxPos = (13f/16f);
public static final float minPos = (3f / 16f);
public static final float maxPos = (13f / 16f);
public BlockSpellParadigm()
{
super();
this.setBlockName("blockSpellParadigm");
}
public BlockSpellParadigm()
{
super();
this.setBlockName("blockSpellParadigm");
}
@Override
@Override
public TileEntity createNewTileEntity(World world, int meta)
{
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)
@ -53,13 +51,13 @@ public class BlockSpellParadigm extends BlockOrientable
}
}
@Override
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();
@Override
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();
if(stack != null && stack.getItem() instanceof ItemComplexSpellCrystal)
{
if (stack != null && stack.getItem() instanceof ItemComplexSpellCrystal)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
@ -71,26 +69,26 @@ public class BlockSpellParadigm extends BlockOrientable
itemTag.setInteger("zCoord", z);
itemTag.setInteger("dimensionId", world.provider.dimensionId);
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
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public int getRenderType()
{
return -1;
}
@Override
public int getRenderType()
{
return -1;
}
}

View file

@ -1,7 +1,10 @@
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.BlockContainer;
import net.minecraft.block.BlockMobSpawner;
@ -16,11 +19,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
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 java.util.Random;
public class BlockTeleposer extends BlockContainer
{
@ -40,7 +40,6 @@ public class BlockTeleposer extends BlockContainer
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("bloodTeleposer");
//func_111022_d("AlchemicalWizardry:blocks");
}
@Override
@ -61,14 +60,8 @@ public class BlockTeleposer extends BlockContainer
{
case 0:
return bottomIcon;
case 1:
return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default:
return sideIcon2;
}
@ -97,13 +90,7 @@ public class BlockTeleposer extends BlockContainer
return true;
}
}
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;
}
@ -216,11 +203,6 @@ public class BlockTeleposer extends BlockContainer
}
//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);
if (tileEntityI != null)
@ -230,12 +212,6 @@ public class BlockTeleposer extends BlockContainer
newTileEntityI.xCoord = xf;
newTileEntityI.yCoord = yf;
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);
@ -247,12 +223,6 @@ public class BlockTeleposer extends BlockContainer
newTileEntityF.xCoord = xi;
newTileEntityF.yCoord = yi;
newTileEntityF.zCoord = zi;
TileEntity tile = worldI.getTileEntity(xi, yi, zi);
// if(tile instanceof TileMultipart)
// {
// TileMultipart.createFromNBT(nbttag2);
// }
}
return true;

View file

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

View file

@ -1,9 +1,9 @@
package WayofTime.alchemicalWizardry.common.block;
import java.util.List;
import javax.swing.Icon;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
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.ItemStack;
import net.minecraft.util.IIcon;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
public class BloodRune extends Block
{
@ -61,7 +59,7 @@ public class BloodRune extends Block
return 7;
case 4: //Better Capacity rune
return 8;
return 8;
}
return 0;
@ -106,7 +104,7 @@ public class BloodRune extends Block
return this.orbCapacityRuneIcon;
case 4:
return this.betterCapacityRuneIcon;
return this.betterCapacityRuneIcon;
default:
return blockIcon;

View file

@ -1,11 +1,11 @@
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 cpw.mods.fml.relauncher.Side;
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
{

View file

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

View file

@ -1,11 +1,11 @@
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 cpw.mods.fml.relauncher.Side;
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
{
@ -16,7 +16,6 @@ public class EmptySocket extends Block
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("emptySocket");
// TODO Auto-generated constructor stub
}
@Override

View file

@ -1,5 +1,9 @@
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.material.Material;
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.PotionEffect;
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
{
@ -26,7 +24,6 @@ public class ImperfectRitualStone extends Block
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("imperfectRitualStone");
// TODO Auto-generated constructor stub
}
@Override
@ -39,25 +36,19 @@ public class ImperfectRitualStone extends Block
@Override
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);
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)
{
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);
@ -73,19 +64,13 @@ public class ImperfectRitualStone extends Block
return true;
} 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);
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.damageBoost.id, 20000, 7));
zomb.addPotionEffect(new PotionEffect(Potion.resistance.id, 20000, 3));
@ -94,44 +79,31 @@ public class ImperfectRitualStone extends Block
{
world.spawnEntityInWorld(zomb);
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
// if (!player.capabilities.isCreativeMode)
// {
// PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
// }
}
return true;
} else if (block== Blocks.lapis_block)
} else if (block == Blocks.lapis_block)
{
if (!player.capabilities.isCreativeMode && !world.isRemote)
{
EnergyItems.drainPlayerNetwork(player, 5000);
EnergyItems.drainPlayerNetwork(player, 5000);
}
if (!world.isRemote)
{
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));
// }
}
} 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)
{
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));

View file

@ -1,11 +1,11 @@
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 cpw.mods.fml.relauncher.Side;
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
{

View file

@ -1,14 +1,14 @@
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.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
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
{
@ -16,8 +16,6 @@ public class LifeEssenceBlock extends BlockFluidClassic
{
super(AlchemicalWizardry.lifeEssenceFluid, Material.water);
AlchemicalWizardry.lifeEssenceFluid.setBlock(this);
//setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("lifeEssenceFluidBlock");
}
@ -35,7 +33,6 @@ public class LifeEssenceBlock extends BlockFluidClassic
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:lifeEssenceStill");
AlchemicalWizardry.lifeEssenceFluid.setFlowingIcon(blockIcon);
AlchemicalWizardry.lifeEssenceFluid.setStillIcon(blockIcon);
//this.getFluid().setIcons(blockIcon);
}
@Override

View file

@ -1,5 +1,10 @@
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.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@ -8,11 +13,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
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
{

View file

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

View file

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

View file

@ -1,22 +1,21 @@
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.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Facing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
public class SpectralBlock extends BlockContainer
{
@ -26,13 +25,6 @@ public class SpectralBlock extends BlockContainer
this.setBlockName("spectralBlock");
}
// @Override
// public int tickRate(World par1World)
// {
// return 10;
// }
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister)
@ -43,7 +35,7 @@ public class SpectralBlock extends BlockContainer
@Override
public boolean isOpaqueCube()
{
Block d;
Block d;
return false;
}
@ -83,7 +75,6 @@ public class SpectralBlock extends BlockContainer
@Override
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())
{
return false;
@ -95,7 +86,7 @@ public class SpectralBlock extends BlockContainer
{
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)
{
@ -112,9 +103,9 @@ public class SpectralBlock extends BlockContainer
return true;
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
{
return new TESpectralBlock();
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
{
return new TESpectralBlock();
}
}

View file

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

View file

@ -60,7 +60,7 @@ public class AltarUpgradeComponent
public void addBetterCapacitiveUpgrade()
{
betterCapacitiveUpgrades++;
betterCapacitiveUpgrades++;
}
public int getSpeedUpgrades()
@ -100,6 +100,6 @@ public class AltarUpgradeComponent
public int getBetterCapacitiveUpgrades()
{
return this.betterCapacitiveUpgrades;
return this.betterCapacitiveUpgrades;
}
}

View file

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

View file

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

View file

@ -1,183 +1,180 @@
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.List;
import net.minecraft.block.Block;
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 int doorX;
public int doorZ;
public int doorY;
public int buildingTier;
public int buildingType;
public List<BlockSet> blockList;
public String name;
public int doorX;
public int doorZ;
public int doorY;
public int buildingTier;
public int buildingType;
public List<BlockSet> blockList;
public BuildingSchematic()
{
this("");
}
public BuildingSchematic()
{
this("");
}
public BuildingSchematic(String name)
{
this.name = name;
blockList = new ArrayList();
this.doorX = 0;
this.doorZ = 0;
this.doorY = 0;
this.buildingTier = 0;
this.buildingType = DemonBuilding.BUILDING_HOUSE;
}
public BuildingSchematic(String name)
{
this.name = name;
blockList = new ArrayList();
this.doorX = 0;
this.doorZ = 0;
this.doorY = 0;
this.buildingTier = 0;
this.buildingType = DemonBuilding.BUILDING_HOUSE;
}
public void addBlockWithMeta(Block block, int meta, int xOffset, int yOffset, int zOffset)
{
for(BlockSet set : blockList)
{
if(set.isContained(block, meta))
{
set.addPositionToBlock(xOffset, yOffset, zOffset);
return;
}
}
public void addBlockWithMeta(Block block, int meta, int xOffset, int yOffset, int zOffset)
{
for (BlockSet set : blockList)
{
if (set.isContained(block, meta))
{
set.addPositionToBlock(xOffset, yOffset, zOffset);
return;
}
}
BlockSet set = new BlockSet(block, meta);
set.addPositionToBlock(xOffset, yOffset, zOffset);
blockList.add(set);
}
BlockSet set = new BlockSet(block, meta);
set.addPositionToBlock(xOffset, yOffset, zOffset);
blockList.add(set);
}
public void buildAll(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
{
for(BlockSet set : blockList)
{
set.buildAll(world, xCoord, yCoord, zCoord, dir);
}
}
public void buildAll(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
{
for (BlockSet set : blockList)
{
set.buildAll(world, xCoord, yCoord, zCoord, dir);
}
}
public GridSpaceHolder createGSH()
{
GridSpaceHolder holder = new GridSpaceHolder();
public GridSpaceHolder createGSH()
{
GridSpaceHolder holder = new GridSpaceHolder();
for(BlockSet set : blockList)
{
for(Int3 coords : set.getPositions())
{
int gridX = (int)((coords.xCoord+2*Math.signum(coords.xCoord))/5);
int gridZ = (int)((coords.zCoord+2*Math.signum(coords.zCoord))/5);
for (BlockSet set : blockList)
{
for (Int3 coords : set.getPositions())
{
int gridX = (int) ((coords.xCoord + 2 * Math.signum(coords.xCoord)) / 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()
{
int gridX = (int)((doorX+2*Math.signum(doorX))/5);
int gridZ = (int)((doorZ+2*Math.signum(doorZ))/5);
public Int3 getGridSpotOfDoor()
{
int gridX = (int) ((doorX + 2 * Math.signum(doorX)) / 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)
{
List<Int3> positionList = new ArrayList();
public List<Int3> getGriddedPositions(ForgeDirection dir)
{
List<Int3> positionList = new ArrayList();
for(BlockSet blockSet : blockList)
{
for(Int3 pos : blockSet.getPositions())
{
int xOff = pos.xCoord;
int zOff = pos.zCoord;
for (BlockSet blockSet : blockList)
{
for (Int3 pos : blockSet.getPositions())
{
int xOff = pos.xCoord;
int zOff = pos.zCoord;
switch(dir)
{
case SOUTH:
xOff *= -1;
zOff *= -1;
break;
case WEST:
int temp = zOff;
zOff = xOff * -1;
xOff = temp;
break;
case EAST:
int temp2 = zOff * -1;
zOff = xOff;
xOff = temp2;
break;
default:
}
switch (dir)
{
case SOUTH:
xOff *= -1;
zOff *= -1;
break;
case WEST:
int temp = zOff;
zOff = xOff * -1;
xOff = temp;
break;
case EAST:
int temp2 = zOff * -1;
zOff = xOff;
xOff = temp2;
break;
default:
}
Int3 nextPos = new Int3(xOff, 0, zOff);
if(!positionList.contains(nextPos))
{
positionList.add(nextPos);
}
}
}
Int3 nextPos = new Int3(xOff, 0, zOff);
if (!positionList.contains(nextPos))
{
positionList.add(nextPos);
}
}
}
return positionList;
}
return positionList;
}
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
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
List<Int3> positionList = getGriddedPositions(dir);
List<Int3> positionList = getGriddedPositions(dir);
for(int i=this.getMinY(); i<=this.getMaxY(); i++)
{
for(Int3 pos : positionList)
{
Block block = world.getBlock(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
if(block != ModBlocks.blockDemonPortal)
{
world.setBlockToAir(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
}
}
for (int i = this.getMinY(); i <= this.getMaxY(); i++)
{
for (Int3 pos : positionList)
{
Block block = world.getBlock(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
if (block != ModBlocks.blockDemonPortal)
{
world.setBlockToAir(xCoord + pos.xCoord, yCoord + i, zCoord + pos.zCoord);
}
}
}
}
//grid.destroyAllInGridSpaces(world, xCoord, yCoord + i, zCoord, dir); //Deprecated method
}
}
public int getMinY()
{
int min = 0;
for (BlockSet set : blockList)
{
for (Int3 pos : set.getPositions())
{
if (pos.yCoord < min)
{
min = pos.yCoord;
}
}
}
public int getMinY()
{
int min = 0;
for(BlockSet set : blockList)
{
for(Int3 pos : set.getPositions())
{
if(pos.yCoord < min)
{
min = pos.yCoord;
}
}
}
return min;
}
return min;
}
public int getMaxY()
{
int max = 0;
for(BlockSet set : blockList)
{
for(Int3 pos : set.getPositions())
{
if(pos.yCoord > max)
{
max = pos.yCoord;
}
}
}
return max;
}
public int getMaxY()
{
int max = 0;
for (BlockSet set : blockList)
{
for (Int3 pos : set.getPositions())
{
if (pos.yCoord > max)
{
max = pos.yCoord;
}
}
}
return max;
}
}

View file

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

View file

@ -4,19 +4,19 @@ import net.minecraft.world.World;
public class DemonCrosspath
{
private int xCoord;
private int yLevel;
private int zCoord;
private int xCoord;
private int yLevel;
private int zCoord;
public DemonCrosspath(int xCoord, int yLevel, int zCoord)
{
this.xCoord = xCoord;
this.yLevel = yLevel;
this.zCoord = zCoord;
}
public DemonCrosspath(int xCoord, int yLevel, int zCoord)
{
this.xCoord = xCoord;
this.yLevel = yLevel;
this.zCoord = zCoord;
}
public void createCrosspath(World world)
{
public void createCrosspath(World world)
{
}
}
}

View file

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

View file

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

View file

@ -7,303 +7,303 @@ import net.minecraftforge.common.util.ForgeDirection;
public class GridSpaceHolder
{
public GridSpace[][] area;
public int negXRadius; //These variables indicate how much the grid has expanded from the 1x1
public int posXRadius; //matrix in each direction
public int negZRadius;
public int posZRadius;
public GridSpace[][] area;
public int negXRadius; //These variables indicate how much the grid has expanded from the 1x1
public int posXRadius; //matrix in each direction
public int negZRadius;
public int posZRadius;
public GridSpaceHolder()
{
area = new GridSpace[1][1];
area[0][0] = new GridSpace();
}
public GridSpaceHolder()
{
area = new GridSpace[1][1];
area[0][0] = new GridSpace();
}
public void expandAreaInNegX()
{
GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 2][negZRadius + posZRadius + 1];
for(int i=0; i<=negZRadius + posZRadius; i++)
{
newGrid[0][i] = new GridSpace();
}
public void expandAreaInNegX()
{
GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 2][negZRadius + posZRadius + 1];
for (int i = 0; i <= negZRadius + posZRadius; i++)
{
newGrid[0][i] = new GridSpace();
}
for(int i=0; i<=negXRadius + posXRadius; i++)
{
for(int j=0; j<=negZRadius + posZRadius; j++)
{
newGrid[i+1][j] = area[i][j];
}
}
for (int i = 0; i <= negXRadius + posXRadius; i++)
{
for (int j = 0; j <= negZRadius + posZRadius; j++)
{
newGrid[i + 1][j] = area[i][j];
}
}
area = newGrid;
negXRadius += 1;
}
area = newGrid;
negXRadius += 1;
}
public void expandAreaInPosX()
{
GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 2][negZRadius + posZRadius + 1];
public void expandAreaInPosX()
{
GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 2][negZRadius + posZRadius + 1];
for(int i=0; i<=negZRadius + posZRadius; i++)
{
newGrid[negXRadius + posXRadius + 1][i] = new GridSpace();
}
for (int i = 0; i <= negZRadius + posZRadius; i++)
{
newGrid[negXRadius + posXRadius + 1][i] = new GridSpace();
}
for(int i=0; i<=negXRadius + posXRadius; i++)
{
for(int j=0; j<=negZRadius + posZRadius; j++)
{
newGrid[i][j] = area[i][j];
}
}
for (int i = 0; i <= negXRadius + posXRadius; i++)
{
for (int j = 0; j <= negZRadius + posZRadius; j++)
{
newGrid[i][j] = area[i][j];
}
}
area = newGrid;
posXRadius += 1;
}
area = newGrid;
posXRadius += 1;
}
public void expandAreaInNegZ()
{
GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 1][negZRadius + posZRadius + 2];
public void expandAreaInNegZ()
{
GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 1][negZRadius + posZRadius + 2];
System.out.println("x " + newGrid.length + "z " + newGrid[0].length);
System.out.println("x " + newGrid.length + "z " + newGrid[0].length);
for(int i=0; i<=negXRadius + posXRadius; i++)
{
newGrid[i][0] = new GridSpace();
}
for (int i = 0; i <= negXRadius + posXRadius; i++)
{
newGrid[i][0] = new GridSpace();
}
for(int i=0; i<=negXRadius + posXRadius; i++)
{
for(int j=0; j<=negZRadius + posZRadius; j++)
{
newGrid[i][j+1] = area[i][j];
}
}
for (int i = 0; i <= negXRadius + posXRadius; i++)
{
for (int j = 0; j <= negZRadius + posZRadius; j++)
{
newGrid[i][j + 1] = area[i][j];
}
}
area = newGrid;
negZRadius += 1;
}
area = newGrid;
negZRadius += 1;
}
public void expandAreaInPosZ()
{
GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 1][negZRadius + posZRadius + 2];
public void expandAreaInPosZ()
{
GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 1][negZRadius + posZRadius + 2];
for(int i=0; i<=negXRadius + posXRadius; i++)
{
newGrid[i][negZRadius + posZRadius + 1] = new GridSpace();
}
for (int i = 0; i <= negXRadius + posXRadius; i++)
{
newGrid[i][negZRadius + posZRadius + 1] = new GridSpace();
}
for(int i=0; i<=negXRadius + posXRadius; i++)
{
for(int j=0; j<=negZRadius + posZRadius; j++)
{
newGrid[i][j] = area[i][j];
}
}
for (int i = 0; i <= negXRadius + posXRadius; i++)
{
for (int j = 0; j <= negZRadius + posZRadius; j++)
{
newGrid[i][j] = area[i][j];
}
}
area = newGrid;
posZRadius += 1;
}
area = newGrid;
posZRadius += 1;
}
public GridSpace getGridSpace(int x, int z)
{
if(x > posXRadius|| x < -negXRadius || z > posZRadius || z < -negZRadius)
{
return new GridSpace();
}else
{
return (area[x + negXRadius][z + negZRadius]);
}
}
public GridSpace getGridSpace(int x, int z)
{
if (x > posXRadius || x < -negXRadius || z > posZRadius || z < -negZRadius)
{
return new GridSpace();
} else
{
return (area[x + negXRadius][z + negZRadius]);
}
}
public void setGridSpace(int x, int z, GridSpace space)
{
if(x > posXRadius)
{
this.expandAreaInPosX();
this.setGridSpace(x, z, space);
return;
}else if(x < -negXRadius)
{
this.expandAreaInNegX();
this.setGridSpace(x, z, space);
return;
}else if(z > posZRadius)
{
this.expandAreaInPosZ();
this.setGridSpace(x, z, space);
return;
}else if(z < -negZRadius)
{
this.expandAreaInNegZ();
this.setGridSpace(x, z, space);
return;
}else
{
area[x + negXRadius][z + negZRadius] = space;
}
}
public void setGridSpace(int x, int z, GridSpace space)
{
if (x > posXRadius)
{
this.expandAreaInPosX();
this.setGridSpace(x, z, space);
return;
} else if (x < -negXRadius)
{
this.expandAreaInNegX();
this.setGridSpace(x, z, space);
return;
} else if (z > posZRadius)
{
this.expandAreaInPosZ();
this.setGridSpace(x, z, space);
return;
} else if (z < -negZRadius)
{
this.expandAreaInNegZ();
this.setGridSpace(x, z, space);
return;
} else
{
area[x + negXRadius][z + negZRadius] = space;
}
}
public boolean doesContainAll(GridSpaceHolder master, int xInit, int zInit, ForgeDirection dir)
{
if(master != null)
{
System.out.println("negXRadius: " + negXRadius + " posXRadius: " + posXRadius + " negZRadius: " + negZRadius + " posZRadius: " + posZRadius);
for(int i=-negXRadius; i<=posXRadius; i++)
{
for(int j=-negZRadius; j<=posZRadius; j++)
{
GridSpace thisSpace = this.getGridSpace(i, j);
if(thisSpace.isEmpty())
{
continue;
}
public boolean doesContainAll(GridSpaceHolder master, int xInit, int zInit, ForgeDirection dir)
{
if (master != null)
{
System.out.println("negXRadius: " + negXRadius + " posXRadius: " + posXRadius + " negZRadius: " + negZRadius + " posZRadius: " + posZRadius);
for (int i = -negXRadius; i <= posXRadius; i++)
{
for (int j = -negZRadius; j <= posZRadius; j++)
{
GridSpace thisSpace = this.getGridSpace(i, j);
if (thisSpace.isEmpty())
{
continue;
}
System.out.println("x: " + i + " z: " + j);
System.out.println("x: " + i + " z: " + j);
int xOff = 0;
int zOff = 0;
int xOff = 0;
int zOff = 0;
switch(dir)
{
case SOUTH:
xOff = -i;
zOff = -j;
break;
case WEST:
xOff = j;
zOff = -i;
break;
case EAST:
xOff = -j;
zOff = i;
break;
default:
xOff = i;
zOff = j;
break;
}
if(!master.getGridSpace(xInit + xOff, zInit + zOff).isEmpty())
{
return false;
}
}
}
return true;
}
return false;
}
switch (dir)
{
case SOUTH:
xOff = -i;
zOff = -j;
break;
case WEST:
xOff = j;
zOff = -i;
break;
case EAST:
xOff = -j;
zOff = i;
break;
default:
xOff = i;
zOff = j;
break;
}
if (!master.getGridSpace(xInit + xOff, zInit + zOff).isEmpty())
{
return false;
}
}
}
return true;
}
return false;
}
public void setAllGridSpaces(int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master)
{
System.out.println("Grid space selected: (" + xInit + "," + zInit + ")");
if(master != null)
{
for(int i=-negXRadius; i<=posXRadius; i++)
{
for(int j=-negZRadius; j<=posZRadius; j++)
{
GridSpace thisSpace = this.getGridSpace(i, j);
if(thisSpace.isEmpty())
{
continue;
}
public void setAllGridSpaces(int xInit, int zInit, int yLevel, ForgeDirection dir, int type, GridSpaceHolder master)
{
System.out.println("Grid space selected: (" + xInit + "," + zInit + ")");
if (master != null)
{
for (int i = -negXRadius; i <= posXRadius; i++)
{
for (int j = -negZRadius; j <= posZRadius; j++)
{
GridSpace thisSpace = this.getGridSpace(i, j);
if (thisSpace.isEmpty())
{
continue;
}
int xOff = 0;
int zOff = 0;
int xOff = 0;
int zOff = 0;
switch(dir)
{
case SOUTH:
xOff = -i;
zOff = -j;
break;
case WEST:
xOff = j;
zOff = -i;
break;
case EAST:
xOff = -j;
zOff = i;
break;
default:
xOff = i;
zOff = j;
break;
}
switch (dir)
{
case SOUTH:
xOff = -i;
zOff = -j;
break;
case WEST:
xOff = j;
zOff = -i;
break;
case EAST:
xOff = -j;
zOff = i;
break;
default:
xOff = i;
zOff = j;
break;
}
System.out.println("Grid space (" + (xInit + xOff) + "," + (zInit + zOff) + ")");
System.out.println("Grid space (" + (xInit + xOff) + "," + (zInit + zOff) + ")");
master.setGridSpace(xInit + xOff, zInit + zOff, new GridSpace(type, yLevel));
}
}
}
}
master.setGridSpace(xInit + xOff, zInit + zOff, new GridSpace(type, yLevel));
}
}
}
}
public void destroyAllInGridSpaces(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
{
for(int i=-negXRadius; i<=posXRadius; i++)
{
for(int j=-negZRadius; j<=posZRadius; j++)
{
GridSpace thisSpace = this.getGridSpace(i, j);
if(thisSpace.isEmpty())
{
continue;
}
public void destroyAllInGridSpaces(World world, int xCoord, int yCoord, int zCoord, ForgeDirection dir)
{
for (int i = -negXRadius; i <= posXRadius; i++)
{
for (int j = -negZRadius; j <= posZRadius; j++)
{
GridSpace thisSpace = this.getGridSpace(i, j);
if (thisSpace.isEmpty())
{
continue;
}
int xOff = 0;
int zOff = 0;
int xOff = 0;
int zOff = 0;
switch(dir)
{
case SOUTH:
xOff = -i;
zOff = -j;
break;
case WEST:
xOff = j;
zOff = -i;
break;
case EAST:
xOff = -j;
zOff = i;
break;
default:
xOff = i;
zOff = j;
break;
}
switch (dir)
{
case SOUTH:
xOff = -i;
zOff = -j;
break;
case WEST:
xOff = j;
zOff = -i;
break;
case EAST:
xOff = -j;
zOff = i;
break;
default:
xOff = i;
zOff = j;
break;
}
for(int l = -2; l<=2; l++)
{
for(int m = -2; m<=2; m++)
{
Block block = world.getBlock(xCoord + xOff*5 + l, yCoord, zCoord + zOff*5 + m);
if(block == ModBlocks.blockDemonPortal)
{
continue;
}
world.setBlockToAir(xCoord + xOff*5 + l, yCoord, zCoord + zOff*5 + m);
}
}
}
}
}
for (int l = -2; l <= 2; l++)
{
for (int m = -2; m <= 2; m++)
{
Block block = world.getBlock(xCoord + xOff * 5 + l, yCoord, zCoord + zOff * 5 + m);
if (block == ModBlocks.blockDemonPortal)
{
continue;
}
world.setBlockToAir(xCoord + xOff * 5 + l, yCoord, zCoord + zOff * 5 + m);
}
}
}
}
}
public int getNumberOfGridSpaces()
{
int num = 0;
for(int i=-this.negXRadius; i<=this.posXRadius; i++)
{
for(int j=-this.negZRadius; j<=this.posZRadius; j++)
{
if(!this.getGridSpace(i, j).isEmpty())
{
num++;
}
}
}
public int getNumberOfGridSpaces()
{
int num = 0;
for (int i = -this.negXRadius; i <= this.posXRadius; i++)
{
for (int j = -this.negZRadius; j <= this.posZRadius; j++)
{
if (!this.getGridSpace(i, j).isEmpty())
{
num++;
}
}
}
return num;
}
return num;
}
}

View file

@ -4,5 +4,5 @@ import net.minecraft.nbt.NBTTagCompound;
public class TileBlockSet extends BlockSet
{
public NBTTagCompound tag;
public NBTTagCompound tag;
}

View file

@ -1,18 +1,13 @@
package WayofTime.alchemicalWizardry.common.entity.mob;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityAnimal;
@ -20,17 +15,12 @@ import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class EntityBileDemon extends EntityDemon
{
@ -46,22 +36,17 @@ public class EntityBileDemon extends EntityDemon
this.setSize(1.3F, 2.0F);
this.getNavigator().setAvoidsWater(true);
this.tasks.addTask(1, new EntityAISwimming(this));
//this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
this.tasks.addTask(2, new EntityAIAttackOnCollide(this, 1.0D, true));
this.tasks.addTask(3, this.aiSit);
this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
//this.tasks.addTask(6, new EntityAIMate(this, 1.0D));
this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
//this.tasks.addTask(8, new EntityAIBeg(this, 8.0F));
this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(9, new EntityAILookIdle(this));
this.tasks.addTask(4, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(7, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
//this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false));
this.setTamed(false);
attackTimer = 0;
//this.isImmuneToFire = true;
}
@Override
@ -318,7 +303,7 @@ public class EntityBileDemon extends EntityDemon
}
}
if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer)this.getOwner())) && !this.isBreedingItem(itemstack))
if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack))
{
if (!this.worldObj.isRemote)
{
@ -375,7 +360,6 @@ public class EntityBileDemon extends EntityDemon
public boolean isBreedingItem(ItemStack par1ItemStack)
{
return false;
//return par1ItemStack == null ? false : (!(Item.itemsList[par1ItemStack.itemID] instanceof ItemFood) ? false : ((ItemFood)Item.itemsList[par1ItemStack.itemID]).isWolfsFavoriteMeat());
}
/**
@ -455,7 +439,6 @@ public class EntityBileDemon extends EntityDemon
*/
protected boolean canDespawn()
{
//return !this.isTamed() && this.ticksExisted > 2400;
return false;
}

View file

@ -5,7 +5,6 @@ import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.block.BlockColored;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
@ -18,7 +17,6 @@ import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -28,7 +26,6 @@ import net.minecraft.world.World;
public class EntityBoulderFist extends EntityDemon
{
//private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 40, 40, 15.0F);
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
private static float maxTamedHealth = 60.0F;
@ -44,25 +41,20 @@ public class EntityBoulderFist extends EntityDemon
this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
//this.tasks.addTask(6, new EntityAIMate(this, 1.0D));
this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
//this.tasks.addTask(8, new EntityAIBeg(this, 8.0F));
this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(9, new EntityAILookIdle(this));
this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(8, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
this.targetTasks.addTask(4, new EntityAITargetAggro(this, EntityPlayer.class, 0, false));
this.setAggro(false);
//this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false));
this.setTamed(false);
if (par1World != null && !par1World.isRemote)
{
this.setCombatTask();
}
//this.isImmuneToFire = true;
}
@Override
@ -80,8 +72,6 @@ public class EntityBoulderFist extends EntityDemon
{
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxUntamedHealth);
}
//this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(10.0D);
}
/**
@ -121,7 +111,6 @@ public class EntityBoulderFist extends EntityDemon
super.entityInit();
this.dataWatcher.addObject(18, new Float(this.getHealth()));
this.dataWatcher.addObject(19, new Byte((byte) 0));
//this.dataWatcher.addObject(20, new Byte((byte) BlockColored.getBlockFromDye(1)));
}
/**
@ -300,7 +289,7 @@ public class EntityBoulderFist extends EntityDemon
}
}
if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer)this.getOwner())) && !this.isBreedingItem(itemstack))
if (this.getOwner() instanceof EntityPlayer && SpellHelper.getUsername(par1EntityPlayer).equalsIgnoreCase(SpellHelper.getUsername((EntityPlayer) this.getOwner())) && !this.isBreedingItem(itemstack))
{
if (!this.worldObj.isRemote)
{
@ -358,7 +347,6 @@ public class EntityBoulderFist extends EntityDemon
public boolean isBreedingItem(ItemStack par1ItemStack)
{
return false;
//return par1ItemStack == null ? false : (!(Item.itemsList[par1ItemStack.itemID] instanceof ItemFood) ? false : ((ItemFood)Item.itemsList[par1ItemStack.itemID]).isWolfsFavoriteMeat());
}
/**
@ -438,7 +426,6 @@ public class EntityBoulderFist extends EntityDemon
*/
protected boolean canDespawn()
{
//return !this.isTamed() && this.ticksExisted > 2400;
return false;
}

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