Anti-comments sweep!
This commit is contained in:
parent
e6a10f3f06
commit
dea1f87078
File diff suppressed because it is too large
Load diff
|
@ -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,13 +32,13 @@ 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);
|
||||
|
||||
try
|
||||
|
@ -59,16 +59,16 @@ 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();
|
||||
|
||||
|
||||
MeteorParadigm.maxChance = config.get("meteor", "maxChance", 1000).getInt();
|
||||
AlchemicalWizardry.doMeteorsDestroyBlocks = config.get("meteor", "doMeteorsDestroyBlocks", true).getBoolean(true);
|
||||
AlchemicalWizardry.diamondMeteorArray = config.get("meteor", "diamondMeteor", new String[]{"oreDiamond", "100", "oreEmerald", "75", "oreCinnabar", "200", "oreAmber", "200"}).getStringList();
|
||||
|
@ -80,27 +80,27 @@ public class BloodMagicConfiguration
|
|||
AlchemicalWizardry.netherStarMeteorArray = config.get("meteor", "netherStarMeteor", new String[]{"oreDiamond", "150", "oreEmerald", "100", "oreQuartz", "250", "oreSunstone", "5", "oreMoonstone", "50", "oreIridium", "5", "oreCertusQuartz", "150"}).getStringList();
|
||||
AlchemicalWizardry.netherStarMeteorRadius = config.get("meteor", "netherStarMeteorRadius", 3).getInt();
|
||||
|
||||
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.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.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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (Exception e)
|
||||
{
|
||||
|
||||
//TODO Log
|
||||
//FMLLog.log(Level.SEVERE, e, "Blood Magic" + " has had a problem loading its configuration, go ask on the forums :p");
|
||||
//TODO Log
|
||||
//FMLLog.log(Level.SEVERE, e, "Blood Magic" + " has had a problem loading its configuration, go ask on the forums :p");
|
||||
|
||||
} finally
|
||||
{
|
||||
|
@ -123,25 +123,25 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
config.save();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
config.save();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
@ -123,14 +83,14 @@ public class ModBlocks
|
|||
blockReagentConduit = new BlockReagentConduit();
|
||||
blockAlchemicCalcinator = new BlockAlchemicCalcinator();
|
||||
blockCrystalBelljar = new BlockBelljar();
|
||||
|
||||
|
||||
blockLifeEssence = new LifeEssenceBlock();
|
||||
}
|
||||
|
||||
|
||||
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");
|
||||
|
@ -139,9 +99,9 @@ public class ModBlocks
|
|||
GameRegistry.registerBlock(ModBlocks.ritualStone, "ritualStone");
|
||||
GameRegistry.registerBlock(ModBlocks.blockMasterStone, "masterStone");
|
||||
GameRegistry.registerBlock(ModBlocks.bloodSocket, "bloodSocket");
|
||||
GameRegistry.registerBlock(ModBlocks.imperfectRitualStone, "imperfectRitualStone");
|
||||
|
||||
GameRegistry.registerBlock(ModBlocks.armourForge, "armourForge");
|
||||
GameRegistry.registerBlock(ModBlocks.imperfectRitualStone, "imperfectRitualStone");
|
||||
|
||||
GameRegistry.registerBlock(ModBlocks.armourForge, "armourForge");
|
||||
GameRegistry.registerBlock(ModBlocks.emptySocket, "emptySocket");
|
||||
GameRegistry.registerBlock(ModBlocks.bloodStoneBrick, "bloodStoneBrick");
|
||||
GameRegistry.registerBlock(ModBlocks.largeBloodStoneBrick, "largeBloodStoneBrick");
|
||||
|
@ -152,23 +112,22 @@ public class ModBlocks
|
|||
GameRegistry.registerBlock(ModBlocks.blockTeleposer, "blockTeleposer");
|
||||
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");
|
||||
GameRegistry.registerBlock(ModBlocks.blockBuildingSchematicSaver, "blockSchemSaver");
|
||||
GameRegistry.registerBlock(ModBlocks.blockReagentConduit, "blockReagentConduit");
|
||||
GameRegistry.registerBlock(ModBlocks.blockReagentConduit, "blockReagentConduit");
|
||||
GameRegistry.registerBlock(ModBlocks.blockAlchemicCalcinator, "blockAlchemicCalcinator");
|
||||
GameRegistry.registerBlock(ModBlocks.blockCrystalBelljar, ItemBlockCrystalBelljar.class, "blockCrystalBelljar");
|
||||
}
|
||||
|
||||
|
||||
public static void registerBlocksInInit()
|
||||
{
|
||||
//GameRegistry.registerBlock(ModBlocks.blockLifeEssence, "lifeEssence");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
@ -153,7 +87,7 @@ public class ModItems
|
|||
public static Item armourInhibitor;
|
||||
public static Item creativeFiller;
|
||||
public static Item demonPlacer;
|
||||
|
||||
|
||||
public static Item baseItems;
|
||||
public static Item baseAlchemyItems;
|
||||
|
||||
|
@ -174,19 +108,19 @@ public class ModItems
|
|||
public static Item itemBloodLightSigil;
|
||||
public static Item itemComplexSpellCrystal;
|
||||
public static Item itemBloodFrame;
|
||||
|
||||
|
||||
public static Item itemSigilOfEnderSeverance;
|
||||
public static Item itemSigilOfSupression;
|
||||
public static Item itemFluidSigil;
|
||||
public static Item itemSeerSigil;
|
||||
public static Item itemCombinationalCatalyst;
|
||||
|
||||
|
||||
public static Item customTool;
|
||||
|
||||
|
||||
public static Item itemAttunedCrystal;
|
||||
public static Item itemTankSegmenter;
|
||||
public static Item itemDestinationClearer;
|
||||
|
||||
|
||||
public static Item bucketLife;
|
||||
|
||||
public static void init()
|
||||
|
@ -281,15 +215,15 @@ public class ModItems
|
|||
itemTankSegmenter = new ItemTankSegmenter().setUnlocalizedName("itemTankSegmenter");
|
||||
itemDestinationClearer = new ItemDestinationClearer().setUnlocalizedName("destinationClearer");
|
||||
}
|
||||
|
||||
|
||||
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");
|
||||
|
@ -367,16 +301,16 @@ public class ModItems
|
|||
GameRegistry.registerItem(ModItems.itemSigilOfEnderSeverance, "sigilOfEnderSeverance");
|
||||
GameRegistry.registerItem(ModItems.itemFluidSigil, "fluidSigil");
|
||||
GameRegistry.registerItem(ModItems.itemSeerSigil, "seerSigil");
|
||||
|
||||
|
||||
GameRegistry.registerItem(ModItems.customTool, "customTool");
|
||||
|
||||
|
||||
GameRegistry.registerItem(ModItems.bucketLife, "bucketLife");
|
||||
GameRegistry.registerItem(ModItems.itemCombinationalCatalyst, "itemCombinationalCatalyst");
|
||||
|
||||
|
||||
GameRegistry.registerItem(ModItems.itemAttunedCrystal, "itemAttunedCrystal");
|
||||
GameRegistry.registerItem(ModItems.itemTankSegmenter, "itemTankSegmenter");
|
||||
GameRegistry.registerItem(ModItems.itemDestinationClearer, "itemDestinationClearer");
|
||||
|
||||
|
||||
GameRegistry.registerItem(ModItems.baseItems, "bloodMagicBaseItems");
|
||||
GameRegistry.registerItem(ModItems.baseAlchemyItems, "bloodMagicBaseAlchemyItems");
|
||||
//GameRegistry.registerItem(ModItems.itemBloodFrame, "itemBloodFrame");
|
||||
|
|
|
@ -2,44 +2,44 @@ package WayofTime.alchemicalWizardry.api;
|
|||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ColourAndCoords
|
||||
public class ColourAndCoords
|
||||
{
|
||||
public int colourRed;
|
||||
public int colourGreen;
|
||||
public int colourBlue;
|
||||
public int colourIntensity;
|
||||
|
||||
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;
|
||||
|
||||
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 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;
|
||||
}
|
||||
public int colourRed;
|
||||
public int colourGreen;
|
||||
public int colourBlue;
|
||||
public int colourIntensity;
|
||||
|
||||
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;
|
||||
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
@ -135,9 +135,9 @@ public class AlchemyRecipe
|
|||
{
|
||||
return this.recipe;
|
||||
}
|
||||
|
||||
|
||||
public int getOrbLevel()
|
||||
{
|
||||
return this.bloodOrbLevel;
|
||||
return this.bloodOrbLevel;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IAlchemyGoggles
|
||||
public interface IAlchemyGoggles
|
||||
{
|
||||
public boolean showIngameHUD(World world, ItemStack stack, EntityPlayer player);
|
||||
public boolean showIngameHUD(World world, ItemStack stack, EntityPlayer player);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
public interface IReagentContainer
|
||||
public interface IReagentContainer
|
||||
{
|
||||
public ReagentStack getReagent();
|
||||
public ReagentStack getReagent();
|
||||
|
||||
public int getReagentStackAmount();
|
||||
|
||||
|
@ -13,6 +11,6 @@ public interface IReagentContainer
|
|||
public int fill(ReagentStack resource, boolean doFill);
|
||||
|
||||
public ReagentStack drain(int maxDrain, boolean doDrain);
|
||||
|
||||
|
||||
public ReagentContainerInfo getInfo();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
|||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IReagentHandler
|
||||
public interface IReagentHandler
|
||||
{
|
||||
int fill(ForgeDirection from, ReagentStack resource, boolean doFill);
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ import java.util.Map;
|
|||
|
||||
public interface ISegmentedReagentHandler extends IReagentHandler
|
||||
{
|
||||
public int getNumberOfTanks();
|
||||
|
||||
public int getTanksTunedToReagent(Reagent reagent);
|
||||
|
||||
public void setTanksTunedToReagent(Reagent reagent, int total);
|
||||
|
||||
public Map<Reagent, Integer> getAttunedTankMap();
|
||||
public int getNumberOfTanks();
|
||||
|
||||
public int getTanksTunedToReagent(Reagent reagent);
|
||||
|
||||
public void setTanksTunedToReagent(Reagent reagent, int total);
|
||||
|
||||
public Map<Reagent, Integer> getAttunedTankMap();
|
||||
}
|
||||
|
|
|
@ -1,54 +1,52 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class Reagent
|
||||
public class Reagent
|
||||
{
|
||||
public final String name;
|
||||
|
||||
public static final int REAGENT_SIZE = 1000;
|
||||
|
||||
private int colourRed = 0;
|
||||
private int colourGreen = 0;
|
||||
private int colourBlue = 0;
|
||||
private int colourIntensity = 255;
|
||||
|
||||
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 int getColourRed()
|
||||
{
|
||||
return colourRed;
|
||||
}
|
||||
|
||||
public int getColourGreen()
|
||||
{
|
||||
return colourGreen;
|
||||
}
|
||||
|
||||
public int getColourBlue()
|
||||
{
|
||||
return colourBlue;
|
||||
}
|
||||
|
||||
public int getColourIntensity()
|
||||
{
|
||||
return colourIntensity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return o instanceof Reagent ? this == o && name.equals(((Reagent)o).name) : false;
|
||||
}
|
||||
public final String name;
|
||||
|
||||
public static final int REAGENT_SIZE = 1000;
|
||||
|
||||
private int colourRed = 0;
|
||||
private int colourGreen = 0;
|
||||
private int colourBlue = 0;
|
||||
private int colourIntensity = 255;
|
||||
|
||||
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 int getColourRed()
|
||||
{
|
||||
return colourRed;
|
||||
}
|
||||
|
||||
public int getColourGreen()
|
||||
{
|
||||
return colourGreen;
|
||||
}
|
||||
|
||||
public int getColourBlue()
|
||||
{
|
||||
return colourBlue;
|
||||
}
|
||||
|
||||
public int getColourIntensity()
|
||||
{
|
||||
return colourIntensity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return o instanceof Reagent ? this == o && name.equals(((Reagent) o).name) : false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
@ -31,13 +27,13 @@ public class ReagentContainer implements IReagentContainer
|
|||
{
|
||||
ReagentStack reagent = ReagentStack.loadReagentStackFromNBT(nbt);
|
||||
int capacity = nbt.getInteger("capacity");
|
||||
|
||||
|
||||
if (reagent != null)
|
||||
{
|
||||
return new ReagentContainer(reagent, capacity);
|
||||
}else
|
||||
} else
|
||||
{
|
||||
return new ReagentContainer(null, capacity);
|
||||
return new ReagentContainer(null, capacity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,12 +43,12 @@ public class ReagentContainer implements IReagentContainer
|
|||
{
|
||||
reagentStack.writeToNBT(nbt);
|
||||
}
|
||||
|
||||
|
||||
nbt.setInteger("capacity", capacity);
|
||||
|
||||
return nbt;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ReagentStack getReagent()
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 class ReagentRegistry
|
||||
{
|
||||
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 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");
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
reagentList.put(key, reagent);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Reagent getReagentForKey(String key)
|
||||
{
|
||||
if(reagentList.containsKey(key))
|
||||
{
|
||||
return reagentList.get(key);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void registerItemAndReagent(ItemStack stack, ReagentStack reagentStack)
|
||||
{
|
||||
itemToReagentMap.put(stack, reagentStack);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
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 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");
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
reagentList.put(key, reagent);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Reagent getReagentForKey(String key)
|
||||
{
|
||||
if (reagentList.containsKey(key))
|
||||
{
|
||||
return reagentList.get(key);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void registerItemAndReagent(ItemStack stack, ReagentStack reagentStack)
|
||||
{
|
||||
itemToReagentMap.put(stack, reagentStack);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +1,62 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class ReagentStack
|
||||
public class ReagentStack
|
||||
{
|
||||
public Reagent reagent;
|
||||
public int amount;
|
||||
|
||||
public ReagentStack(Reagent reagent, int amount)
|
||||
{
|
||||
this.reagent = reagent;
|
||||
this.amount = amount;
|
||||
}
|
||||
public Reagent reagent;
|
||||
public int amount;
|
||||
|
||||
public ReagentStack(ReagentStack reagentStack, int amount)
|
||||
{
|
||||
this(reagentStack.reagent,amount);
|
||||
}
|
||||
public ReagentStack(Reagent reagent, int amount)
|
||||
{
|
||||
this.reagent = reagent;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public static ReagentStack loadReagentStackFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
Reagent reagent = ReagentRegistry.getReagentForKey(tag.getString("Reagent"));
|
||||
|
||||
if(reagent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int amount = tag.getInteger("amount");
|
||||
ReagentStack stack = new ReagentStack(reagent, amount);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
tag.setString("Reagent", ReagentRegistry.getKeyForReagent(this.reagent));
|
||||
tag.setInteger("amount", this.amount);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
public ReagentStack splitStack(int amount)
|
||||
{
|
||||
ReagentStack copyStack = this.copy();
|
||||
int splitAmount = Math.min(amount, this.amount);
|
||||
copyStack.amount = splitAmount;
|
||||
this.amount -= splitAmount;
|
||||
|
||||
return copyStack;
|
||||
}
|
||||
|
||||
public ReagentStack copy()
|
||||
{
|
||||
return new ReagentStack(this.reagent, this.amount);
|
||||
}
|
||||
|
||||
public boolean isReagentEqual(ReagentStack other)
|
||||
public ReagentStack(ReagentStack reagentStack, int amount)
|
||||
{
|
||||
this(reagentStack.reagent, amount);
|
||||
}
|
||||
|
||||
public static ReagentStack loadReagentStackFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
Reagent reagent = ReagentRegistry.getReagentForKey(tag.getString("Reagent"));
|
||||
|
||||
if (reagent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int amount = tag.getInteger("amount");
|
||||
ReagentStack stack = new ReagentStack(reagent, amount);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
tag.setString("Reagent", ReagentRegistry.getKeyForReagent(this.reagent));
|
||||
tag.setInteger("amount", this.amount);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
public ReagentStack splitStack(int amount)
|
||||
{
|
||||
ReagentStack copyStack = this.copy();
|
||||
int splitAmount = Math.min(amount, this.amount);
|
||||
copyStack.amount = splitAmount;
|
||||
this.amount -= splitAmount;
|
||||
|
||||
return copyStack;
|
||||
}
|
||||
|
||||
public ReagentStack copy()
|
||||
{
|
||||
return new ReagentStack(this.reagent, this.amount);
|
||||
}
|
||||
|
||||
public boolean isReagentEqual(ReagentStack other)
|
||||
{
|
||||
return other != null && this.reagent == other.reagent;
|
||||
}
|
||||
|
|
|
@ -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()};
|
||||
}
|
||||
}
|
|
@ -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,49 +18,49 @@ 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();
|
||||
|
||||
this.attunedTankMap = new HashMap();
|
||||
this.tanks = new ReagentContainer[numberOfTanks];
|
||||
for(int i=0; i<numberOfTanks; i++)
|
||||
{
|
||||
this.tanks[i] = new ReagentContainer(tankSize);
|
||||
}
|
||||
super();
|
||||
|
||||
this.attunedTankMap = new HashMap();
|
||||
this.tanks = new ReagentContainer[numberOfTanks];
|
||||
for (int i = 0; i < numberOfTanks; i++)
|
||||
{
|
||||
this.tanks[i] = new ReagentContainer(tankSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
|
||||
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,29 +70,29 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
|||
super.writeToNBT(tag);
|
||||
|
||||
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,98 +100,98 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
|||
@Override
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
|
||||
{
|
||||
int totalFill = 0;
|
||||
|
||||
boolean useTankLimit = !this.attunedTankMap.isEmpty();
|
||||
|
||||
if(resource != null)
|
||||
{
|
||||
int totalTanksFillable = useTankLimit ? this.getTanksTunedToReagent(resource.reagent) : this.tanks.length;
|
||||
int tanksFilled = 0;
|
||||
int totalFill = 0;
|
||||
|
||||
int maxFill = resource.amount;
|
||||
|
||||
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);
|
||||
|
||||
if(doesReagentMatch)
|
||||
{
|
||||
totalFill += tanks[i].fill(remainingStack, doFill);
|
||||
tanksFilled++;
|
||||
}else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(totalFill >= maxFill || 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;
|
||||
|
||||
boolean isTankEmpty = tanks[i].getReagent() == null;
|
||||
|
||||
if(isTankEmpty)
|
||||
{
|
||||
totalFill += tanks[i].fill(remainingStack, doFill);
|
||||
tanksFilled++;
|
||||
}else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(totalFill >= maxFill || tanksFilled >= totalTanksFillable)
|
||||
{
|
||||
return totalFill;
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean useTankLimit = !this.attunedTankMap.isEmpty();
|
||||
|
||||
if (resource != null)
|
||||
{
|
||||
int totalTanksFillable = useTankLimit ? this.getTanksTunedToReagent(resource.reagent) : this.tanks.length;
|
||||
int tanksFilled = 0;
|
||||
|
||||
int maxFill = resource.amount;
|
||||
|
||||
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);
|
||||
|
||||
if (doesReagentMatch)
|
||||
{
|
||||
totalFill += tanks[i].fill(remainingStack, doFill);
|
||||
tanksFilled++;
|
||||
} else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (totalFill >= maxFill || 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;
|
||||
|
||||
boolean isTankEmpty = tanks[i].getReagent() == null;
|
||||
|
||||
if (isTankEmpty)
|
||||
{
|
||||
totalFill += tanks[i].fill(remainingStack, doFill);
|
||||
tanksFilled++;
|
||||
} else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (totalFill >= maxFill || tanksFilled >= totalTanksFillable)
|
||||
{
|
||||
return totalFill;
|
||||
}
|
||||
}
|
||||
}
|
||||
return totalFill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
|
||||
{
|
||||
if(resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
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()))
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int maxDrain = resource.amount;
|
||||
Reagent reagent = resource.reagent;
|
||||
int drained = 0;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
for (int i = 0; i < tanks.length; i++)
|
||||
{
|
||||
ReagentStack stack = tanks[i].drain(maxDrain, doDrain);
|
||||
if (stack != null)
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
this.attunedTankMap.put(reagent, new Integer(total));
|
||||
}
|
||||
@Override
|
||||
public void setTanksTunedToReagent(Reagent reagent, int total)
|
||||
{
|
||||
if (total == 0 && this.attunedTankMap.containsKey(reagent))
|
||||
{
|
||||
this.attunedTankMap.remove(reagent);
|
||||
return;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
this.attunedTankMap.put(reagent, new Integer(total));
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -2,69 +2,69 @@ package WayofTime.alchemicalWizardry.api.altarRecipeRegistry;
|
|||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AltarRecipe
|
||||
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 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 getRequiredItem()
|
||||
{
|
||||
return this.requiredItem;
|
||||
}
|
||||
|
||||
public boolean doesRequiredItemMatch(ItemStack comparedStack, int tierCheck)
|
||||
{
|
||||
if(comparedStack == null || this.requiredItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return tierCheck>=minTier && this.requiredItem.isItemEqual(comparedStack);
|
||||
}
|
||||
|
||||
public int getMinTier()
|
||||
{
|
||||
return this.minTier;
|
||||
}
|
||||
|
||||
public int getLiquidRequired()
|
||||
{
|
||||
return this.liquidRequired;
|
||||
}
|
||||
|
||||
public int getConsumptionRate()
|
||||
{
|
||||
return this.consumptionRate;
|
||||
}
|
||||
|
||||
public int getDrainRate()
|
||||
{
|
||||
return this.drainRate;
|
||||
}
|
||||
|
||||
public boolean getCanBeFilled()
|
||||
{
|
||||
return this.canBeFilled;
|
||||
}
|
||||
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 ItemStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public ItemStack getRequiredItem()
|
||||
{
|
||||
return this.requiredItem;
|
||||
}
|
||||
|
||||
public boolean doesRequiredItemMatch(ItemStack comparedStack, int tierCheck)
|
||||
{
|
||||
if (comparedStack == null || this.requiredItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return tierCheck >= minTier && this.requiredItem.isItemEqual(comparedStack);
|
||||
}
|
||||
|
||||
public int getMinTier()
|
||||
{
|
||||
return this.minTier;
|
||||
}
|
||||
|
||||
public int getLiquidRequired()
|
||||
{
|
||||
return this.liquidRequired;
|
||||
}
|
||||
|
||||
public int getConsumptionRate()
|
||||
{
|
||||
return this.consumptionRate;
|
||||
}
|
||||
|
||||
public int getDrainRate()
|
||||
{
|
||||
return this.drainRate;
|
||||
}
|
||||
|
||||
public boolean getCanBeFilled()
|
||||
{
|
||||
return this.canBeFilled;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 class AltarRecipeRegistry
|
||||
{
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack getItemForItemAndTier(ItemStack testItem, int currentTierAltar)
|
||||
{
|
||||
for(AltarRecipe recipe : altarRecipes)
|
||||
{
|
||||
if(recipe.doesRequiredItemMatch(testItem, currentTierAltar))
|
||||
{
|
||||
return ItemStack.copyItemStack(recipe.getResult());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static AltarRecipe getAltarRecipeForItemAndTier(ItemStack testItem, int currentTierAltar)
|
||||
{
|
||||
for(AltarRecipe recipe : altarRecipes)
|
||||
{
|
||||
if(recipe.doesRequiredItemMatch(testItem, currentTierAltar))
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack getItemForItemAndTier(ItemStack testItem, int currentTierAltar)
|
||||
{
|
||||
for (AltarRecipe recipe : altarRecipes)
|
||||
{
|
||||
if (recipe.doesRequiredItemMatch(testItem, currentTierAltar))
|
||||
{
|
||||
return ItemStack.copyItemStack(recipe.getResult());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static AltarRecipe getAltarRecipeForItemAndTier(ItemStack testItem, int currentTierAltar)
|
||||
{
|
||||
for (AltarRecipe recipe : altarRecipes)
|
||||
{
|
||||
if (recipe.doesRequiredItemMatch(testItem, currentTierAltar))
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,34 +2,34 @@ package WayofTime.alchemicalWizardry.api.bindingRegistry;
|
|||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BindingRecipe
|
||||
public class BindingRecipe
|
||||
{
|
||||
public ItemStack requiredItem;
|
||||
public ItemStack 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;
|
||||
}
|
||||
|
||||
return this.requiredItem.isItemEqual(testStack);
|
||||
}
|
||||
|
||||
public ItemStack getResult(ItemStack inputItem)
|
||||
{
|
||||
return this.getResult();
|
||||
}
|
||||
|
||||
public ItemStack getResult()
|
||||
{
|
||||
return this.outputItem;
|
||||
}
|
||||
public ItemStack requiredItem;
|
||||
public ItemStack 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;
|
||||
}
|
||||
|
||||
return this.requiredItem.isItemEqual(testStack);
|
||||
}
|
||||
|
||||
public ItemStack getResult(ItemStack inputItem)
|
||||
{
|
||||
return this.getResult();
|
||||
}
|
||||
|
||||
public ItemStack getResult()
|
||||
{
|
||||
return this.outputItem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 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 boolean isRequiredItemValid(ItemStack testItem)
|
||||
{
|
||||
for(BindingRecipe recipe : bindingRecipes)
|
||||
{
|
||||
if(recipe.doesRequiredItemMatch(testItem))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack getItemForItemAndTier(ItemStack testItem)
|
||||
{
|
||||
for(BindingRecipe recipe : bindingRecipes)
|
||||
{
|
||||
if(recipe.doesRequiredItemMatch(testItem))
|
||||
{
|
||||
return recipe.getResult(testItem).copy();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getIndexForItem(ItemStack testItem)
|
||||
{
|
||||
int i=0;
|
||||
for(BindingRecipe recipe : bindingRecipes)
|
||||
{
|
||||
if(recipe.doesRequiredItemMatch(testItem))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static ItemStack getOutputForIndex(int index)
|
||||
{
|
||||
if(bindingRecipes.size()<=index)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return bindingRecipes.get(index).getResult();
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack getItemForItemAndTier(ItemStack testItem)
|
||||
{
|
||||
for (BindingRecipe recipe : bindingRecipes)
|
||||
{
|
||||
if (recipe.doesRequiredItemMatch(testItem))
|
||||
{
|
||||
return recipe.getResult(testItem).copy();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getIndexForItem(ItemStack testItem)
|
||||
{
|
||||
int i = 0;
|
||||
for (BindingRecipe recipe : bindingRecipes)
|
||||
{
|
||||
if (recipe.doesRequiredItemMatch(testItem))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static ItemStack getOutputForIndex(int index)
|
||||
{
|
||||
if (bindingRecipes.size() <= index)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return bindingRecipes.get(index).getResult();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
public class HarvestRegistry
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HarvestRegistry
|
||||
{
|
||||
public static List<IHarvestHandler> handlerList = new ArrayList();
|
||||
|
||||
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);
|
||||
|
||||
for(IHarvestHandler handler : handlerList)
|
||||
{
|
||||
if(handler.harvestAndPlant(world, xCoord, yCoord, zCoord, block, meta))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public static List<IHarvestHandler> handlerList = new ArrayList();
|
||||
|
||||
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);
|
||||
|
||||
for (IHarvestHandler handler : handlerList)
|
||||
{
|
||||
if (handler.harvestAndPlant(world, xCoord, yCoord, zCoord, block, meta))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@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;
|
||||
|
||||
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) target).iterator();
|
||||
while (itr.hasNext() && !matched) {
|
||||
matched = OreDictionary.itemMatches(itr.next(), slot, 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];
|
||||
}
|
||||
}
|
||||
|
||||
if (!matched) {
|
||||
return false;
|
||||
}
|
||||
} else if (target == null && slot != null) {
|
||||
return 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;
|
||||
|
||||
return true;
|
||||
}
|
||||
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) target).iterator();
|
||||
while (itr.hasNext() && !matched)
|
||||
{
|
||||
matched = OreDictionary.itemMatches(itr.next(), slot, false);
|
||||
}
|
||||
|
||||
public ShapedBloodOrbRecipe setMirrored(boolean mirror) {
|
||||
mirrored = mirror;
|
||||
return this;
|
||||
}
|
||||
if (!matched)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else if (target == null && slot != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Object[] getInput() {
|
||||
return this.input;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public ShapedBloodOrbRecipe setMirrored(boolean mirror)
|
||||
{
|
||||
mirrored = mirror;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Object[] getInput()
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package WayofTime.alchemicalWizardry.api.items.interfaces;
|
||||
|
||||
public interface IBloodOrb
|
||||
public interface IBloodOrb
|
||||
{
|
||||
public int getMaxEssence();
|
||||
|
||||
public int getOrbLevel();
|
||||
public int getMaxEssence();
|
||||
|
||||
public int getOrbLevel();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.api.items.interfaces;
|
||||
|
||||
public interface IHolding
|
||||
public interface IHolding
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package WayofTime.alchemicalWizardry.api.items.interfaces;
|
|||
/**
|
||||
* Implement this interface to have reagent blocks return false on activating them, to allow manipulation of said block
|
||||
*/
|
||||
public interface IReagentManipulator
|
||||
public interface IReagentManipulator
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
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();
|
||||
|
||||
public void setCooldown(int newCooldown);
|
||||
|
@ -21,16 +21,16 @@ public interface IMasterRitualStone extends ISegmentedReagentHandler
|
|||
public void setActive(boolean active);
|
||||
|
||||
public int getDirection();
|
||||
|
||||
|
||||
public World getWorld();
|
||||
|
||||
|
||||
public int getXCoord();
|
||||
|
||||
|
||||
public int getYCoord();
|
||||
|
||||
|
||||
public int getZCoord();
|
||||
|
||||
|
||||
public NBTTagCompound getCustomRitualTag();
|
||||
|
||||
|
||||
public void setCustomRitualTag(NBTTagCompound tag);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.api.rituals;
|
||||
|
||||
public interface IRitualStone
|
||||
public interface IRitualStone
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
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
|
||||
{
|
||||
public abstract void performEffect(IMasterRitualStone ritualStone);
|
||||
|
||||
|
||||
public boolean startRitual(IMasterRitualStone ritualStone, EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void onRitualBroken(IMasterRitualStone ritualStone)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public abstract int getCostPerRefresh();
|
||||
|
@ -27,30 +27,30 @@ public abstract class RitualEffect
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public abstract List<RitualComponent> getRitualComponentList();
|
||||
|
||||
|
||||
public boolean canDrainReagent(IMasterRitualStone ritualStone, Reagent reagent, int amount, boolean doDrain)
|
||||
{
|
||||
if(ritualStone == null || reagent == null || amount == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ReagentStack reagentStack = new ReagentStack(reagent, amount);
|
||||
|
||||
ReagentStack stack = ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, false);
|
||||
|
||||
if(stack != null && stack.amount >= amount)
|
||||
{
|
||||
if(doDrain)
|
||||
{
|
||||
ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
if (ritualStone == null || reagent == null || amount == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ReagentStack reagentStack = new ReagentStack(reagent, amount);
|
||||
|
||||
ReagentStack stack = ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, false);
|
||||
|
||||
if (stack != null && stack.amount >= amount)
|
||||
{
|
||||
if (doDrain)
|
||||
{
|
||||
ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
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;
|
||||
private int actCost;
|
||||
private RitualEffect effect;
|
||||
private String name;
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -32,90 +32,89 @@ public class Rituals
|
|||
ritualMap.put(name, this);
|
||||
this.customRenderer = renderer;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
for (String key : ritualMap.keySet())
|
||||
{
|
||||
if (checkRitualIsValid(world, x, y, z, key))
|
||||
{
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
if (ritualMap.containsKey(ritualID))
|
||||
{
|
||||
Rituals ritual = ritualMap.get(ritualID);
|
||||
if (ritual != null)
|
||||
{
|
||||
return ritual.getCrystalLevel() <= crystalLevel;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkRitualIsValid(World world, int x, int y, int z, String ritualID)
|
||||
|
@ -170,8 +169,8 @@ 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))
|
||||
{
|
||||
return false;
|
||||
|
@ -188,8 +187,8 @@ 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))
|
||||
{
|
||||
return false;
|
||||
|
@ -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());
|
||||
|
||||
if (!(test instanceof IRitualStone))
|
||||
test = world.getBlock(x + rc.getZ(), y + rc.getY(), z - rc.getX());
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
if (ritualMap.containsKey(ritualID))
|
||||
{
|
||||
Rituals ritual = ritualMap.get(ritualID);
|
||||
if (ritual != null)
|
||||
{
|
||||
return ritual.actCost;
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
if (ritualMap.containsKey(ritualID))
|
||||
{
|
||||
Rituals ritual = ritualMap.get(ritualID);
|
||||
if (ritual != null && ritual.effect != null)
|
||||
{
|
||||
return ritual.effect.getInitialCooldown();
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
|
@ -293,53 +292,53 @@ public class Rituals
|
|||
{
|
||||
return this.crystalLevel;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
if (ritualMap.containsKey(ritualID))
|
||||
{
|
||||
Rituals ritual = ritualMap.get(ritualID);
|
||||
if (ritual != null && ritual.effect != null)
|
||||
{
|
||||
return ritual.effect.startRitual(ritualStone, player);
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
if (ritualMap.containsKey(id))
|
||||
{
|
||||
Rituals ritual = ritualMap.get(id);
|
||||
if (ritual != null)
|
||||
{
|
||||
return ritual.getRitualName();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -405,18 +404,18 @@ public class Rituals
|
|||
|
||||
return lastKey;
|
||||
}
|
||||
|
||||
|
||||
public static MRSRenderer getRendererForKey(String ritualID)
|
||||
{
|
||||
if(ritualMap.containsKey(ritualID))
|
||||
{
|
||||
Rituals ritual = ritualMap.get(ritualID);
|
||||
if(ritual != null)
|
||||
{
|
||||
return ritual.getRenderer();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
if (ritualMap.containsKey(ritualID))
|
||||
{
|
||||
Rituals ritual = ritualMap.get(ritualID);
|
||||
if (ritual != null)
|
||||
{
|
||||
return ritual.getRenderer();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 class SoulNetworkHandler
|
||||
{
|
||||
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());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int syphonFromNetwork(ItemStack ist, int damageToBeDone)
|
||||
{
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
|
||||
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);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int syphonFromNetwork(ItemStack ist, int damageToBeDone)
|
||||
{
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
|
||||
{
|
||||
String ownerName = ist.getTagCompound().getString("ownerName");
|
||||
|
||||
return syphonFromNetwork(ownerName, damageToBeDone);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int syphonFromNetwork(String ownerName, int damageToBeDone)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int syphonFromNetwork(String ownerName, int damageToBeDone)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return 0;
|
||||
|
@ -63,34 +60,34 @@ public class SoulNetworkHandler
|
|||
data.markDirty();
|
||||
return damageToBeDone;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Master method used to syphon from the player's network, and will damage them accordingly if they do not have enough LP.
|
||||
* Does not drain on the client side.
|
||||
*
|
||||
* @param ist Owned itemStack
|
||||
* @param player Player using the item
|
||||
* @param 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;
|
||||
}
|
||||
|
||||
int amount = SoulNetworkHandler.syphonFromNetwork(ist, damageToBeDone);
|
||||
|
||||
hurtPlayer(player, damageToBeDone-amount);
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int amount = SoulNetworkHandler.syphonFromNetwork(ist, damageToBeDone);
|
||||
|
||||
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("")))
|
||||
{
|
||||
|
@ -101,8 +98,8 @@ 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)
|
||||
{
|
||||
|
@ -120,10 +117,10 @@ 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;
|
||||
}
|
||||
|
@ -136,13 +133,13 @@ public class SoulNetworkHandler
|
|||
data = new LifeEssenceNetwork(ownerName);
|
||||
world.setItemData(ownerName, data);
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -155,22 +152,22 @@ public class SoulNetworkHandler
|
|||
data = new LifeEssenceNetwork(ownerName);
|
||||
world.setItemData(ownerName, data);
|
||||
}
|
||||
|
||||
|
||||
data.currentEssence = essence;
|
||||
data.markDirty();
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to add to an owner's network up to a maximum value.
|
||||
*
|
||||
* @param ownerName
|
||||
* @param addedEssence
|
||||
* @param maximum
|
||||
* @return amount added to the network
|
||||
*/
|
||||
public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence, int maximum)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -183,21 +180,21 @@ public class SoulNetworkHandler
|
|||
data = new LifeEssenceNetwork(ownerName);
|
||||
world.setItemData(ownerName, data);
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public static void hurtPlayer(EntityPlayer user, int energySyphoned)
|
||||
|
||||
return newEss - currEss;
|
||||
}
|
||||
|
||||
public static void hurtPlayer(EntityPlayer user, int energySyphoned)
|
||||
{
|
||||
if (energySyphoned < 100 && energySyphoned > 0)
|
||||
{
|
||||
|
@ -227,8 +224,8 @@ public class SoulNetworkHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player)
|
||||
|
||||
public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player)
|
||||
{
|
||||
if (item.stackTagCompound == null)
|
||||
{
|
||||
|
@ -253,34 +250,34 @@ public class SoulNetworkHandler
|
|||
item.stackTagCompound.setString("ownerName", ownerName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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");
|
||||
|
||||
|
||||
SoulNetworkHandler.causeNauseaToPlayer(ownerName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void causeNauseaToPlayer(String ownerName)
|
||||
{
|
||||
EntityPlayer entityOwner = SoulNetworkHandler.getPlayerForUsername(ownerName);
|
||||
EntityPlayer entityOwner = SoulNetworkHandler.getPlayerForUsername(ownerName);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraft.world.World;
|
|||
|
||||
public abstract class SummoningHelper
|
||||
{
|
||||
protected int id;
|
||||
protected int id;
|
||||
|
||||
public SummoningHelper(int id)
|
||||
{
|
||||
|
|
|
@ -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,46 +7,51 @@ 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
|
||||
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(player != null && player.isPotionActive(AlchemicalWizardry.customPotionDeaf))
|
||||
{
|
||||
event.setResult(Result.DENY);
|
||||
}
|
||||
}
|
||||
if (Minecraft.getMinecraft() != null)
|
||||
{
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if (player != null && player.isPotionActive(AlchemicalWizardry.customPotionDeaf))
|
||||
{
|
||||
event.setResult(Result.DENY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTick(RenderTickEvent event)
|
||||
{
|
||||
if (event.phase.equals(Phase.START))
|
||||
return;
|
||||
|
||||
|
||||
if (!RenderHelper.onTickInGame(mcClient))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,38 +1,36 @@
|
|||
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;
|
||||
|
||||
|
||||
public boolean enableItemName = false;
|
||||
public boolean showValue = true;
|
||||
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)
|
||||
{
|
||||
this.itemStack = itemStack;
|
||||
|
@ -40,48 +38,47 @@ public class HUDElement
|
|||
this.iconH = iconH;
|
||||
this.padW = padW;
|
||||
this.value = value;
|
||||
|
||||
|
||||
initSize();
|
||||
}
|
||||
|
||||
|
||||
public int width()
|
||||
{
|
||||
return elementW;
|
||||
}
|
||||
|
||||
|
||||
public int height()
|
||||
{
|
||||
return elementH;
|
||||
}
|
||||
|
||||
|
||||
private void initSize()
|
||||
{
|
||||
elementH = enableItemName ? Math.max(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT * 2, iconH) :
|
||||
Math.max(mc.fontRenderer.FONT_HEIGHT, iconH);
|
||||
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
int damage = 1;
|
||||
int maxDamage = 1;
|
||||
|
||||
|
||||
if (showValue)
|
||||
{
|
||||
maxDamage = itemStack.getMaxDamage() + 1;
|
||||
damage = maxDamage - itemStack.getItemDamageForDisplay();
|
||||
|
||||
|
||||
boolean showSpecialValue = true;
|
||||
boolean showValue = false;
|
||||
boolean showPercent = false;
|
||||
|
||||
|
||||
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 : "");
|
||||
|
@ -90,21 +87,21 @@ public class HUDElement
|
|||
(thresholdPercent ? damage * 100 / maxDamage : damage)) +
|
||||
(damage * 100 / maxDamage) + "%";
|
||||
}
|
||||
|
||||
|
||||
itemDamageW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemDamage));
|
||||
elementW = padW + iconW + padW + itemDamageW + offset;
|
||||
|
||||
|
||||
if (enableItemName)
|
||||
{
|
||||
itemName = itemStack.getDisplayName();
|
||||
elementW = padW + iconW + padW +
|
||||
Math.max(mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemName)), itemDamageW);
|
||||
}
|
||||
|
||||
|
||||
itemNameW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void renderToHud(int x, int y)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
@ -112,31 +109,30 @@ public class HUDElement
|
|||
RenderHelper.enableStandardItemLighting();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRenderer.zLevel = 200.0F;
|
||||
|
||||
|
||||
//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);
|
||||
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(itemName + "\247r", x + iconW + padW, y, 0xffffff);
|
||||
mc.fontRenderer.drawStringWithShadow(itemDamage + "\247r", x + iconW + padW,
|
||||
y + (enableItemName ? elementH / 2 : elementH / 4), 0xffffff);
|
||||
|
|
|
@ -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,113 +17,113 @@ 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)
|
||||
{
|
||||
return colorCodes[isLighter ? "0123456789abcdef".indexOf(c) : "0123456789abcdef".indexOf(c) + 16];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
|
||||
* 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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
|
||||
* and filler. The provided ResourceLocation object will be bound using
|
||||
* 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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
|
||||
* and filler. The provided ResourceLocation object will be bound using
|
||||
* 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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
|
||||
* and filler. It is assumed that the desired texture ResourceLocation object has been bound using
|
||||
* 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);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
||||
int fillerWidth = textureWidth - leftBorder - rightBorder;
|
||||
int fillerHeight = textureHeight - topBorder - bottomBorder;
|
||||
int canvasWidth = width - leftBorder - rightBorder;
|
||||
|
@ -133,7 +132,7 @@ public final class HUDUtils
|
|||
int remainderWidth = canvasWidth % fillerWidth;
|
||||
int yPasses = canvasHeight / fillerHeight;
|
||||
int remainderHeight = canvasHeight % fillerHeight;
|
||||
|
||||
|
||||
// Draw Border
|
||||
// Top Left
|
||||
drawTexturedModalRect(x, y, u, v, leftBorder, topBorder, zLevel);
|
||||
|
@ -143,19 +142,19 @@ public final class HUDUtils
|
|||
drawTexturedModalRect(x, y + topBorder + canvasHeight, u, v + topBorder + fillerHeight, leftBorder, bottomBorder, zLevel);
|
||||
// Bottom Right
|
||||
drawTexturedModalRect(x + leftBorder + canvasWidth, y + topBorder + canvasHeight, u + leftBorder + fillerWidth, v + topBorder + fillerHeight, rightBorder, bottomBorder, zLevel);
|
||||
|
||||
|
||||
for (int i = 0; i < xPasses + (remainderWidth > 0 ? 1 : 0); i++)
|
||||
{
|
||||
// Top Border
|
||||
drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y, u + leftBorder, v, (i == xPasses ? remainderWidth : fillerWidth), topBorder, zLevel);
|
||||
// Bottom Border
|
||||
drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y + topBorder + canvasHeight, u + leftBorder, v + topBorder + fillerHeight, (i == xPasses ? remainderWidth : fillerWidth), bottomBorder, zLevel);
|
||||
|
||||
|
||||
// Throw in some filler for good measure
|
||||
for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++)
|
||||
drawTexturedModalRect(x + leftBorder + (i * fillerWidth), y + topBorder + (j * fillerHeight), u + leftBorder, v + topBorder, (i == xPasses ? remainderWidth : fillerWidth), (j == yPasses ? remainderHeight : fillerHeight), zLevel);
|
||||
}
|
||||
|
||||
|
||||
// Side Borders
|
||||
for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++)
|
||||
{
|
||||
|
@ -165,7 +164,7 @@ public final class HUDUtils
|
|||
drawTexturedModalRect(x + leftBorder + canvasWidth, y + topBorder + (j * fillerHeight), u + leftBorder + fillerWidth, v + topBorder, rightBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel)
|
||||
{
|
||||
float var7 = 0.00390625F;
|
||||
|
@ -178,7 +177,7 @@ public final class HUDUtils
|
|||
tessellator.addVertexWithUV((x + 0), (y + 0), zLevel, ((u + 0) * var7), ((v + 0) * var8));
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the specified position.
|
||||
*/
|
||||
|
@ -186,7 +185,7 @@ public final class HUDUtils
|
|||
{
|
||||
renderItemOverlayIntoGUI(fontRenderer, itemStack, x, y, true, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the specified position.
|
||||
*/
|
||||
|
@ -212,16 +211,16 @@ public final class HUDUtils
|
|||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
if (showCount)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
|
||||
if (itemStack.getMaxStackSize() > 1)
|
||||
count = HUDUtils.countInInventory(Minecraft.getMinecraft().thePlayer, itemStack.getItem(), itemStack.getItemDamage());
|
||||
else if (itemStack.getItem().equals(Items.bow))
|
||||
count = HUDUtils.countInInventory(Minecraft.getMinecraft().thePlayer, Items.arrow);
|
||||
|
||||
|
||||
if (count > 1)
|
||||
{
|
||||
String var6 = "" + count;
|
||||
|
@ -234,7 +233,7 @@ public final class HUDUtils
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a quad to the tesselator at the specified position with the set width and height and color. Args: tessellator, x, y, width,
|
||||
* height, color
|
||||
|
@ -249,12 +248,12 @@ public final class HUDUtils
|
|||
tessellator.addVertex((x + width), (y + 0), 0.0D);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
|
||||
public static int countInInventory(EntityPlayer player, Item item)
|
||||
{
|
||||
return countInInventory(player, item, -1);
|
||||
}
|
||||
|
||||
|
||||
public static int countInInventory(EntityPlayer player, Item item, int md)
|
||||
{
|
||||
int count = 0;
|
||||
|
@ -263,7 +262,7 @@ public final class HUDUtils
|
|||
count += player.inventory.mainInventory[i].stackSize;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
public static String stripCtrl(String s)
|
||||
{
|
||||
return s.replaceAll("(?i)\247[0-9a-fklmnor]", "");
|
||||
|
|
|
@ -1,121 +1,117 @@
|
|||
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 class RenderHelper
|
||||
{
|
||||
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;
|
||||
|
||||
public static String listMode = "horizontal";
|
||||
public static String alignMode = "bottomcenter";
|
||||
|
||||
private static ScaledResolution scaledResolution;
|
||||
|
||||
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;
|
||||
|
||||
public static String listMode = "horizontal";
|
||||
public static String alignMode = "bottomcenter";
|
||||
|
||||
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();
|
||||
|
||||
MovingObjectPosition movingobjectposition = mc.objectMouseOver;
|
||||
World world = mc.theWorld;
|
||||
List<HUDElement> elements = new ArrayList();
|
||||
|
||||
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;
|
||||
int z = movingobjectposition.blockZ;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
ItemStack itemStack = ReagentRegistry.getItemForReagent(info.reagent.reagent);
|
||||
|
||||
for (ReagentContainerInfo info : infos)
|
||||
{
|
||||
if (info == null || info.reagent == null || info.reagent.reagent == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack itemStack = ReagentRegistry.getItemForReagent(info.reagent.reagent);
|
||||
|
||||
if (itemStack != null)
|
||||
elements.add(new HUDElement(itemStack, 16, 16, 2, info.reagent.amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
@ -124,7 +120,7 @@ public class RenderHelper
|
|||
else
|
||||
return xOffset;
|
||||
}
|
||||
|
||||
|
||||
private static int getY(int rowCount, int height)
|
||||
{
|
||||
if (alignMode.toLowerCase().contains("middle"))
|
||||
|
@ -136,49 +132,48 @@ public class RenderHelper
|
|||
else
|
||||
return yOffset;
|
||||
}
|
||||
|
||||
private static int getElementsWidth(List<HUDElement> elements)
|
||||
|
||||
private static int getElementsWidth(List<HUDElement> elements)
|
||||
{
|
||||
int r = 0;
|
||||
for (HUDElement he : elements)
|
||||
r += he.width();
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
private static void displayArmorStatus(Minecraft mc)
|
||||
{
|
||||
List<HUDElement> elements = getHUDElements(mc);
|
||||
|
||||
|
||||
if (elements.size() > 0)
|
||||
{
|
||||
int yOffset = enableItemName ? 18 : 16;
|
||||
|
||||
|
||||
if (listMode.equalsIgnoreCase("vertical"))
|
||||
{
|
||||
int yBase = getY(elements.size(), yOffset);
|
||||
|
||||
|
||||
for (HUDElement e : elements)
|
||||
{
|
||||
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);
|
||||
int xBase = getX(totalWidth);
|
||||
int prevX = 0;
|
||||
|
||||
|
||||
for (HUDElement e : elements)
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,138 +28,132 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
|||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.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();
|
||||
public static Map<Integer, List<CoordAndRange>> forceSpawnMap = new HashMap();
|
||||
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
String respawnRitual = "AW028SpawnWard";
|
||||
|
||||
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(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;
|
||||
}
|
||||
|
||||
String forceSpawnRitual = "AW029VeilOfEvil";
|
||||
|
||||
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(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 (!(event.entityLiving instanceof EntityMob))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String respawnRitual = "AW028SpawnWard";
|
||||
|
||||
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 (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;
|
||||
}
|
||||
|
||||
String forceSpawnRitual = "AW029VeilOfEvil";
|
||||
|
||||
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 (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
|
||||
public void onLivingJumpEvent(LivingJumpEvent event)
|
||||
{
|
||||
|
@ -165,21 +161,21 @@ public class AlchemicalWizardryEventHooks
|
|||
{
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier();
|
||||
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
|
||||
|
@ -198,18 +194,18 @@ public class AlchemicalWizardryEventHooks
|
|||
((EntityLivingBase) entityAttacking).attackEntityFrom(DamageSource.generic, damageRecieve);
|
||||
}
|
||||
}
|
||||
|
||||
if(entityAttacked.isPotionActive(AlchemicalWizardry.customPotionFlameCloak))
|
||||
|
||||
if (entityAttacked.isPotionActive(AlchemicalWizardry.customPotionFlameCloak))
|
||||
{
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak).getAmplifier();
|
||||
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,7 +223,7 @@ public class AlchemicalWizardryEventHooks
|
|||
// ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, event.player.capabilities, Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"});
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityUpdate(LivingUpdateEvent event)
|
||||
{
|
||||
|
@ -235,17 +231,17 @@ public class AlchemicalWizardryEventHooks
|
|||
double x = entityLiving.posX;
|
||||
double y = entityLiving.posY;
|
||||
double z = entityLiving.posZ;
|
||||
|
||||
Vec3 blockVector = SpellHelper.getEntityBlockVector(entityLiving);
|
||||
int xPos = (int)(blockVector.xCoord);
|
||||
int yPos = (int)(blockVector.yCoord);
|
||||
int zPos = (int)(blockVector.zCoord);
|
||||
|
||||
if(entityLiving instanceof EntityPlayer)
|
||||
Vec3 blockVector = SpellHelper.getEntityBlockVector(entityLiving);
|
||||
int xPos = (int) (blockVector.xCoord);
|
||||
int yPos = (int) (blockVector.yCoord);
|
||||
int zPos = (int) (blockVector.zCoord);
|
||||
|
||||
if (entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, ((EntityPlayer)event.entityLiving).capabilities, Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"});
|
||||
ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, ((EntityPlayer) event.entityLiving).capabilities, Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"});
|
||||
}
|
||||
|
||||
|
||||
if (entityLiving instanceof EntityPlayer && entityLiving.worldObj.isRemote)
|
||||
{
|
||||
EntityPlayer entityPlayer = (EntityPlayer) entityLiving;
|
||||
|
@ -266,9 +262,9 @@ public class AlchemicalWizardryEventHooks
|
|||
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionFeatherFall))
|
||||
{
|
||||
event.entityLiving.fallDistance = 0;
|
||||
event.entityLiving.fallDistance = 0;
|
||||
}
|
||||
|
||||
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionDrowning))
|
||||
{
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionDrowning).getAmplifier();
|
||||
|
@ -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();
|
||||
|
@ -325,7 +321,7 @@ public class AlchemicalWizardryEventHooks
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Entity throwingEntity = null;
|
||||
|
||||
if (projectile instanceof EntityArrow)
|
||||
|
@ -334,29 +330,29 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
double curVel = Math.sqrt(delX * delX + delY * delY + delZ * delZ);
|
||||
|
||||
|
||||
delX /= curVel;
|
||||
delY /= curVel;
|
||||
delZ /= curVel;
|
||||
|
@ -376,7 +372,6 @@ public class AlchemicalWizardryEventHooks
|
|||
String ownerName = SpellHelper.getUsername(entityPlayer);
|
||||
playerFlightBuff.put(ownerName, true);
|
||||
entityPlayer.capabilities.allowFlying = true;
|
||||
//entityPlayer.sendPlayerAbilities();
|
||||
}
|
||||
} else
|
||||
{
|
||||
|
@ -403,75 +398,75 @@ public class AlchemicalWizardryEventHooks
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlameCloak))
|
||||
|
||||
if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlameCloak))
|
||||
{
|
||||
entityLiving.worldObj.spawnParticle("flame", x+SpellHelper.gaussian(1),y-1.3+SpellHelper.gaussian(0.3),z+SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
|
||||
entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak).getAmplifier();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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))
|
||||
{
|
||||
entityLiving.worldObj.spawnParticle("flame", x+SpellHelper.gaussian(1),y-1.3+SpellHelper.gaussian(0.3),z+SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionHeavyHeart).getAmplifier();
|
||||
double decrease = 0.025*(i+1);
|
||||
|
||||
if(entityLiving.motionY>-0.9)
|
||||
{
|
||||
entityLiving.motionY-=decrease;
|
||||
}
|
||||
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.isPotionActive(AlchemicalWizardry.customPotionFireFuse))
|
||||
|
||||
if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart))
|
||||
{
|
||||
entityLiving.worldObj.spawnParticle("flame", x+SpellHelper.gaussian(1),y-1.3+SpellHelper.gaussian(0.3),z+SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionHeavyHeart).getAmplifier();
|
||||
double decrease = 0.025 * (i + 1);
|
||||
|
||||
if (entityLiving.motionY > -0.9)
|
||||
{
|
||||
entityLiving.motionY -= decrease;
|
||||
}
|
||||
}
|
||||
|
||||
if (entityLiving.isPotionActive(AlchemicalWizardry.customPotionFireFuse))
|
||||
{
|
||||
entityLiving.worldObj.spawnParticle("flame", x + SpellHelper.gaussian(1), y - 1.3 + SpellHelper.gaussian(0.3), z + SpellHelper.gaussian(1), 0, 0.06d, 0);
|
||||
|
||||
int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getAmplifier();
|
||||
int radius = r+1;
|
||||
|
||||
if(entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getDuration()<=2)
|
||||
{
|
||||
entityLiving.worldObj.createExplosion(null, x, y, z, radius, false);
|
||||
}
|
||||
}
|
||||
int radius = r + 1;
|
||||
|
||||
if (entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getDuration() <= 2)
|
||||
{
|
||||
entityLiving.worldObj.createExplosion(null, x, y, z, radius, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
@ -66,7 +62,7 @@ public class AlchemicalWizardryFuelHandler implements IFuelHandler
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -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()
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
public class CoordAndRange
|
||||
public class CoordAndRange
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
public class EntityAIFly
|
||||
{
|
||||
}
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -3,36 +3,36 @@ package WayofTime.alchemicalWizardry.common;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
|
||||
public class Int3
|
||||
public class Int3
|
||||
{
|
||||
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 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);
|
||||
|
||||
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;
|
||||
}
|
||||
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 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);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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;
|
||||
// }
|
||||
}
|
|
@ -2,26 +2,26 @@ package WayofTime.alchemicalWizardry.common.alchemy;
|
|||
|
||||
import net.minecraft.potion.Potion;
|
||||
|
||||
public class CombinedPotionComponent
|
||||
public class CombinedPotionComponent
|
||||
{
|
||||
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 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 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 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 class CombinedPotionRegistry
|
||||
{
|
||||
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 boolean isRecipeValid(Potion pot1, Potion pot2)
|
||||
{
|
||||
for(CombinedPotionComponent recipe : potionList)
|
||||
{
|
||||
if(recipe.isRecipeValid(pot1, pot2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isRecipeValid(int pot1, int pot2)
|
||||
{
|
||||
for(CombinedPotionComponent recipe : potionList)
|
||||
{
|
||||
if(recipe.isRecipeValid(pot1, pot2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Potion getPotion(Potion pot1, Potion pot2)
|
||||
{
|
||||
for(CombinedPotionComponent recipe : potionList)
|
||||
{
|
||||
if(recipe.isRecipeValid(pot1, pot2))
|
||||
{
|
||||
return recipe.result;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Potion getPotion(int pot1, int pot2)
|
||||
{
|
||||
for(CombinedPotionComponent recipe : potionList)
|
||||
{
|
||||
if(recipe.isRecipeValid(pot1, pot2))
|
||||
{
|
||||
return recipe.result;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
boolean isDone = false;
|
||||
|
||||
for(AlchemyPotionHelper helper1 : list)
|
||||
{
|
||||
if(isDone)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for(int i=0; i<list.size(); i++)
|
||||
{
|
||||
if(isDone)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
AlchemyPotionHelper helper2 = list.get(i);
|
||||
|
||||
PotionEffect potEffect = getResultantPotion(helper1, helper2);
|
||||
|
||||
if(potEffect != null)
|
||||
{
|
||||
AlchemyPotionHelper potHelper = new AlchemyPotionHelper(potEffect.getPotionID(), potEffect.getDuration(), 0, potEffect.getAmplifier());
|
||||
|
||||
list.remove(helper1);
|
||||
list.remove(helper2);
|
||||
|
||||
list.add(potHelper);
|
||||
|
||||
isDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isDone)
|
||||
{
|
||||
AlchemyFlask.setEffects(stack, list);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
for(AlchemyPotionHelper helper1 : list)
|
||||
{
|
||||
for(AlchemyPotionHelper helper2 : list)
|
||||
{
|
||||
int pot1 = helper1.getPotionID();
|
||||
int pot2 = helper2.getPotionID();
|
||||
|
||||
if(isRecipeValid(pot1, pot2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static PotionEffect getResultantPotion(AlchemyPotionHelper potE1, AlchemyPotionHelper potE2)
|
||||
{
|
||||
if(potE1 == null || potE2 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
Potion pot = getPotion(pot1, pot2);
|
||||
|
||||
return new PotionEffect(pot.id, duration, amplifier);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
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 boolean isRecipeValid(Potion pot1, Potion pot2)
|
||||
{
|
||||
for (CombinedPotionComponent recipe : potionList)
|
||||
{
|
||||
if (recipe.isRecipeValid(pot1, pot2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isRecipeValid(int pot1, int pot2)
|
||||
{
|
||||
for (CombinedPotionComponent recipe : potionList)
|
||||
{
|
||||
if (recipe.isRecipeValid(pot1, pot2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Potion getPotion(Potion pot1, Potion pot2)
|
||||
{
|
||||
for (CombinedPotionComponent recipe : potionList)
|
||||
{
|
||||
if (recipe.isRecipeValid(pot1, pot2))
|
||||
{
|
||||
return recipe.result;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Potion getPotion(int pot1, int pot2)
|
||||
{
|
||||
for (CombinedPotionComponent recipe : potionList)
|
||||
{
|
||||
if (recipe.isRecipeValid(pot1, pot2))
|
||||
{
|
||||
return recipe.result;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
boolean isDone = false;
|
||||
|
||||
for (AlchemyPotionHelper helper1 : list)
|
||||
{
|
||||
if (isDone)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.size(); i++)
|
||||
{
|
||||
if (isDone)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
AlchemyPotionHelper helper2 = list.get(i);
|
||||
|
||||
PotionEffect potEffect = getResultantPotion(helper1, helper2);
|
||||
|
||||
if (potEffect != null)
|
||||
{
|
||||
AlchemyPotionHelper potHelper = new AlchemyPotionHelper(potEffect.getPotionID(), potEffect.getDuration(), 0, potEffect.getAmplifier());
|
||||
|
||||
list.remove(helper1);
|
||||
list.remove(helper2);
|
||||
|
||||
list.add(potHelper);
|
||||
|
||||
isDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isDone)
|
||||
{
|
||||
AlchemyFlask.setEffects(stack, list);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
for (AlchemyPotionHelper helper1 : list)
|
||||
{
|
||||
for (AlchemyPotionHelper helper2 : list)
|
||||
{
|
||||
int pot1 = helper1.getPotionID();
|
||||
int pot2 = helper2.getPotionID();
|
||||
|
||||
if (isRecipeValid(pot1, pot2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static PotionEffect getResultantPotion(AlchemyPotionHelper potE1, AlchemyPotionHelper potE2)
|
||||
{
|
||||
if (potE1 == null || potE2 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
Potion pot = getPotion(pot1, pot2);
|
||||
|
||||
return new PotionEffect(pot.id, duration, amplifier);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package WayofTime.alchemicalWizardry.common.alchemy;
|
||||
|
||||
public interface ICombinationalCatalyst
|
||||
public interface ICombinationalCatalyst
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEAlchemicCalcinator();
|
||||
}
|
||||
|
||||
@Override
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("alchemicCalcinator");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEAlchemicCalcinator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
|
@ -57,13 +57,13 @@ public class BlockAlchemicCalcinator extends BlockContainer
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
|
@ -110,11 +110,11 @@ public class BlockAlchemicCalcinator extends BlockContainer
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEAlchemicCalcinator tileEntity = (TEAlchemicCalcinator) world.getTileEntity(x, y, z);
|
||||
TEAlchemicCalcinator tileEntity = (TEAlchemicCalcinator) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
|
@ -122,45 +122,44 @@ public class BlockAlchemicCalcinator extends BlockContainer
|
|||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
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 IReagentManipulator)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -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,29 +60,23 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@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,24 +139,23 @@ 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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @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
|
||||
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);
|
||||
|
||||
if (tile instanceof TEBellJar)
|
||||
{
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag != null)
|
||||
{
|
||||
((TEBellJar) tile).readTankNBTOnPlace(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEBellJar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
|
@ -108,50 +67,49 @@ public class BlockBelljar extends BlockContainer
|
|||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@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();
|
||||
|
||||
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;
|
||||
|
||||
list.add(drop);
|
||||
}
|
||||
|
||||
return list;
|
||||
ArrayList<ItemStack> list = new ArrayList();
|
||||
|
||||
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;
|
||||
|
||||
list.add(drop);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return new TEDemonPortal();
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
TEDemonPortal tileEntity = (TEDemonPortal) world.getTileEntity(x, y, z);
|
||||
|
||||
tileEntity.rightClickBlock(player, side);
|
||||
|
||||
return false;
|
||||
if (world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TEDemonPortal tileEntity = (TEDemonPortal) world.getTileEntity(x, y, z);
|
||||
|
||||
tileEntity.rightClickBlock(player, side);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
@ -32,17 +31,17 @@ public class BlockMasterStone extends BlockContainer
|
|||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:MasterStone");
|
||||
}
|
||||
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
super.onBlockHarvested(world, x, y, z, meta, player);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TEMasterStone)
|
||||
{
|
||||
((TEMasterStone) tile).useOnRitualBroken();
|
||||
}
|
||||
|
||||
super.onBlockHarvested(world, x, y, z, meta, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,49 +1,34 @@
|
|||
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
|
||||
{
|
||||
{
|
||||
public BlockOrientable()
|
||||
{
|
||||
super(Material.rock);
|
||||
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)
|
||||
{
|
||||
return new TEOrientable();
|
||||
}
|
||||
|
||||
|
||||
@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,137 +39,167 @@ public class BlockOrientable extends BlockContainer
|
|||
|
||||
if (tile instanceof TEOrientable)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
newTile.setOutputDirection(ForgeDirection.getOrientation(nextSide));
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
newTile.setOutputDirection(ForgeDirection.getOrientation(nextSide));
|
||||
}
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return metadata;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
@Override
|
||||
this.setBlockName("blockReagentConduit");
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@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 isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@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 renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return new TESchematicSaver();
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
TESchematicSaver tileEntity = (TESchematicSaver) world.getTileEntity(x, y, z);
|
||||
|
||||
tileEntity.rightClickBlock(player, side);
|
||||
|
||||
return false;
|
||||
if (world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TESchematicSaver tileEntity = (TESchematicSaver) world.getTileEntity(x, y, z);
|
||||
|
||||
tileEntity.rightClickBlock(player, side);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -54,22 +53,22 @@ public class BlockSpectralContainer extends BlockContainer
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAir(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return new TESpectralContainer();
|
||||
}
|
||||
@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 TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return new TESpectralContainer();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 class BlockSpellEffect extends BlockOrientable
|
||||
{
|
||||
public BlockSpellEffect()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellEffect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockSpellEffect()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellEffect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESpellEffectBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
|
@ -44,16 +44,16 @@ 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);
|
||||
|
|
|
@ -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 class BlockSpellEnhancement extends BlockOrientable
|
||||
{
|
||||
public BlockSpellEnhancement()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellEnhancement");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockSpellEnhancement()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellEnhancement");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESpellEnhancementBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
|
@ -46,16 +44,16 @@ 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);
|
||||
|
|
|
@ -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 class BlockSpellModifier extends BlockOrientable
|
||||
{
|
||||
public BlockSpellModifier()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellModifier");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockSpellModifier()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellModifier");
|
||||
}
|
||||
|
||||
@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 renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
public class BlockSpellParadigm extends BlockOrientable
|
||||
import java.util.List;
|
||||
|
||||
public class BlockSpellParadigm extends BlockOrientable
|
||||
{
|
||||
public static final float minPos = (3f/16f);
|
||||
public static final float maxPos = (13f/16f);
|
||||
|
||||
public BlockSpellParadigm()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellParadigm");
|
||||
}
|
||||
|
||||
@Override
|
||||
public static final float minPos = (3f / 16f);
|
||||
public static final float maxPos = (13f / 16f);
|
||||
|
||||
public BlockSpellParadigm()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellParadigm");
|
||||
}
|
||||
|
||||
@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)
|
||||
|
@ -52,14 +50,14 @@ public class BlockSpellParadigm extends BlockOrientable
|
|||
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)
|
||||
{
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
if(stack != null && stack.getItem() instanceof ItemComplexSpellCrystal)
|
||||
{
|
||||
|
||||
@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.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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return super.onBlockActivated(world, x, y, z, player, side, what, these, are);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
@ -59,9 +57,9 @@ public class BloodRune extends Block
|
|||
|
||||
case 3: //Orb Capacity rune
|
||||
return 7;
|
||||
|
||||
|
||||
case 4: //Better Capacity rune
|
||||
return 8;
|
||||
return 8;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -104,9 +102,9 @@ public class BloodRune extends Block
|
|||
|
||||
case 3:
|
||||
return this.orbCapacityRuneIcon;
|
||||
|
||||
|
||||
case 4:
|
||||
return this.betterCapacityRuneIcon;
|
||||
return this.betterCapacityRuneIcon;
|
||||
|
||||
default:
|
||||
return blockIcon;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -52,7 +44,7 @@ public class SpectralBlock extends BlockContainer
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
|
||||
{
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -57,10 +57,10 @@ public class AltarUpgradeComponent
|
|||
{
|
||||
orbCapacitiveUpgrades++;
|
||||
}
|
||||
|
||||
|
||||
public void addBetterCapacitiveUpgrade()
|
||||
{
|
||||
betterCapacitiveUpgrades++;
|
||||
betterCapacitiveUpgrades++;
|
||||
}
|
||||
|
||||
public int getSpeedUpgrades()
|
||||
|
@ -97,9 +97,9 @@ public class AltarUpgradeComponent
|
|||
{
|
||||
return this.orbCapacitiveUpgrades;
|
||||
}
|
||||
|
||||
|
||||
public int getBetterCapacitiveUpgrades()
|
||||
{
|
||||
return this.betterCapacitiveUpgrades;
|
||||
return this.betterCapacitiveUpgrades;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
@ -189,10 +188,10 @@ public class UpgradedAltars
|
|||
case 7:
|
||||
upgrades.addorbCapacitiveUpgrade();
|
||||
break;
|
||||
|
||||
|
||||
case 8:
|
||||
upgrades.addBetterCapacitiveUpgrade();
|
||||
break;
|
||||
upgrades.addBetterCapacitiveUpgrade();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
public class BlockSet
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockSet
|
||||
{
|
||||
protected String blockid;
|
||||
protected int[] metadata;
|
||||
protected List<Int3> positions;
|
||||
|
||||
public BlockSet()
|
||||
{
|
||||
this(Blocks.stone);
|
||||
}
|
||||
|
||||
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, 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Int3> getPositions()
|
||||
{
|
||||
return positions;
|
||||
}
|
||||
|
||||
public void addPositionToBlock(int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
positions.add(new Int3(xOffset, yOffset, zOffset));
|
||||
}
|
||||
|
||||
public Block getBlock()
|
||||
{
|
||||
return this.getBlockForString(blockid);
|
||||
}
|
||||
|
||||
public static String getPairedIdForBlock(Block block)
|
||||
{
|
||||
UniqueIdentifier un = GameRegistry.findUniqueIdentifierFor(block);
|
||||
String name = "";
|
||||
|
||||
if(un != null)
|
||||
{
|
||||
name = un.modId + ":" + un.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 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;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
protected String blockid;
|
||||
protected int[] metadata;
|
||||
protected List<Int3> positions;
|
||||
|
||||
public BlockSet()
|
||||
{
|
||||
this(Blocks.stone);
|
||||
}
|
||||
|
||||
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, 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Int3> getPositions()
|
||||
{
|
||||
return positions;
|
||||
}
|
||||
|
||||
public void addPositionToBlock(int xOffset, int yOffset, int zOffset)
|
||||
{
|
||||
positions.add(new Int3(xOffset, yOffset, zOffset));
|
||||
}
|
||||
|
||||
public Block getBlock()
|
||||
{
|
||||
return this.getBlockForString(blockid);
|
||||
}
|
||||
|
||||
public static String getPairedIdForBlock(Block block)
|
||||
{
|
||||
UniqueIdentifier un = GameRegistry.findUniqueIdentifierFor(block);
|
||||
String name = "";
|
||||
|
||||
if (un != null)
|
||||
{
|
||||
name = un.modId + ":" + un.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 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;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -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 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 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 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);
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
return holder;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 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(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;
|
||||
}
|
||||
}
|
||||
|
||||
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 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);
|
||||
|
||||
holder.setGridSpace(gridX, gridZ, new GridSpace(GridSpace.HOUSE, 0));
|
||||
}
|
||||
}
|
||||
|
||||
return holder;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMinY()
|
||||
{
|
||||
int min = 0;
|
||||
for (BlockSet set : blockList)
|
||||
{
|
||||
for (Int3 pos : set.getPositions())
|
||||
{
|
||||
if (pos.yCoord < min)
|
||||
{
|
||||
min = pos.yCoord;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -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 class DemonBuilding
|
||||
{
|
||||
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 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 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 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:
|
||||
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
switch(sideOfRoad)
|
||||
{
|
||||
case SOUTH:
|
||||
z++;
|
||||
break;
|
||||
case EAST:
|
||||
x++;
|
||||
break;
|
||||
case WEST:
|
||||
x--;
|
||||
break;
|
||||
default:
|
||||
z--;
|
||||
break;
|
||||
}
|
||||
|
||||
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 int getNumberOfGridSpaces()
|
||||
{
|
||||
return area.getNumberOfGridSpaces();
|
||||
}
|
||||
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 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 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 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:
|
||||
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
switch (sideOfRoad)
|
||||
{
|
||||
case SOUTH:
|
||||
z++;
|
||||
break;
|
||||
case EAST:
|
||||
x++;
|
||||
break;
|
||||
case WEST:
|
||||
x--;
|
||||
break;
|
||||
default:
|
||||
z--;
|
||||
break;
|
||||
}
|
||||
|
||||
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 int getNumberOfGridSpaces()
|
||||
{
|
||||
return area.getNumberOfGridSpaces();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,21 +2,21 @@ package WayofTime.alchemicalWizardry.common.demonVillage;
|
|||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DemonCrosspath
|
||||
public class DemonCrosspath
|
||||
{
|
||||
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 void createCrosspath(World world)
|
||||
{
|
||||
|
||||
}
|
||||
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 void createCrosspath(World world)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 class DemonVillagePath
|
||||
{
|
||||
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 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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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(!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;
|
||||
|
||||
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;
|
||||
|
||||
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(!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);
|
||||
}
|
||||
|
||||
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 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 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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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 (!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;
|
||||
|
||||
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;
|
||||
|
||||
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 (!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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,76 +2,76 @@ package WayofTime.alchemicalWizardry.common.demonVillage;
|
|||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class GridSpace
|
||||
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;
|
||||
|
||||
private int yLevel;
|
||||
private int type;
|
||||
|
||||
public GridSpace()
|
||||
{
|
||||
this(EMPTY, -1);
|
||||
}
|
||||
|
||||
public GridSpace(int type, int yLevel)
|
||||
{
|
||||
this.type = type;
|
||||
this.yLevel = yLevel;
|
||||
}
|
||||
|
||||
public int getGridType()
|
||||
{
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setGridType(int type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getYLevel()
|
||||
{
|
||||
return this.yLevel;
|
||||
}
|
||||
|
||||
public void setYLevel(int yLevel)
|
||||
{
|
||||
this.yLevel = yLevel;
|
||||
}
|
||||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return type == this.EMPTY;
|
||||
}
|
||||
|
||||
public static GridSpace getGridFromTag(NBTTagCompound tag)
|
||||
{
|
||||
return new GridSpace(tag.getInteger("type"), tag.getInteger("yLevel"));
|
||||
}
|
||||
|
||||
public NBTTagCompound getTag()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
||||
tag.setInteger("type", type);
|
||||
tag.setInteger("yLevel", yLevel);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
public boolean isRoadSegment()
|
||||
{
|
||||
return type == this.ROAD || type == this.CROSSROAD;
|
||||
}
|
||||
|
||||
public boolean isBuilding()
|
||||
{
|
||||
return type == this.HOUSE;
|
||||
}
|
||||
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;
|
||||
|
||||
public GridSpace()
|
||||
{
|
||||
this(EMPTY, -1);
|
||||
}
|
||||
|
||||
public GridSpace(int type, int yLevel)
|
||||
{
|
||||
this.type = type;
|
||||
this.yLevel = yLevel;
|
||||
}
|
||||
|
||||
public int getGridType()
|
||||
{
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setGridType(int type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getYLevel()
|
||||
{
|
||||
return this.yLevel;
|
||||
}
|
||||
|
||||
public void setYLevel(int yLevel)
|
||||
{
|
||||
this.yLevel = yLevel;
|
||||
}
|
||||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return type == this.EMPTY;
|
||||
}
|
||||
|
||||
public static GridSpace getGridFromTag(NBTTagCompound tag)
|
||||
{
|
||||
return new GridSpace(tag.getInteger("type"), tag.getInteger("yLevel"));
|
||||
}
|
||||
|
||||
public NBTTagCompound getTag()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
||||
tag.setInteger("type", type);
|
||||
tag.setInteger("yLevel", yLevel);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
public boolean isRoadSegment()
|
||||
{
|
||||
return type == this.ROAD || type == this.CROSSROAD;
|
||||
}
|
||||
|
||||
public boolean isBuilding()
|
||||
{
|
||||
return type == this.HOUSE;
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue