Testing the creation of hell
This commit is contained in:
parent
796e75b1f9
commit
a2b006105e
2587 changed files with 0 additions and 129617 deletions
1104
src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java
Normal file
1104
src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,147 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: Pokefenn
|
||||
* Date: 17/01/14
|
||||
* Time: 19:50
|
||||
*/
|
||||
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>();
|
||||
|
||||
public static Configuration config;
|
||||
public static final String CATEGORY_GAMEPLAY = "gameplay";
|
||||
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
|
||||
config = new Configuration(configFile);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
config.load();
|
||||
|
||||
AlchemicalWizardry.standardBindingAgentDungeonChance = config.get("Dungeon Loot Chances", "standardBindingAgent", 30).getInt();
|
||||
AlchemicalWizardry.mundanePowerCatalystDungeonChance = config.get("Dungeon Loot Chances", "mundanePowerCatalyst", 20).getInt();
|
||||
AlchemicalWizardry.averagePowerCatalystDungeonChance = config.get("Dungeon Loot Chances", "averagePowerCatalyst", 10).getInt();
|
||||
AlchemicalWizardry.greaterPowerCatalystDungeonChance = config.get("Dungeon Loot Chances", "greaterPowerCatalyst", 05).getInt();
|
||||
AlchemicalWizardry.mundaneLengtheningCatalystDungeonChance = config.get("Dungeon Loot Chances", "mundaneLengtheningCatalyst", 20).getInt();
|
||||
AlchemicalWizardry.averageLengtheningCatalystDungeonChance = config.get("Dungeon Loot Chances", "averageLengtheningCatalyst", 10).getInt();
|
||||
AlchemicalWizardry.greaterLengtheningCatalystDungeonChance = config.get("Dungeon Loot Chances", "greaterLengtheningCatalyst", 05).getInt();
|
||||
AlchemicalWizardry.customPotionDrowningID = config.get("Potion ID", "Drowning", 100).getInt();
|
||||
AlchemicalWizardry.customPotionBoostID = config.get("Potion ID", "Boost", 101).getInt();
|
||||
AlchemicalWizardry.customPotionProjProtID = config.get("Potion ID", "ProjProt", 102).getInt();
|
||||
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.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();
|
||||
AlchemicalWizardry.diamondMeteorRadius = config.get("meteor", "diamondMeteorRadius", 5).getInt();
|
||||
AlchemicalWizardry.stoneMeteorArray = config.get("meteor", "stoneBlockMeteor", new String[]{"oreCoal", "150", "oreApatite", "50", "oreIron", "50"}).getStringList();
|
||||
AlchemicalWizardry.stoneMeteorRadius = config.get("meteor", "stoneMeteorRadius", 16).getInt();
|
||||
AlchemicalWizardry.ironBlockMeteorArray = config.get("meteor", "ironBlockMeteor", new String[]{"oreIron", "400", "oreGold", "30", "oreCopper", "200", "oreTin", "140", "oreSilver", "70", "oreLead", "80", "oreLapis", "60", "oreRedstone", "100"}).getStringList();
|
||||
AlchemicalWizardry.ironBlockMeteorRadius = config.get("meteor", "ironBlockMeteorRadius", 7).getInt();
|
||||
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.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)
|
||||
{
|
||||
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");
|
||||
|
||||
} finally
|
||||
{
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String categoryName, String propertyName, String newValue)
|
||||
{
|
||||
|
||||
config.load();
|
||||
if (config.getCategoryNames().contains(categoryName))
|
||||
{
|
||||
if (config.getCategory(categoryName).containsKey(propertyName))
|
||||
{
|
||||
config.getCategory(categoryName).get(propertyName).set(newValue);
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
}
|
133
src/main/java/WayofTime/alchemicalWizardry/ModBlocks.java
Normal file
133
src/main/java/WayofTime/alchemicalWizardry/ModBlocks.java
Normal file
|
@ -0,0 +1,133 @@
|
|||
package WayofTime.alchemicalWizardry;
|
||||
|
||||
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.
|
||||
* User: Pokefenn
|
||||
* Date: 17/01/14
|
||||
* Time: 19:48
|
||||
*/
|
||||
public class ModBlocks
|
||||
{
|
||||
|
||||
public static Block testingBlock;
|
||||
public static Block bloodStoneBrick;
|
||||
public static Block largeBloodStoneBrick;
|
||||
public static BlockAltar blockAltar;
|
||||
public static BloodRune bloodRune;
|
||||
public static SpeedRune speedRune;
|
||||
public static EfficiencyRune efficiencyRune;
|
||||
public static RuneOfSacrifice runeOfSacrifice;
|
||||
public static RuneOfSelfSacrifice runeOfSelfSacrifice;
|
||||
public static Block blockMasterStone;
|
||||
public static Block ritualStone;
|
||||
public static Block imperfectRitualStone;
|
||||
public static Block bloodSocket;
|
||||
public static Block emptySocket;
|
||||
public static Block armourForge;
|
||||
public static Block blockWritingTable;
|
||||
public static Block blockHomHeart;
|
||||
public static Block blockPedestal;
|
||||
public static Block blockPlinth;
|
||||
public static Block blockLifeEssence;
|
||||
public static Block blockTeleposer;
|
||||
public static Block spectralBlock;
|
||||
public static Block blockConduit;
|
||||
public static Block blockBloodLight;
|
||||
public static Block blockSpellEffect;
|
||||
public static Block blockSpellParadigm;
|
||||
public static Block blockSpellModifier;
|
||||
public static Block blockSpellEnhancement;
|
||||
public static Block blockSpectralContainer;
|
||||
public static Block blockBuildingSchematicSaver;
|
||||
public static Block blockDemonPortal;
|
||||
public static Block blockReagentConduit;
|
||||
public static Block blockAlchemicCalcinator;
|
||||
public static Block blockCrystalBelljar;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
blockAltar = new BlockAltar();
|
||||
bloodRune = new BloodRune();
|
||||
speedRune = new SpeedRune();
|
||||
efficiencyRune = new EfficiencyRune();
|
||||
runeOfSacrifice = new RuneOfSacrifice();
|
||||
runeOfSelfSacrifice = new RuneOfSelfSacrifice();
|
||||
blockTeleposer = new BlockTeleposer();
|
||||
spectralBlock = new SpectralBlock();
|
||||
ritualStone = new RitualStone();
|
||||
blockMasterStone = new BlockMasterStone();
|
||||
imperfectRitualStone = new ImperfectRitualStone();
|
||||
bloodSocket = new BlockSocket();
|
||||
armourForge = new ArmourForge();
|
||||
emptySocket = new EmptySocket();
|
||||
largeBloodStoneBrick = new LargeBloodStoneBrick();
|
||||
bloodStoneBrick = new BloodStoneBrick();
|
||||
blockWritingTable = new BlockWritingTable();
|
||||
blockHomHeart = new BlockHomHeart();
|
||||
blockPedestal = new BlockPedestal();
|
||||
blockPlinth = new BlockPlinth();
|
||||
blockConduit = new BlockConduit();
|
||||
blockBloodLight = new BlockBloodLightSource();
|
||||
blockSpellEffect = new BlockSpellEffect();
|
||||
blockSpellParadigm = new BlockSpellParadigm();
|
||||
blockSpellModifier = new BlockSpellModifier();
|
||||
blockSpellEnhancement = new BlockSpellEnhancement();
|
||||
blockSpectralContainer = new BlockSpectralContainer();
|
||||
blockDemonPortal = new BlockDemonPortal();
|
||||
blockBuildingSchematicSaver = new BlockSchematicSaver();
|
||||
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.blockLifeEssence, "lifeEssence");
|
||||
GameRegistry.registerBlock(ModBlocks.speedRune, "speedRune");
|
||||
GameRegistry.registerBlock(ModBlocks.efficiencyRune, "efficiencyRune");
|
||||
GameRegistry.registerBlock(ModBlocks.runeOfSacrifice, "runeOfSacrifice");
|
||||
GameRegistry.registerBlock(ModBlocks.runeOfSelfSacrifice, "runeOfSelfSacrifice");
|
||||
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.emptySocket, "emptySocket");
|
||||
GameRegistry.registerBlock(ModBlocks.bloodStoneBrick, "bloodStoneBrick");
|
||||
GameRegistry.registerBlock(ModBlocks.largeBloodStoneBrick, "largeBloodStoneBrick");
|
||||
GameRegistry.registerBlock(ModBlocks.blockWritingTable, "blockWritingTable");
|
||||
GameRegistry.registerBlock(ModBlocks.blockHomHeart, "blockHomHeart");
|
||||
GameRegistry.registerBlock(ModBlocks.blockPedestal, "blockPedestal");
|
||||
GameRegistry.registerBlock(ModBlocks.blockPlinth, "blockPlinth");
|
||||
GameRegistry.registerBlock(ModBlocks.blockTeleposer, "blockTeleposer");
|
||||
GameRegistry.registerBlock(ModBlocks.spectralBlock, "spectralBlock");
|
||||
GameRegistry.registerBlock(ModBlocks.blockBloodLight, "bloodLight");
|
||||
|
||||
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.blockSpectralContainer, "spectralContainer");
|
||||
GameRegistry.registerBlock(ModBlocks.blockDemonPortal, "demonPortalMain");
|
||||
GameRegistry.registerBlock(ModBlocks.blockBuildingSchematicSaver, "blockSchemSaver");
|
||||
GameRegistry.registerBlock(ModBlocks.blockReagentConduit, "blockReagentConduit");
|
||||
GameRegistry.registerBlock(ModBlocks.blockAlchemicCalcinator, "blockAlchemicCalcinator");
|
||||
GameRegistry.registerBlock(ModBlocks.blockCrystalBelljar, ItemBlockCrystalBelljar.class, "blockCrystalBelljar");
|
||||
}
|
||||
|
||||
public static void registerBlocksInInit()
|
||||
{
|
||||
}
|
||||
}
|
318
src/main/java/WayofTime/alchemicalWizardry/ModItems.java
Normal file
318
src/main/java/WayofTime/alchemicalWizardry/ModItems.java
Normal file
|
@ -0,0 +1,318 @@
|
|||
package WayofTime.alchemicalWizardry;
|
||||
|
||||
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.*;
|
||||
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.
|
||||
* User: Pokefenn
|
||||
* Date: 17/01/14
|
||||
* Time: 19:48
|
||||
*/
|
||||
public class ModItems
|
||||
{
|
||||
public static Item weakBloodOrb;
|
||||
public static Item apprenticeBloodOrb;
|
||||
public static Item magicianBloodOrb;
|
||||
public static Item energyBlaster;
|
||||
public static Item energySword;
|
||||
public static Item lavaCrystal;
|
||||
public static Item waterSigil;
|
||||
public static Item lavaSigil;
|
||||
public static Item voidSigil;
|
||||
public static Item blankSlate;
|
||||
public static Item reinforcedSlate;
|
||||
public static Item sacrificialDagger;
|
||||
public static Item daggerOfSacrifice;
|
||||
public static Item airSigil;
|
||||
public static Item sigilOfTheFastMiner;
|
||||
public static Item sigilOfElementalAffinity;
|
||||
public static Item sigilOfHaste;
|
||||
public static Item sigilOfHolding;
|
||||
public static Item divinationSigil;
|
||||
public static Item waterScribeTool;
|
||||
public static Item fireScribeTool;
|
||||
public static Item earthScribeTool;
|
||||
public static Item airScribeTool;
|
||||
public static Item activationCrystal;
|
||||
public static Item boundPickaxe;
|
||||
public static Item boundAxe;
|
||||
public static Item boundShovel;
|
||||
public static Item boundHelmet;
|
||||
public static Item boundPlate;
|
||||
public static Item boundLeggings;
|
||||
public static Item boundBoots;
|
||||
public static Item weakBloodShard;
|
||||
public static Item growthSigil;
|
||||
public static Item blankSpell;
|
||||
public static Item masterBloodOrb;
|
||||
public static Item alchemyFlask;
|
||||
public static Item standardBindingAgent;
|
||||
public static Item mundanePowerCatalyst;
|
||||
public static Item averagePowerCatalyst;
|
||||
public static Item greaterPowerCatalyst;
|
||||
public static Item mundaneLengtheningCatalyst;
|
||||
public static Item averageLengtheningCatalyst;
|
||||
public static Item greaterLengtheningCatalyst;
|
||||
public static Item incendium;
|
||||
public static Item magicales;
|
||||
public static Item sanctus;
|
||||
public static Item aether;
|
||||
public static Item simpleCatalyst;
|
||||
public static Item crepitous;
|
||||
public static Item crystallos;
|
||||
public static Item terrae;
|
||||
public static Item aquasalus;
|
||||
public static Item tennebrae;
|
||||
public static Item demonBloodShard;
|
||||
public static Item archmageBloodOrb;
|
||||
public static Item sigilOfWind;
|
||||
public static Item telepositionFocus;
|
||||
public static Item enhancedTelepositionFocus;
|
||||
public static Item reinforcedTelepositionFocus;
|
||||
public static Item demonicTelepositionFocus;
|
||||
public static Item imbuedSlate;
|
||||
public static Item demonicSlate;
|
||||
public static Item duskScribeTool;
|
||||
public static Item sigilOfTheBridge;
|
||||
public static Item armourInhibitor;
|
||||
public static Item creativeFiller;
|
||||
public static Item demonPlacer;
|
||||
|
||||
public static Item baseItems;
|
||||
public static Item baseAlchemyItems;
|
||||
|
||||
public static Item weakFillingAgent;
|
||||
public static Item standardFillingAgent;
|
||||
public static Item enhancedFillingAgent;
|
||||
public static Item weakBindingAgent;
|
||||
public static Item itemRitualDiviner;
|
||||
public static Item sanguineHelmet;
|
||||
public static Item sanguineRobe;
|
||||
public static Item sanguinePants;
|
||||
public static Item sanguineBoots;
|
||||
public static Item focusBloodBlast;
|
||||
public static Item focusGravityWell;
|
||||
public static Item sigilOfMagnetism;
|
||||
public static Item itemKeyOfDiablo;
|
||||
public static Item energyBazooka;
|
||||
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()
|
||||
{
|
||||
weakBloodOrb = new EnergyBattery(5000).setUnlocalizedName("weakBloodOrb");
|
||||
apprenticeBloodOrb = new ApprenticeBloodOrb(25000).setUnlocalizedName("apprenticeBloodOrb");
|
||||
magicianBloodOrb = new MagicianBloodOrb(150000).setUnlocalizedName("magicianBloodOrb");
|
||||
masterBloodOrb = new MasterBloodOrb(1000000).setUnlocalizedName("masterBloodOrb");
|
||||
archmageBloodOrb = new ArchmageBloodOrb(10000000).setUnlocalizedName("archmageBloodOrb");
|
||||
energyBlaster = new EnergyBlast().setUnlocalizedName("energyBlast");
|
||||
energySword = new EnergySword().setUnlocalizedName("energySword");
|
||||
lavaCrystal = new LavaCrystal().setUnlocalizedName("lavaCrystal");
|
||||
waterSigil = new WaterSigil().setUnlocalizedName("waterSigil");
|
||||
lavaSigil = new LavaSigil().setUnlocalizedName("lavaSigil");
|
||||
voidSigil = new VoidSigil().setUnlocalizedName("voidSigil");
|
||||
blankSlate = new AWBaseItems().setUnlocalizedName("blankSlate");
|
||||
reinforcedSlate = new AWBaseItems().setUnlocalizedName("reinforcedSlate");
|
||||
sacrificialDagger = new SacrificialDagger().setUnlocalizedName("sacrificialDagger");
|
||||
daggerOfSacrifice = new DaggerOfSacrifice().setUnlocalizedName("daggerOfSacrifice");
|
||||
airSigil = new AirSigil().setUnlocalizedName("airSigil");
|
||||
sigilOfTheFastMiner = new SigilOfTheFastMiner().setUnlocalizedName("sigilOfTheFastMiner");
|
||||
sigilOfElementalAffinity = new SigilOfElementalAffinity().setUnlocalizedName("sigilOfElementalAffinity");
|
||||
sigilOfHaste = new SigilOfHaste().setUnlocalizedName("sigilOfHaste");
|
||||
sigilOfHolding = new SigilOfHolding().setUnlocalizedName("sigilOfHolding");
|
||||
divinationSigil = new DivinationSigil().setUnlocalizedName("divinationSigil");
|
||||
waterScribeTool = new WaterScribeTool().setUnlocalizedName("waterScribeTool");
|
||||
fireScribeTool = new FireScribeTool().setUnlocalizedName("fireScribeTool");
|
||||
earthScribeTool = new EarthScribeTool().setUnlocalizedName("earthScribeTool");
|
||||
airScribeTool = new AirScribeTool().setUnlocalizedName("airScribeTool");
|
||||
activationCrystal = new ActivationCrystal();
|
||||
boundPickaxe = new BoundPickaxe().setUnlocalizedName("boundPickaxe");
|
||||
boundAxe = new BoundAxe().setUnlocalizedName("boundAxe");
|
||||
boundShovel = new BoundShovel().setUnlocalizedName("boundShovel");
|
||||
boundHelmet = new BoundArmour(0).setUnlocalizedName("boundHelmet");
|
||||
boundPlate = new BoundArmour(1).setUnlocalizedName("boundPlate");
|
||||
boundLeggings = new BoundArmour(2).setUnlocalizedName("boundLeggings");
|
||||
boundBoots = new BoundArmour(3).setUnlocalizedName("boundBoots");
|
||||
weakBloodShard = new BloodShard().setUnlocalizedName("weakBloodShard");
|
||||
growthSigil = new SigilOfGrowth().setUnlocalizedName("growthSigil");
|
||||
blankSpell = new BlankSpell().setUnlocalizedName("blankSpell");
|
||||
alchemyFlask = new AlchemyFlask().setUnlocalizedName("alchemyFlask");
|
||||
standardBindingAgent = new StandardBindingAgent().setUnlocalizedName("standardBindingAgent");
|
||||
mundanePowerCatalyst = new MundanePowerCatalyst().setUnlocalizedName("mundanePowerCatalyst");
|
||||
averagePowerCatalyst = new AveragePowerCatalyst().setUnlocalizedName("averagePowerCatalyst");
|
||||
greaterPowerCatalyst = new GreaterPowerCatalyst().setUnlocalizedName("greaterPowerCatalyst");
|
||||
mundaneLengtheningCatalyst = new MundaneLengtheningCatalyst().setUnlocalizedName("mundaneLengtheningCatalyst");
|
||||
averageLengtheningCatalyst = new AverageLengtheningCatalyst().setUnlocalizedName("averageLengtheningCatalyst");
|
||||
greaterLengtheningCatalyst = new GreaterLengtheningCatalyst().setUnlocalizedName("greaterLengtheningCatalyst");
|
||||
incendium = new AlchemyReagent().setUnlocalizedName("incendium");
|
||||
magicales = new AlchemyReagent().setUnlocalizedName("magicales");
|
||||
sanctus = new AlchemyReagent().setUnlocalizedName("sanctus");
|
||||
aether = new AlchemyReagent().setUnlocalizedName("aether");
|
||||
simpleCatalyst = new AlchemyReagent().setUnlocalizedName("simpleCatalyst");
|
||||
crepitous = new AlchemyReagent().setUnlocalizedName("crepitous");
|
||||
crystallos = new AlchemyReagent().setUnlocalizedName("crystallos");
|
||||
terrae = new AlchemyReagent().setUnlocalizedName("terrae");
|
||||
aquasalus = new AlchemyReagent().setUnlocalizedName("aquasalus");
|
||||
tennebrae = new AlchemyReagent().setUnlocalizedName("tennebrae");
|
||||
demonBloodShard = new BloodShard().setUnlocalizedName("demonBloodShard");
|
||||
sigilOfWind = new SigilOfWind().setUnlocalizedName("sigilOfWind");
|
||||
telepositionFocus = new TelepositionFocus(1).setUnlocalizedName("telepositionFocus");
|
||||
enhancedTelepositionFocus = new EnhancedTelepositionFocus().setUnlocalizedName("enhancedTelepositionFocus");
|
||||
reinforcedTelepositionFocus = new ReinforcedTelepositionFocus().setUnlocalizedName("reinforcedTelepositionFocus");
|
||||
demonicTelepositionFocus = new DemonicTelepositionFocus().setUnlocalizedName("demonicTelepositionFocus");
|
||||
imbuedSlate = new AWBaseItems().setUnlocalizedName("imbuedSlate");
|
||||
demonicSlate = new AWBaseItems().setUnlocalizedName("demonicSlate");
|
||||
duskScribeTool = new DuskScribeTool().setUnlocalizedName("duskScribeTool");
|
||||
sigilOfTheBridge = new SigilOfTheBridge().setUnlocalizedName("sigilOfTheBridge");
|
||||
armourInhibitor = new ArmourInhibitor().setUnlocalizedName("armourInhibitor");
|
||||
creativeFiller = new CheatyItem().setUnlocalizedName("cheatyItem");
|
||||
demonPlacer = new DemonPlacer().setUnlocalizedName("demonPlacer");
|
||||
weakFillingAgent = new WeakFillingAgent().setUnlocalizedName("weakFillingAgent");
|
||||
standardFillingAgent = new StandardFillingAgent().setUnlocalizedName("standardFillingAgent");
|
||||
enhancedFillingAgent = new EnhancedFillingAgent().setUnlocalizedName("enhancedFillingAgent");
|
||||
weakBindingAgent = new WeakBindingAgent().setUnlocalizedName("weakBindingAgent");
|
||||
itemRitualDiviner = new ItemRitualDiviner().setUnlocalizedName("ritualDiviner");
|
||||
sigilOfMagnetism = new SigilOfMagnetism().setUnlocalizedName("sigilOfMagnetism");
|
||||
itemKeyOfDiablo = new ItemDiabloKey().setUnlocalizedName("itemDiabloKey");
|
||||
energyBazooka = new EnergyBazooka().setUnlocalizedName("energyBazooka");
|
||||
itemBloodLightSigil = new ItemBloodLightSigil().setUnlocalizedName("bloodLightSigil");
|
||||
itemComplexSpellCrystal = new ItemComplexSpellCrystal().setUnlocalizedName("itemComplexSpellCrystal");
|
||||
bucketLife = (new LifeBucket(ModBlocks.blockLifeEssence)).setUnlocalizedName("bucketLife").setContainerItem(Items.bucket).setCreativeTab(CreativeTabs.tabMisc);
|
||||
itemSigilOfEnderSeverance = (new ItemSigilOfEnderSeverance()).setUnlocalizedName("itemSigilOfEnderSeverance");
|
||||
baseItems = new ItemComponents().setUnlocalizedName("baseItems");
|
||||
baseAlchemyItems = new ItemAlchemyBase().setUnlocalizedName("baseAlchemyItems");
|
||||
itemSigilOfSupression = new ItemSigilOfSupression().setUnlocalizedName("itemSigilOfSupression");
|
||||
itemFluidSigil = new ItemFluidSigil().setUnlocalizedName("itemFluidSigil");
|
||||
itemSeerSigil = new ItemSeerSigil().setUnlocalizedName("itemSeerSigil");
|
||||
customTool = new ItemSpellMultiTool().setUnlocalizedName("multiTool");
|
||||
itemCombinationalCatalyst = new CombinationalCatalyst().setUnlocalizedName("itemCombinationalCatalyst");
|
||||
itemAttunedCrystal = new ItemAttunedCrystal().setUnlocalizedName("itemAttunedCrystal");
|
||||
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.energySword, "energySword");
|
||||
GameRegistry.registerItem(ModItems.lavaCrystal, "lavaCrystal");
|
||||
GameRegistry.registerItem(ModItems.waterSigil, "waterSigil");
|
||||
GameRegistry.registerItem(ModItems.lavaSigil, "lavaSigil");
|
||||
GameRegistry.registerItem(ModItems.voidSigil, "voidSigil");
|
||||
GameRegistry.registerItem(ModItems.blankSlate, "blankSlate");
|
||||
GameRegistry.registerItem(ModItems.reinforcedSlate, "reinforcedSlate");
|
||||
GameRegistry.registerItem(ModItems.sacrificialDagger, "sacrificialKnife");
|
||||
GameRegistry.registerItem(ModItems.daggerOfSacrifice, "daggerOfSacrifice");
|
||||
GameRegistry.registerItem(ModItems.airSigil, "airSigil");
|
||||
GameRegistry.registerItem(ModItems.sigilOfTheFastMiner, "sigilOfTheFastMiner");
|
||||
GameRegistry.registerItem(ModItems.sigilOfElementalAffinity, "sigilOfElementalAffinity");
|
||||
GameRegistry.registerItem(ModItems.sigilOfHaste, "sigilOfHaste");
|
||||
GameRegistry.registerItem(ModItems.sigilOfHolding, "sigilOfHolding");
|
||||
GameRegistry.registerItem(ModItems.divinationSigil, "divinationSigil");
|
||||
GameRegistry.registerItem(ModItems.waterScribeTool, "waterScribeTool");
|
||||
GameRegistry.registerItem(ModItems.fireScribeTool, "fireScribeTool");
|
||||
GameRegistry.registerItem(ModItems.earthScribeTool, "earthScribeTool");
|
||||
GameRegistry.registerItem(ModItems.airScribeTool, "airScribeTool");
|
||||
GameRegistry.registerItem(ModItems.activationCrystal, "activationCrystal");
|
||||
GameRegistry.registerItem(ModItems.boundPickaxe, "boundPickaxe");
|
||||
GameRegistry.registerItem(ModItems.boundAxe, "boundAxe");
|
||||
GameRegistry.registerItem(ModItems.boundShovel, "boundShovel");
|
||||
GameRegistry.registerItem(ModItems.boundHelmet, "boundHelmet");
|
||||
GameRegistry.registerItem(ModItems.boundPlate, "boundPlate");
|
||||
GameRegistry.registerItem(ModItems.boundLeggings, "boundLeggings");
|
||||
GameRegistry.registerItem(ModItems.boundBoots, "boundBoots");
|
||||
GameRegistry.registerItem(ModItems.weakBloodShard, "weakBloodShard");
|
||||
GameRegistry.registerItem(ModItems.growthSigil, "growthSigil");
|
||||
GameRegistry.registerItem(ModItems.blankSpell, "blankSpell");
|
||||
GameRegistry.registerItem(ModItems.masterBloodOrb, "masterBloodOrb");
|
||||
GameRegistry.registerItem(ModItems.alchemyFlask, "alchemyFlask");
|
||||
GameRegistry.registerItem(ModItems.standardBindingAgent, "standardBindingAgent");
|
||||
GameRegistry.registerItem(ModItems.mundanePowerCatalyst, "mundanePowerCatalyst");
|
||||
GameRegistry.registerItem(ModItems.averagePowerCatalyst, "averagePowerCatalyst");
|
||||
GameRegistry.registerItem(ModItems.greaterPowerCatalyst, "greaterPowerCatalyst");
|
||||
GameRegistry.registerItem(ModItems.mundaneLengtheningCatalyst, "mundaneLengtheningCatalyst");
|
||||
GameRegistry.registerItem(ModItems.averageLengtheningCatalyst, "averageLengtheningCatalyst");
|
||||
GameRegistry.registerItem(ModItems.greaterLengtheningCatalyst, "greaterLengtheningCatalyst");
|
||||
GameRegistry.registerItem(ModItems.incendium, "incendium");
|
||||
GameRegistry.registerItem(ModItems.magicales, "magicales");
|
||||
GameRegistry.registerItem(ModItems.sanctus, "sanctus");
|
||||
GameRegistry.registerItem(ModItems.aether, "aether");
|
||||
GameRegistry.registerItem(ModItems.simpleCatalyst, "simpleCatalyst");
|
||||
GameRegistry.registerItem(ModItems.crepitous, "crepitous");
|
||||
GameRegistry.registerItem(ModItems.crystallos, "crystallos");
|
||||
GameRegistry.registerItem(ModItems.terrae, "terrae");
|
||||
GameRegistry.registerItem(ModItems.aquasalus, "aquasalus");
|
||||
GameRegistry.registerItem(ModItems.tennebrae, "tennebrae");
|
||||
GameRegistry.registerItem(ModItems.demonBloodShard, "demonBloodShard");
|
||||
GameRegistry.registerItem(ModItems.archmageBloodOrb, "archmageBloodOrb");
|
||||
GameRegistry.registerItem(ModItems.sigilOfWind, "sigilOfWind");
|
||||
GameRegistry.registerItem(ModItems.telepositionFocus, "telepositionFocus");
|
||||
GameRegistry.registerItem(ModItems.enhancedTelepositionFocus, "enhancedTelepositionFocus");
|
||||
GameRegistry.registerItem(ModItems.reinforcedTelepositionFocus, "reinforcedTelepositionFocus");
|
||||
GameRegistry.registerItem(ModItems.demonicTelepositionFocus, "demonicTelepositionFocus");
|
||||
GameRegistry.registerItem(ModItems.imbuedSlate, "imbuedSlate");
|
||||
GameRegistry.registerItem(ModItems.demonicSlate, "demonicSlate");
|
||||
GameRegistry.registerItem(ModItems.duskScribeTool, "duskScribeTool");
|
||||
GameRegistry.registerItem(ModItems.sigilOfTheBridge, "sigilOfTheBridge");
|
||||
GameRegistry.registerItem(ModItems.armourInhibitor, "armourInhibitor");
|
||||
GameRegistry.registerItem(ModItems.creativeFiller, "creativeFiller");
|
||||
GameRegistry.registerItem(ModItems.demonPlacer, "demonPlacer");
|
||||
|
||||
GameRegistry.registerItem(ModItems.weakFillingAgent, "weakFillingAgent");
|
||||
GameRegistry.registerItem(ModItems.standardFillingAgent, "standardFillingAgent");
|
||||
GameRegistry.registerItem(ModItems.enhancedFillingAgent, "enhancedFillingAgent");
|
||||
GameRegistry.registerItem(ModItems.weakBindingAgent, "weakBindingAgent");
|
||||
GameRegistry.registerItem(ModItems.itemRitualDiviner, "itemRitualDiviner");
|
||||
GameRegistry.registerItem(ModItems.sigilOfMagnetism, "sigilOfMagnetism");
|
||||
GameRegistry.registerItem(ModItems.itemKeyOfDiablo, "itemKeyOfDiablo");
|
||||
GameRegistry.registerItem(ModItems.energyBazooka, "energyBazooka");
|
||||
GameRegistry.registerItem(ModItems.itemBloodLightSigil, "itemBloodLightSigil");
|
||||
GameRegistry.registerItem(ModItems.itemComplexSpellCrystal, "itemComplexSpellCrystal");
|
||||
GameRegistry.registerItem(ModItems.itemSigilOfSupression, "sigilOfSupression");
|
||||
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");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package WayofTime.alchemicalWizardry.api;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AlchemicalPotionCreationHandler
|
||||
{
|
||||
public static ArrayList<AlchemyPotionHandlerComponent> registeredPotionEffects = new ArrayList();
|
||||
|
||||
public static void addPotion(ItemStack itemStack, int potionID, int tickDuration)
|
||||
{
|
||||
registeredPotionEffects.add(new AlchemyPotionHandlerComponent(itemStack, potionID, tickDuration));
|
||||
}
|
||||
|
||||
public static int getPotionIDForStack(ItemStack itemStack)
|
||||
{
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
|
||||
{
|
||||
if (aphc.compareItemStack(itemStack))
|
||||
{
|
||||
return aphc.getPotionID();
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int getPotionTickDurationForStack(ItemStack itemStack)
|
||||
{
|
||||
{
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
|
||||
{
|
||||
if (aphc.compareItemStack(itemStack))
|
||||
{
|
||||
return aphc.getTickDuration();
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean containsRegisteredPotionIngredient(ItemStack[] stackList)
|
||||
{
|
||||
for (ItemStack is : stackList)
|
||||
{
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
|
||||
{
|
||||
if (aphc.compareItemStack(is))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getRegisteredPotionIngredientPosition(ItemStack[] stackList)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (ItemStack is : stackList)
|
||||
{
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
|
||||
{
|
||||
if (aphc.compareItemStack(is))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AlchemyPotionHandlerComponent
|
||||
{
|
||||
private ItemStack itemStack;
|
||||
private int potionID;
|
||||
private int tickDuration;
|
||||
|
||||
public AlchemyPotionHandlerComponent(ItemStack itemStack, int potionID, int tickDuration)
|
||||
{
|
||||
this.itemStack = itemStack;
|
||||
this.potionID = potionID;
|
||||
this.tickDuration = tickDuration;
|
||||
}
|
||||
|
||||
public boolean compareItemStack(ItemStack comparedStack)
|
||||
{
|
||||
if (comparedStack != null && itemStack != null)
|
||||
{
|
||||
if (comparedStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
return comparedStack.getItem().equals(itemStack.getItem()) && comparedStack.getItemDamage() == itemStack.getItemDamage();
|
||||
}
|
||||
} else if (!(itemStack.getItem() instanceof ItemBlock))
|
||||
{
|
||||
return comparedStack.getItem().equals(itemStack.getItem()) && comparedStack.getItemDamage() == itemStack.getItemDamage();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public int getPotionID()
|
||||
{
|
||||
return this.potionID;
|
||||
}
|
||||
|
||||
public int getTickDuration()
|
||||
{
|
||||
return this.tickDuration;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
public class AlchemyPotionHelper
|
||||
{
|
||||
private int potionID;
|
||||
private int tickDuration;
|
||||
private int concentration;
|
||||
private int durationFactor;
|
||||
|
||||
public AlchemyPotionHelper(int potionID, int tickDuration, int concentration, int durationFactor)
|
||||
{
|
||||
this.potionID = potionID;
|
||||
this.tickDuration = tickDuration;
|
||||
this.concentration = concentration;
|
||||
this.durationFactor = durationFactor;
|
||||
}
|
||||
|
||||
public void setConcentration(int concentration)
|
||||
{
|
||||
this.concentration = concentration;
|
||||
}
|
||||
|
||||
public void setDurationFactor(int durationFactor)
|
||||
{
|
||||
this.durationFactor = durationFactor;
|
||||
}
|
||||
|
||||
public int getPotionID()
|
||||
{
|
||||
return this.potionID;
|
||||
}
|
||||
|
||||
public int getTickDuration()
|
||||
{
|
||||
return this.tickDuration;
|
||||
}
|
||||
|
||||
public int getConcentration()
|
||||
{
|
||||
return this.concentration;
|
||||
}
|
||||
|
||||
public int getdurationFactor()
|
||||
{
|
||||
return this.durationFactor;
|
||||
}
|
||||
|
||||
public PotionEffect getPotionEffect()
|
||||
{
|
||||
if (potionID == Potion.heal.id || potionID == Potion.harm.id)
|
||||
{
|
||||
return (new PotionEffect(potionID, 1, concentration));
|
||||
}
|
||||
|
||||
return (new PotionEffect(potionID, (int) (tickDuration * Math.pow(0.5f, concentration) * Math.pow(8.0f / 3.0f, durationFactor)), concentration));
|
||||
}
|
||||
|
||||
public static AlchemyPotionHelper readEffectFromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
return new AlchemyPotionHelper(tagCompound.getInteger("potionID"), tagCompound.getInteger("tickDuration"), tagCompound.getInteger("concentration"), tagCompound.getInteger("durationFactor"));
|
||||
}
|
||||
|
||||
public static NBTTagCompound setEffectToNBT(AlchemyPotionHelper aph)
|
||||
{
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tagCompound.setInteger("potionID", aph.getPotionID());
|
||||
tagCompound.setInteger("tickDuration", aph.getTickDuration());
|
||||
tagCompound.setInteger("concentration", aph.getConcentration());
|
||||
tagCompound.setInteger("durationFactor", aph.getdurationFactor());
|
||||
return tagCompound;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class AlchemyRecipe
|
||||
{
|
||||
private ItemStack output;
|
||||
private ItemStack[] recipe;
|
||||
private int bloodOrbLevel;
|
||||
private int amountNeeded;
|
||||
|
||||
public AlchemyRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel)
|
||||
{
|
||||
this.output = output;
|
||||
this.recipe = recipe;
|
||||
this.amountNeeded = amountNeeded;
|
||||
this.bloodOrbLevel = bloodOrbLevel;
|
||||
}
|
||||
|
||||
public boolean doesRecipeMatch(ItemStack[] items, int slottedBloodOrbLevel)
|
||||
{
|
||||
if (slottedBloodOrbLevel < bloodOrbLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack[] recipe = new ItemStack[5];
|
||||
|
||||
if (items.length < 5)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.recipe.length != 5)
|
||||
{
|
||||
ItemStack[] newRecipe = new ItemStack[5];
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (i + 1 > this.recipe.length)
|
||||
{
|
||||
newRecipe[i] = null;
|
||||
} else
|
||||
{
|
||||
newRecipe[i] = this.recipe[i];
|
||||
}
|
||||
}
|
||||
|
||||
recipe = newRecipe;
|
||||
} else
|
||||
{
|
||||
recipe = this.recipe;
|
||||
}
|
||||
|
||||
boolean[] checkList = new boolean[5];
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
checkList[i] = false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
ItemStack recipeItemStack = recipe[i];
|
||||
|
||||
if (recipeItemStack == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean test = false;
|
||||
|
||||
for (int j = 0; j < 5; j++)
|
||||
{
|
||||
if (checkList[j])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack checkedItemStack = items[j];
|
||||
|
||||
if (checkedItemStack == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean quickTest = false;
|
||||
|
||||
if (recipeItemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (checkedItemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
quickTest = true;
|
||||
}
|
||||
} else if (!(checkedItemStack.getItem() instanceof ItemBlock))
|
||||
{
|
||||
quickTest = true;
|
||||
}
|
||||
|
||||
if (!quickTest)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) && checkedItemStack.getItem() == recipeItemStack.getItem())
|
||||
{
|
||||
test = true;
|
||||
checkList[j] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!test)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack getResult()
|
||||
{
|
||||
return output.copy();
|
||||
}
|
||||
|
||||
public int getAmountNeeded()
|
||||
{
|
||||
return this.amountNeeded;
|
||||
}
|
||||
|
||||
public ItemStack[] getRecipe()
|
||||
{
|
||||
return this.recipe;
|
||||
}
|
||||
|
||||
public int getOrbLevel()
|
||||
{
|
||||
return this.bloodOrbLevel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
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;
|
||||
|
||||
public class AlchemyRecipeRegistry
|
||||
{
|
||||
public static List<AlchemyRecipe> recipes = new ArrayList();
|
||||
|
||||
public static void registerRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel)
|
||||
{
|
||||
recipes.add(new AlchemyRecipe(output, amountNeeded, recipe, bloodOrbLevel));
|
||||
}
|
||||
|
||||
public static ItemStack getResult(ItemStack[] recipe, ItemStack bloodOrb)
|
||||
{
|
||||
if (bloodOrb == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(bloodOrb.getItem() instanceof IBloodOrb))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int bloodOrbLevel = ((IBloodOrb) bloodOrb.getItem()).getOrbLevel();
|
||||
|
||||
for (AlchemyRecipe ar : recipes)
|
||||
{
|
||||
if (ar.doesRecipeMatch(recipe, bloodOrbLevel))
|
||||
{
|
||||
return (ar.getResult());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getAmountNeeded(ItemStack[] recipe, ItemStack bloodOrb)
|
||||
{
|
||||
if (bloodOrb == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(bloodOrb.getItem() instanceof IBloodOrb))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bloodOrbLevel = ((IBloodOrb) bloodOrb.getItem()).getOrbLevel();
|
||||
|
||||
for (AlchemyRecipe ar : recipes)
|
||||
{
|
||||
if (ar.doesRecipeMatch(recipe, bloodOrbLevel))
|
||||
{
|
||||
return (ar.getAmountNeeded());
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static ItemStack[] getRecipeForItemStack(ItemStack itemStack)
|
||||
{
|
||||
for (AlchemyRecipe ar : recipes)
|
||||
{
|
||||
ItemStack result = ar.getResult();
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
if (result.isItemEqual(itemStack))
|
||||
{
|
||||
return ar.getRecipe();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IAlchemyGoggles
|
||||
{
|
||||
public boolean showIngameHUD(World world, ItemStack stack, EntityPlayer player);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
public interface IReagentContainer
|
||||
{
|
||||
public ReagentStack getReagent();
|
||||
|
||||
public int getReagentStackAmount();
|
||||
|
||||
public int getCapacity();
|
||||
|
||||
public int fill(ReagentStack resource, boolean doFill);
|
||||
|
||||
public ReagentStack drain(int maxDrain, boolean doDrain);
|
||||
|
||||
public ReagentContainerInfo getInfo();
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IReagentHandler
|
||||
{
|
||||
int fill(ForgeDirection from, ReagentStack resource, boolean doFill);
|
||||
|
||||
ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain);
|
||||
|
||||
ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain);
|
||||
|
||||
boolean canFill(ForgeDirection from, Reagent reagent);
|
||||
|
||||
boolean canDrain(ForgeDirection from, Reagent reagent);
|
||||
|
||||
ReagentContainerInfo[] getContainerInfo(ForgeDirection from);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
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();
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ReagentContainer implements IReagentContainer
|
||||
{
|
||||
protected ReagentStack reagentStack;
|
||||
protected int capacity;
|
||||
|
||||
public ReagentContainer(int capacity)
|
||||
{
|
||||
this(null, capacity);
|
||||
}
|
||||
|
||||
public ReagentContainer(ReagentStack stack, int capacity)
|
||||
{
|
||||
this.reagentStack = stack;
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public ReagentContainer(Reagent reagent, int amount, int capacity)
|
||||
{
|
||||
this(new ReagentStack(reagent, amount), capacity);
|
||||
}
|
||||
|
||||
public static ReagentContainer readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
ReagentStack reagent = ReagentStack.loadReagentStackFromNBT(nbt);
|
||||
int capacity = nbt.getInteger("capacity");
|
||||
|
||||
if (reagent != null)
|
||||
{
|
||||
return new ReagentContainer(reagent, capacity);
|
||||
} else
|
||||
{
|
||||
return new ReagentContainer(null, capacity);
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
if (reagentStack != null)
|
||||
{
|
||||
reagentStack.writeToNBT(nbt);
|
||||
}
|
||||
|
||||
nbt.setInteger("capacity", capacity);
|
||||
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack getReagent()
|
||||
{
|
||||
return reagentStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getReagentStackAmount()
|
||||
{
|
||||
if (reagentStack == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return reagentStack.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity()
|
||||
{
|
||||
return capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ReagentStack resource, boolean doFill)
|
||||
{
|
||||
if (resource == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!doFill)
|
||||
{
|
||||
if (reagentStack == null)
|
||||
{
|
||||
return Math.min(capacity, resource.amount);
|
||||
}
|
||||
|
||||
if (!reagentStack.isReagentEqual(resource))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Math.min(capacity - reagentStack.amount, resource.amount);
|
||||
}
|
||||
|
||||
if (reagentStack == null)
|
||||
{
|
||||
reagentStack = new ReagentStack(resource, Math.min(capacity, resource.amount));
|
||||
|
||||
return reagentStack.amount;
|
||||
}
|
||||
|
||||
if (!reagentStack.isReagentEqual(resource))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int filled = capacity - reagentStack.amount;
|
||||
|
||||
if (resource.amount < filled)
|
||||
{
|
||||
reagentStack.amount += resource.amount;
|
||||
filled = resource.amount;
|
||||
} else
|
||||
{
|
||||
reagentStack.amount = capacity;
|
||||
}
|
||||
|
||||
return filled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(int maxDrain, boolean doDrain)
|
||||
{
|
||||
if (reagentStack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int drained = maxDrain;
|
||||
if (reagentStack.amount < drained)
|
||||
{
|
||||
drained = reagentStack.amount;
|
||||
}
|
||||
|
||||
ReagentStack stack = new ReagentStack(reagentStack, drained);
|
||||
if (doDrain)
|
||||
{
|
||||
reagentStack.amount -= drained;
|
||||
if (reagentStack.amount <= 0)
|
||||
{
|
||||
reagentStack = null;
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentContainerInfo getInfo()
|
||||
{
|
||||
return new ReagentContainerInfo(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
public final class ReagentContainerInfo
|
||||
{
|
||||
public final ReagentStack reagent;
|
||||
public final int capacity;
|
||||
|
||||
public ReagentContainerInfo(ReagentStack reagent, int capacity)
|
||||
{
|
||||
this.reagent = reagent;
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public ReagentContainerInfo(IReagentContainer tank)
|
||||
{
|
||||
this.reagent = tank.getReagent();
|
||||
this.capacity = tank.getCapacity();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,174 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ReagentStack
|
||||
{
|
||||
public Reagent reagent;
|
||||
public int amount;
|
||||
|
||||
public ReagentStack(Reagent reagent, int amount)
|
||||
{
|
||||
this.reagent = reagent;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
|
||||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileReagentHandler extends TileEntity implements IReagentHandler
|
||||
{
|
||||
protected ReagentContainer tank = new ReagentContainer(4000);
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
tank.readFromNBT(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
tank.writeToNBT(tag);
|
||||
}
|
||||
|
||||
/* IReagentHandler */
|
||||
@Override
|
||||
public int fill(ForgeDirection from, ReagentStack resource, boolean doFill)
|
||||
{
|
||||
return tank.fill(resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain)
|
||||
{
|
||||
if (resource == null || !resource.isReagentEqual(tank.getReagent()))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return tank.drain(resource.amount, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
return tank.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Reagent reagent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Reagent reagent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReagentContainerInfo[] getContainerInfo(ForgeDirection from)
|
||||
{
|
||||
return new ReagentContainerInfo[]{tank.getInfo()};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,283 @@
|
|||
|
||||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
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;
|
||||
protected Map<Reagent, Integer> attunedTankMap;
|
||||
|
||||
public TileSegmentedReagentHandler()
|
||||
{
|
||||
this(1);
|
||||
}
|
||||
|
||||
public TileSegmentedReagentHandler(int numberOfTanks)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@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++)
|
||||
{
|
||||
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++)
|
||||
{
|
||||
NBTTagCompound savedTag = attunedTagList.getCompoundTagAt(i);
|
||||
Reagent reagent = ReagentRegistry.getReagentForKey(savedTag.getString("reagent"));
|
||||
this.attunedTankMap.put(reagent, savedTag.getInteger("amount"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
tag.setTag("reagentTanks", tagList);
|
||||
|
||||
NBTTagList attunedTagList = new NBTTagList();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
tag.setTag("attunedTankMap", attunedTagList);
|
||||
}
|
||||
|
||||
/* ISegmentedReagentHandler */
|
||||
@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 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()))
|
||||
{
|
||||
ReagentStack drainStack = tanks[i].drain(maxDrain - drained, doDrain);
|
||||
if (drainStack != null)
|
||||
{
|
||||
drained += drainStack.amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ReagentStack(reagent, drained);
|
||||
}
|
||||
|
||||
/* Only returns the amount from the first available tank */
|
||||
@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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Reagent reagent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Reagent reagent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@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 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 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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package WayofTime.alchemicalWizardry.api.altarRecipeRegistry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AltarRecipe
|
||||
{
|
||||
public int minTier;
|
||||
public int liquidRequired;
|
||||
public boolean canBeFilled; //Tells the system that the item is an orb
|
||||
public int consumptionRate;
|
||||
public int drainRate;
|
||||
public ItemStack requiredItem;
|
||||
public ItemStack result;
|
||||
|
||||
public 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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package WayofTime.alchemicalWizardry.api.altarRecipeRegistry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package WayofTime.alchemicalWizardry.api.bindingRegistry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package WayofTime.alchemicalWizardry.api.bindingRegistry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class BindingRegistry
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package WayofTime.alchemicalWizardry.api.harvest;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HarvestRegistry
|
||||
{
|
||||
public static List<IHarvestHandler> handlerList = new ArrayList();
|
||||
|
||||
public static 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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package WayofTime.alchemicalWizardry.api.harvest;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
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);
|
||||
}
|
|
@ -0,0 +1,281 @@
|
|||
package WayofTime.alchemicalWizardry.api.items;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
private ItemStack output = null;
|
||||
private Object[] input = null;
|
||||
public int width = 0;
|
||||
public int height = 0;
|
||||
private boolean mirrored = true;
|
||||
|
||||
public ShapedBloodOrbRecipe(Block result, Object... recipe)
|
||||
{
|
||||
this(new ItemStack(result), recipe);
|
||||
}
|
||||
|
||||
public ShapedBloodOrbRecipe(Item result, Object... recipe)
|
||||
{
|
||||
this(new ItemStack(result), recipe);
|
||||
}
|
||||
|
||||
public ShapedBloodOrbRecipe(ItemStack result, Object... recipe)
|
||||
{
|
||||
output = result.copy();
|
||||
|
||||
String shape = "";
|
||||
int idx = 0;
|
||||
|
||||
if (recipe[idx] instanceof Boolean)
|
||||
{
|
||||
mirrored = (Boolean) recipe[idx];
|
||||
if (recipe[idx + 1] instanceof Object[])
|
||||
{
|
||||
recipe = (Object[]) recipe[idx + 1];
|
||||
} else
|
||||
{
|
||||
idx = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (recipe[idx] instanceof String[])
|
||||
{
|
||||
String[] parts = ((String[]) recipe[idx++]);
|
||||
|
||||
for (String s : parts)
|
||||
{
|
||||
width = s.length();
|
||||
shape += s;
|
||||
}
|
||||
|
||||
height = parts.length;
|
||||
} else
|
||||
{
|
||||
while (recipe[idx] instanceof String)
|
||||
{
|
||||
String s = (String) recipe[idx++];
|
||||
shape += s;
|
||||
width = s.length();
|
||||
height++;
|
||||
}
|
||||
}
|
||||
|
||||
if (width * height != shape.length())
|
||||
{
|
||||
String ret = "Invalid shaped ore recipe: ";
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
}
|
||||
|
||||
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
|
||||
|
||||
for (; idx < recipe.length; idx += 2)
|
||||
{
|
||||
Character chr = (Character) recipe[idx];
|
||||
Object in = recipe[idx + 1];
|
||||
|
||||
if (in instanceof IBloodOrb || (in instanceof ItemStack && ((ItemStack) in).getItem() instanceof IBloodOrb))
|
||||
{ //If the item is an instanceof IBloodOrb then save the level of the orb
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
input = new Object[width * height];
|
||||
int x = 0;
|
||||
for (char chr : shape.toCharArray())
|
||||
{
|
||||
input[x++] = itemMap.get(chr);
|
||||
}
|
||||
}
|
||||
|
||||
ShapedBloodOrbRecipe(ShapedRecipes recipe, Map<ItemStack, String> replacements)
|
||||
{
|
||||
output = recipe.getRecipeOutput();
|
||||
width = recipe.recipeWidth;
|
||||
height = recipe.recipeHeight;
|
||||
|
||||
input = new Object[recipe.recipeItems.length];
|
||||
|
||||
for (int i = 0; i < input.length; i++)
|
||||
{
|
||||
ItemStack ingred = recipe.recipeItems[i];
|
||||
|
||||
if (ingred == null)
|
||||
continue;
|
||||
|
||||
input[i] = recipe.recipeItems[i];
|
||||
|
||||
for (Entry<ItemStack, String> replace : replacements.entrySet())
|
||||
{
|
||||
if (OreDictionary.itemMatches(replace.getKey(), ingred, true))
|
||||
{
|
||||
input[i] = OreDictionary.getOres(replace.getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting var1)
|
||||
{
|
||||
return output.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return input.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
if (mirrored && checkMatch(inv, x, y, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 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;
|
||||
|
||||
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;
|
||||
|
||||
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) target).iterator();
|
||||
while (itr.hasNext() && !matched)
|
||||
{
|
||||
matched = OreDictionary.itemMatches(itr.next(), slot, false);
|
||||
}
|
||||
|
||||
if (!matched)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else if (target == null && slot != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public ShapedBloodOrbRecipe setMirrored(boolean mirror)
|
||||
{
|
||||
mirrored = mirror;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Object[] getInput()
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,174 @@
|
|||
package WayofTime.alchemicalWizardry.api.items;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* 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(Block result, Object... recipe)
|
||||
{
|
||||
this(new ItemStack(result), recipe);
|
||||
}
|
||||
|
||||
public ShapelessBloodOrbRecipe(Item 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements)
|
||||
{
|
||||
output = recipe.getRecipeOutput();
|
||||
|
||||
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 int getRecipeSize()
|
||||
{
|
||||
return input.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting var1)
|
||||
{
|
||||
return output.copy();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting var1, World world)
|
||||
{
|
||||
ArrayList<Object> required = new ArrayList<Object>(input);
|
||||
|
||||
for (int x = 0; x < var1.getSizeInventory(); x++)
|
||||
{
|
||||
ItemStack slot = var1.getStackInSlot(x);
|
||||
|
||||
if (slot != null)
|
||||
{
|
||||
boolean inRecipe = false;
|
||||
Iterator<Object> req = required.iterator();
|
||||
|
||||
while (req.hasNext())
|
||||
{
|
||||
boolean match = false;
|
||||
|
||||
Object next = req.next();
|
||||
|
||||
//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 (match)
|
||||
{
|
||||
inRecipe = true;
|
||||
required.remove(next);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!inRecipe)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return required.isEmpty();
|
||||
}
|
||||
|
||||
public ArrayList<Object> getInput()
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package WayofTime.alchemicalWizardry.api.items.interfaces;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ArmourUpgrade
|
||||
{
|
||||
//Called when the armour ticks
|
||||
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack);
|
||||
|
||||
public boolean isUpgrade();
|
||||
|
||||
public int getEnergyForTenSeconds();
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package WayofTime.alchemicalWizardry.api.items.interfaces;
|
||||
|
||||
public interface IBindable
|
||||
{
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package WayofTime.alchemicalWizardry.api.items.interfaces;
|
||||
|
||||
public interface IBloodOrb
|
||||
{
|
||||
public int getMaxEssence();
|
||||
|
||||
public int getOrbLevel();
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.api.items.interfaces;
|
||||
|
||||
public interface IHolding
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
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
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package WayofTime.alchemicalWizardry.api.rituals;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ISegmentedReagentHandler;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IMasterRitualStone extends ISegmentedReagentHandler
|
||||
{
|
||||
public void performRitual(World world, int x, int y, int z, String ritualID);
|
||||
|
||||
public String getOwner();
|
||||
|
||||
public void setCooldown(int newCooldown);
|
||||
|
||||
public int getCooldown();
|
||||
|
||||
public void setVar1(int newVar1);
|
||||
|
||||
public int getVar1();
|
||||
|
||||
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);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.api.rituals;
|
||||
|
||||
public interface IRitualStone
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package WayofTime.alchemicalWizardry.api.rituals;
|
||||
|
||||
public class RitualComponent
|
||||
{
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
private int stoneType;
|
||||
public static final int BLANK = 0;
|
||||
public static final int WATER = 1;
|
||||
public static final int FIRE = 2;
|
||||
public static final int EARTH = 3;
|
||||
public static final int AIR = 4;
|
||||
public static final int DUSK = 5;
|
||||
|
||||
public RitualComponent(int x, int y, int z, int stoneType)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.stoneType = stoneType;
|
||||
}
|
||||
|
||||
public int getX()
|
||||
{
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public int getY()
|
||||
{
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public int getZ()
|
||||
{
|
||||
return this.z;
|
||||
}
|
||||
|
||||
public int getStoneType()
|
||||
{
|
||||
return this.stoneType;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package WayofTime.alchemicalWizardry.api.rituals;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void onRitualBroken(IMasterRitualStone ritualStone)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public abstract int getCostPerRefresh();
|
||||
|
||||
public int getInitialCooldown()
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,421 @@
|
|||
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;
|
||||
|
||||
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 Rituals(int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer)
|
||||
{
|
||||
this.crystalLevel = crystalLevel;
|
||||
this.actCost = actCost;
|
||||
this.effect = effect;
|
||||
this.name = name;
|
||||
keyList.add(name);
|
||||
ritualMap.put(name, this);
|
||||
this.customRenderer = renderer;
|
||||
}
|
||||
|
||||
public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name)
|
||||
{
|
||||
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
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public void removeRitualFromList()
|
||||
{
|
||||
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 "";
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public static boolean checkRitualIsValid(World world, int x, int y, int z, String ritualID)
|
||||
{
|
||||
int direction = Rituals.getDirectionOfRitual(world, x, y, z, ritualID);
|
||||
|
||||
if (direction != -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1 - NORTH
|
||||
* 2 - EAST
|
||||
* 3 - SOUTH
|
||||
* 4 - WEST
|
||||
*/
|
||||
public static boolean checkDirectionOfRitualValid(World world, int x, int y, int z, String ritualID, int direction)
|
||||
{
|
||||
List<RitualComponent> ritual = Rituals.getRitualList(ritualID);
|
||||
|
||||
if (ritual == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Block test = null;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 1:
|
||||
for (RitualComponent rc : ritual)
|
||||
{
|
||||
test = world.getBlock(x + rc.getX(), y + rc.getY(), z + rc.getZ());
|
||||
|
||||
if (!(test instanceof IRitualStone))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world.getBlockMetadata(x + rc.getX(), y + rc.getY(), z + rc.getZ()) != rc.getStoneType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
for (RitualComponent rc : ritual)
|
||||
{
|
||||
test = world.getBlock(x - rc.getZ(), y + rc.getY(), z + rc.getX());
|
||||
|
||||
if (!(test instanceof IRitualStone))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world.getBlockMetadata(x - rc.getZ(), y + rc.getY(), z + rc.getX()) != rc.getStoneType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
for (RitualComponent rc : ritual)
|
||||
{
|
||||
test = world.getBlock(x - rc.getX(), y + rc.getY(), z - rc.getZ());
|
||||
|
||||
if (!(test instanceof IRitualStone))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world.getBlockMetadata(x - rc.getX(), y + rc.getY(), z - rc.getZ()) != rc.getStoneType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 4:
|
||||
for (RitualComponent rc : ritual)
|
||||
{
|
||||
test = world.getBlock(x + rc.getZ(), y + rc.getY(), z - rc.getX());
|
||||
|
||||
if (!(test instanceof IRitualStone))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world.getBlockMetadata(x + rc.getZ(), y + rc.getY(), z - rc.getX()) != rc.getStoneType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getDirectionOfRitual(World world, int x, int y, int z, String ritualID)
|
||||
{
|
||||
for (int i = 1; i <= 4; i++)
|
||||
{
|
||||
if (Rituals.checkDirectionOfRitualValid(world, x, y, z, ritualID, i))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int getCostForActivation(String ritualID)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
private List<RitualComponent> obtainComponents()
|
||||
{
|
||||
return this.effect.getRitualComponentList();
|
||||
}
|
||||
|
||||
private int getCrystalLevel()
|
||||
{
|
||||
return this.crystalLevel;
|
||||
}
|
||||
|
||||
private MRSRenderer getRenderer()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int getNumberOfRituals()
|
||||
{
|
||||
return ritualMap.size();
|
||||
}
|
||||
|
||||
public String getRitualName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public static String getNameOfRitual(String id)
|
||||
{
|
||||
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 = "";
|
||||
|
||||
for (String str : keyList)
|
||||
{
|
||||
if (firstKey.equals(""))
|
||||
{
|
||||
firstKey = str;
|
||||
}
|
||||
if (hasSpotted)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
if (str.equals(key))
|
||||
{
|
||||
hasSpotted = true;
|
||||
}
|
||||
}
|
||||
|
||||
return firstKey;
|
||||
}
|
||||
|
||||
public static String getPreviousRitualKey(String key)
|
||||
{
|
||||
boolean hasSpotted = false;
|
||||
String lastKey = keyList.get(keyList.size() - 1);
|
||||
|
||||
for (String str : keyList)
|
||||
{
|
||||
if (str.equals(key))
|
||||
{
|
||||
hasSpotted = true;
|
||||
}
|
||||
if (hasSpotted)
|
||||
{
|
||||
return lastKey;
|
||||
}
|
||||
lastKey = str;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package WayofTime.alchemicalWizardry.api.soulNetwork;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class LifeEssenceNetwork extends net.minecraft.world.WorldSavedData
|
||||
{
|
||||
public int currentEssence;
|
||||
|
||||
public LifeEssenceNetwork(String par1Str)
|
||||
{
|
||||
super(par1Str);
|
||||
currentEssence = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
currentEssence = nbttagcompound.getInteger("currentEssence");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
nbttagcompound.setInteger("currentEssence", currentEssence);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,303 @@
|
|||
package WayofTime.alchemicalWizardry.api.soulNetwork;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
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);
|
||||
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)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
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 (data.currentEssence >= damageToBeDone)
|
||||
{
|
||||
data.currentEssence -= damageToBeDone;
|
||||
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)
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int amount = SoulNetworkHandler.syphonFromNetwork(ist, damageToBeDone);
|
||||
|
||||
hurtPlayer(player, damageToBeDone - amount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean syphonAndDamageFromNetwork(String ownerName, EntityPlayer player, int damageToBeDone)
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int amount = SoulNetworkHandler.syphonFromNetwork(ownerName, damageToBeDone);
|
||||
|
||||
hurtPlayer(player, damageToBeDone - amount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean canSyphonFromOnlyNetwork(ItemStack ist, int damageToBeDone)
|
||||
{
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
|
||||
{
|
||||
String ownerName = ist.getTagCompound().getString("ownerName");
|
||||
|
||||
return canSyphonFromOnlyNetwork(ownerName, damageToBeDone);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean canSyphonFromOnlyNetwork(String ownerName, int damageToBeDone)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return data.currentEssence >= damageToBeDone;
|
||||
}
|
||||
|
||||
public static int getCurrentEssence(String ownerName)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return data.currentEssence;
|
||||
}
|
||||
|
||||
public static void setCurrentEssence(String ownerName, int essence)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
int currEss = data.currentEssence;
|
||||
|
||||
if (currEss >= maximum)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int newEss = Math.min(maximum, currEss + addedEssence);
|
||||
data.currentEssence = newEss;
|
||||
|
||||
return newEss - currEss;
|
||||
}
|
||||
|
||||
public static void hurtPlayer(EntityPlayer user, int energySyphoned)
|
||||
{
|
||||
if (energySyphoned < 100 && energySyphoned > 0)
|
||||
{
|
||||
if (!user.capabilities.isCreativeMode)
|
||||
{
|
||||
user.setHealth((user.getHealth() - 1));
|
||||
|
||||
if (user.getHealth() <= 0.0005f)
|
||||
{
|
||||
user.onDeath(DamageSource.generic);
|
||||
}
|
||||
}
|
||||
} else if (energySyphoned >= 100)
|
||||
{
|
||||
if (!user.capabilities.isCreativeMode)
|
||||
{
|
||||
for (int i = 0; i < ((energySyphoned + 99) / 100); i++)
|
||||
{
|
||||
user.setHealth((user.getHealth() - 1));
|
||||
|
||||
if (user.getHealth() <= 0.0005f)
|
||||
{
|
||||
user.onDeath(DamageSource.generic);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player)
|
||||
{
|
||||
if (item.stackTagCompound == null)
|
||||
{
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (item.stackTagCompound.getString("ownerName").equals(""))
|
||||
{
|
||||
item.stackTagCompound.setString("ownerName", SoulNetworkHandler.getUsername(player));
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkAndSetItemOwner(ItemStack item, String ownerName)
|
||||
{
|
||||
if (item.stackTagCompound == null)
|
||||
{
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (item.stackTagCompound.getString("ownerName").equals(""))
|
||||
{
|
||||
item.stackTagCompound.setString("ownerName", ownerName);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getUsername(EntityPlayer player)
|
||||
{
|
||||
return player.getDisplayName();
|
||||
}
|
||||
|
||||
public static EntityPlayer getPlayerForUsername(String 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("")))
|
||||
{
|
||||
String ownerName = stack.getTagCompound().getString("ownerName");
|
||||
|
||||
SoulNetworkHandler.causeNauseaToPlayer(ownerName);
|
||||
}
|
||||
}
|
||||
|
||||
public static void causeNauseaToPlayer(String ownerName)
|
||||
{
|
||||
EntityPlayer entityOwner = SoulNetworkHandler.getPlayerForUsername(ownerName);
|
||||
|
||||
if (entityOwner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package WayofTime.alchemicalWizardry.api.summoningRegistry;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class SummoningHelper
|
||||
{
|
||||
protected String id;
|
||||
|
||||
public SummoningHelper(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public abstract EntityLivingBase getEntity(World worldObj);
|
||||
|
||||
public String getSummoningHelperID()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package WayofTime.alchemicalWizardry.api.summoningRegistry;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SummoningRegistry
|
||||
{
|
||||
public static List<SummoningRegistryComponent> summoningList = new ArrayList();
|
||||
|
||||
public static void registerSummon(SummoningHelper s, ItemStack[] ring1, ItemStack[] ring2, ItemStack[] ring3, int amountUsed, int bloodOrbLevel)
|
||||
{
|
||||
summoningList.add(new SummoningRegistryComponent(s, ring1, ring2, ring3, amountUsed, bloodOrbLevel));
|
||||
}
|
||||
|
||||
public static boolean isRecipeValid(int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3)
|
||||
{
|
||||
for (SummoningRegistryComponent src : summoningList)
|
||||
{
|
||||
if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static SummoningRegistryComponent getRegistryComponent(int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3)
|
||||
{
|
||||
for (SummoningRegistryComponent src : summoningList)
|
||||
{
|
||||
if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3))
|
||||
{
|
||||
return src;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static EntityLivingBase getEntity(World worldObj, int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3)
|
||||
{
|
||||
for (SummoningRegistryComponent src : summoningList)
|
||||
{
|
||||
if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3))
|
||||
{
|
||||
return src.getEntity(worldObj);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static EntityLivingBase getEntityWithID(World worldObj, String id)
|
||||
{
|
||||
for (SummoningRegistryComponent src : summoningList)
|
||||
{
|
||||
if (src.getSummoningHelperID().equals(id))
|
||||
{
|
||||
return src.getEntity(worldObj);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,231 @@
|
|||
package WayofTime.alchemicalWizardry.api.summoningRegistry;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class SummoningRegistryComponent
|
||||
{
|
||||
public ItemStack[] ring1 = new ItemStack[6];
|
||||
public ItemStack[] ring2 = new ItemStack[6];
|
||||
public ItemStack[] ring3 = new ItemStack[6];
|
||||
public SummoningHelper summoningHelper;
|
||||
public int summoningCost;
|
||||
public int bloodOrbLevel;
|
||||
|
||||
public SummoningRegistryComponent(SummoningHelper s, ItemStack[] newRing1, ItemStack[] newRing2, ItemStack[] newRing3, int amount, int bloodOrbLevel)
|
||||
{
|
||||
this.summoningHelper = s;
|
||||
this.ring1 = newRing1;
|
||||
this.ring2 = newRing2;
|
||||
this.ring3 = newRing3;
|
||||
this.summoningCost = amount;
|
||||
this.bloodOrbLevel = bloodOrbLevel;
|
||||
|
||||
if (this.ring1.length != 6)
|
||||
{
|
||||
ItemStack[] newRecipe = new ItemStack[6];
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (i + 1 > this.ring1.length)
|
||||
{
|
||||
newRecipe[i] = null;
|
||||
} else
|
||||
{
|
||||
newRecipe[i] = this.ring1[i];
|
||||
}
|
||||
}
|
||||
|
||||
this.ring1 = newRecipe;
|
||||
}
|
||||
|
||||
if (this.ring2.length != 6)
|
||||
{
|
||||
ItemStack[] newRecipe = new ItemStack[6];
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (i + 1 > this.ring2.length)
|
||||
{
|
||||
newRecipe[i] = null;
|
||||
} else
|
||||
{
|
||||
newRecipe[i] = this.ring2[i];
|
||||
}
|
||||
}
|
||||
|
||||
this.ring2 = newRecipe;
|
||||
}
|
||||
|
||||
if (this.ring3.length != 6)
|
||||
{
|
||||
ItemStack[] newRecipe = new ItemStack[6];
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (i + 1 > this.ring3.length)
|
||||
{
|
||||
newRecipe[i] = null;
|
||||
} else
|
||||
{
|
||||
newRecipe[i] = this.ring3[i];
|
||||
}
|
||||
}
|
||||
|
||||
this.ring3 = newRecipe;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean compareRing(int ring, ItemStack[] checkedRingRecipe)
|
||||
{
|
||||
ItemStack[] recipe;
|
||||
|
||||
if (checkedRingRecipe.length < 6)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (ring)
|
||||
{
|
||||
case 1:
|
||||
recipe = ring1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
recipe = ring2;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
recipe = ring3;
|
||||
break;
|
||||
|
||||
default:
|
||||
recipe = ring1;
|
||||
}
|
||||
|
||||
if (recipe.length != 6)
|
||||
{
|
||||
ItemStack[] newRecipe = new ItemStack[6];
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (i + 1 > recipe.length)
|
||||
{
|
||||
newRecipe[i] = null;
|
||||
} else
|
||||
{
|
||||
newRecipe[i] = recipe[i];
|
||||
}
|
||||
}
|
||||
|
||||
recipe = newRecipe;
|
||||
}
|
||||
|
||||
boolean[] checkList = new boolean[6];
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
checkList[i] = false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
ItemStack recipeItemStack = recipe[i];
|
||||
|
||||
if (recipeItemStack == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean test = false;
|
||||
|
||||
for (int j = 0; j < 6; j++)
|
||||
{
|
||||
if (checkList[j])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack checkedItemStack = checkedRingRecipe[j];
|
||||
|
||||
if (checkedItemStack == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean quickTest = false;
|
||||
|
||||
if (recipeItemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (checkedItemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
quickTest = true;
|
||||
}
|
||||
} else if (!(checkedItemStack.getItem() instanceof ItemBlock))
|
||||
{
|
||||
quickTest = true;
|
||||
}
|
||||
|
||||
if (!quickTest)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) && checkedItemStack.getItem() == recipeItemStack.getItem())
|
||||
{
|
||||
test = true;
|
||||
checkList[j] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!test)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getSummoningCost()
|
||||
{
|
||||
return summoningCost;
|
||||
}
|
||||
|
||||
public EntityLivingBase getEntity(World world)
|
||||
{
|
||||
return this.summoningHelper.getEntity(world);
|
||||
}
|
||||
|
||||
public int getBloodOrbLevel()
|
||||
{
|
||||
return this.bloodOrbLevel;
|
||||
}
|
||||
|
||||
public ItemStack[] getRingRecipeForRing(int ring)
|
||||
{
|
||||
switch (ring)
|
||||
{
|
||||
case 1:
|
||||
return ring1;
|
||||
|
||||
case 2:
|
||||
return ring2;
|
||||
|
||||
case 3:
|
||||
return ring3;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSummoningHelperID()
|
||||
{
|
||||
return this.summoningHelper.getSummoningHelperID();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package WayofTime.alchemicalWizardry.api.tile;
|
||||
|
||||
/**
|
||||
* Created by Pokefenn.
|
||||
*/
|
||||
public interface IBloodAltar
|
||||
{
|
||||
|
||||
public int getCapacity();
|
||||
|
||||
public int getCurrentBlood();
|
||||
|
||||
public int getTier();
|
||||
|
||||
public int getProgress();
|
||||
|
||||
public float getSacrificeMultiplier();
|
||||
|
||||
public float getSelfSacrificeMultiplier();
|
||||
|
||||
public float getOrbMultiplier();
|
||||
|
||||
public float getDislocationMultiplier();
|
||||
|
||||
public int getBufferCapacity();
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package WayofTime.alchemicalWizardry.client;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.client.renderer.RenderHelper;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.client.event.sound.SoundEvent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ClientEventHandler
|
||||
{
|
||||
private Minecraft mcClient = FMLClientHandler.instance().getClient();
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderLivingPlayerPost(RenderPlayerEvent.Post event)
|
||||
{
|
||||
GL11.glEnable(2929);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package WayofTime.alchemicalWizardry.client;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.CommonProxy;
|
||||
import WayofTime.alchemicalWizardry.common.EntityAirElemental;
|
||||
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.*;
|
||||
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.*;
|
||||
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
|
||||
{
|
||||
public static int renderPass;
|
||||
public static int altarRenderType;
|
||||
|
||||
@Override
|
||||
public void registerRenderers()
|
||||
{
|
||||
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());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityFallenAngel.class, new RenderFallenAngel(new ModelFallenAngel(), 0.5F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityLowerGuardian.class, new RenderLowerGuardian(new ModelLowerGuardian(), 0.5F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBileDemon.class, new RenderBileDemon(new ModelBileDemon(), 1.5F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityWingedFireDemon.class, new RenderWingedFireDemon(new ModelWingedFireDemon(), 1.0F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySmallEarthGolem.class, new RenderSmallEarthGolem(new ModelSmallEarthGolem(), 0.5F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityIceDemon.class, new RenderIceDemon(new ModelIceDemon(), 0.5F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBoulderFist.class, new RenderBoulderFist(new ModelBoulderFist(), 0.5F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityShade.class, new RenderShade(new ModelShade(), 0.5F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityAirElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityWaterElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityEarthElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityFireElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityShadeElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityHolyElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEAltar.class, new TEAltarRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEPedestal.class, new RenderPedestal());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEPlinth.class, new RenderPlinth());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEWritingTable.class, new RenderWritingTable());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEConduit.class, new RenderConduit());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TESpellEffectBlock.class, new RenderSpellEffectBlock());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TESpellEnhancementBlock.class, new RenderSpellEnhancementBlock());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TESpellParadigmBlock.class, new RenderSpellParadigmBlock());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TESpellModifierBlock.class, new RenderSpellModifierBlock());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEReagentConduit.class, new RenderReagentConduit());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEMasterStone.class, new RenderMasterStone());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEAlchemicCalcinator.class, new RenderAlchemicCalcinator());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TEBellJar.class, new RenderCrystalBelljar());
|
||||
|
||||
//Item Renderer stuff
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockConduit), new TEConduitItemRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellEffect), new TESpellEffectBlockItemRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellEnhancement), new TESpellEnhancementBlockItemRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellParadigm), new TESpellParadigmBlockItemRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellModifier), new TESpellModifierBlockItemRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockAlchemicCalcinator), new TEAlchemicalCalcinatorItemRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockCrystalBelljar), new TEBellJarItemRenderer());
|
||||
ShaderHelper.initShaders();
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getClientWorld()
|
||||
{
|
||||
return FMLClientHandler.instance().getClient().theWorld;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void InitRendering()
|
||||
{
|
||||
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockAltar), new TEAltarItemRenderer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerEvents()
|
||||
{
|
||||
FMLCommonHandler.instance().bus().register(new ClientEventHandler());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,179 @@
|
|||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.bloodOrbs;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiWritingTable;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
/**
|
||||
* NEI Alchemy Recipe Handler by joshie *
|
||||
*/
|
||||
public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
|
||||
public class CachedAlchemyRecipe extends CachedRecipe {
|
||||
public class BloodOrbs {
|
||||
public PositionedStack stack;
|
||||
|
||||
public BloodOrbs(ItemStack orb) {
|
||||
this.stack = new PositionedStack(orb, 136, 47, false);
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<BloodOrbs> orbs;
|
||||
PositionedStack output;
|
||||
List<PositionedStack> inputs;
|
||||
int lp;
|
||||
|
||||
public CachedAlchemyRecipe(AlchemyRecipe recipe, ItemStack orb) {
|
||||
this(recipe);
|
||||
this.orbs = new ArrayList<BloodOrbs>();
|
||||
orbs.add(new BloodOrbs(orb));
|
||||
}
|
||||
|
||||
public CachedAlchemyRecipe(AlchemyRecipe recipe) {
|
||||
List<PositionedStack> inputs = new ArrayList<PositionedStack>();
|
||||
ItemStack[] stacks = recipe.getRecipe();
|
||||
if (stacks.length > 0) inputs.add(new PositionedStack(stacks[0], 76, 3));
|
||||
if (stacks.length > 1) inputs.add(new PositionedStack(stacks[1], 51, 19));
|
||||
if (stacks.length > 2) inputs.add(new PositionedStack(stacks[2], 101, 19));
|
||||
if (stacks.length > 3) inputs.add(new PositionedStack(stacks[3], 64, 47));
|
||||
if (stacks.length > 4) inputs.add(new PositionedStack(stacks[4], 88, 47));
|
||||
this.inputs = inputs;
|
||||
this.output = new PositionedStack(recipe.getResult(), 76, 25);
|
||||
this.lp = recipe.getAmountNeeded() * 100;
|
||||
this.orbs = new ArrayList<BloodOrbs>();
|
||||
for (Item orb : bloodOrbs) {
|
||||
if (((IBloodOrb) orb).getOrbLevel() >= recipe.getOrbLevel()) {
|
||||
orbs.add(new BloodOrbs(new ItemStack(orb)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getOtherStack() {
|
||||
if (orbs == null || orbs.size() <= 0) return null;
|
||||
return orbs.get((cycleticks / 48) % orbs.size()).stack;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateRecipeHandler newInstance() {
|
||||
for (ItemStack item : ItemList.items) {
|
||||
if (item != null && item.getItem() instanceof IBloodOrb) {
|
||||
bloodOrbs.add(item.getItem());
|
||||
}
|
||||
}
|
||||
|
||||
return super.newInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "alchemicalwizardry.alchemy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(134, 22, 16, 24), "alchemicalwizardry.alchemy"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GuiWritingTable.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("alchemicalwizardry.alchemy") && getClass() == NEIAlchemyRecipeHandler.class) {
|
||||
for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
|
||||
if (recipe.getResult() != null) arecipes.add(new CachedAlchemyRecipe(recipe));
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
|
||||
if (recipe == null) continue;
|
||||
ItemStack output = recipe.getResult();
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(result, recipe.getResult())) {
|
||||
arecipes.add(new CachedAlchemyRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
if (ingredient.getItem() instanceof IBloodOrb) {
|
||||
for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
|
||||
if (recipe == null) continue;
|
||||
if (((IBloodOrb) ingredient.getItem()).getOrbLevel() >= recipe.getOrbLevel()) {
|
||||
arecipes.add(new CachedAlchemyRecipe(recipe, ingredient));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
|
||||
if (recipe == null) continue;
|
||||
ItemStack[] stacks = recipe.getRecipe();
|
||||
for (ItemStack stack : stacks) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(stack, ingredient)) {
|
||||
arecipes.add(new CachedAlchemyRecipe(recipe));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int id) {
|
||||
CachedAlchemyRecipe cache = (CachedAlchemyRecipe) arecipes.get(id);
|
||||
Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + cache.lp + "LP", getLPX(cache.lp), 34, 0);
|
||||
}
|
||||
|
||||
public int getLPX(int lp) {
|
||||
if (lp < 10) return 122;
|
||||
else if (lp < 100) return 122;
|
||||
else if (lp < 1000) return 130;
|
||||
else if (lp < 10000) return 127;
|
||||
else if (lp < 100000) return 124;
|
||||
return 122;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.blockWritingTable.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return new ResourceLocation("alchemicalwizardry", "gui/nei/alchemy.png").toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,185 @@
|
|||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
/**
|
||||
* NEI Altar Recipe Handler by joshie *
|
||||
*/
|
||||
public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
|
||||
public class CachedAltarRecipe extends CachedRecipe {
|
||||
PositionedStack input;
|
||||
PositionedStack output;
|
||||
int tier, lp_amount, consumption, drain;
|
||||
|
||||
public CachedAltarRecipe(AltarRecipe recipe) {
|
||||
input = new PositionedStack(recipe.requiredItem, 38, 2, false);
|
||||
output = new PositionedStack(recipe.result, 132, 32, false);
|
||||
tier = recipe.minTier;
|
||||
lp_amount = recipe.liquidRequired;
|
||||
consumption = recipe.consumptionRate;
|
||||
drain = recipe.drainRate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("alchemicalwizardry.altar") && getClass() == NEIAltarRecipeHandler.class) {
|
||||
for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
|
||||
if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.result, result)) {
|
||||
if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.requiredItem, ingredient)) {
|
||||
if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Mouse Position helper
|
||||
public Point getMouse(int width, int height) {
|
||||
Point mousepos = this.getMousePosition();
|
||||
int guiLeft = (width - 176) / 2;
|
||||
int guiTop = (height - 166) / 2;
|
||||
Point relMouse = new Point(mousepos.x - guiLeft, mousepos.y - guiTop);
|
||||
return relMouse;
|
||||
}
|
||||
|
||||
//width helper, getting width normal way hates me on compile
|
||||
public int getGuiWidth(GuiRecipe gui) {
|
||||
try {
|
||||
Field f = gui.getClass().getField("width");
|
||||
return (Integer) f.get(gui);
|
||||
} catch (NoSuchFieldException e) {
|
||||
try {
|
||||
Field f = gui.getClass().getField("field_146294_l");
|
||||
return (Integer) f.get(gui);
|
||||
} catch (Exception e2) {
|
||||
return 0;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//height helper, getting height normal way hates me on compile
|
||||
public int getGuiHeight(GuiRecipe gui) {
|
||||
try {
|
||||
Field f = gui.getClass().getField("height");
|
||||
return (Integer) f.get(gui);
|
||||
} catch (NoSuchFieldException e) {
|
||||
try {
|
||||
Field f = gui.getClass().getField("field_146295_m");
|
||||
return (Integer) f.get(gui);
|
||||
} catch (Exception e2) {
|
||||
return 0;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int id) {
|
||||
CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
|
||||
Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + StatCollector.translateToLocal("bm.string.tier") + ": " + recipe.tier, 78, 5, 0);
|
||||
Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + "LP: " + recipe.lp_amount, 78, 15, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int id) {
|
||||
currenttip = super.handleTooltip(gui, currenttip, id);
|
||||
Point mouse = getMouse(getGuiWidth(gui), getGuiHeight(gui));
|
||||
CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
|
||||
int yLow = id % 2 == 0 ? 38 : 102;
|
||||
int yHigh = id % 2 == 0 ? 72 : 136;
|
||||
if(mouse.x >= 19 && mouse.x <= 80 && mouse.y >= yLow && mouse.y <= yHigh) {
|
||||
currenttip.add(StatCollector.translateToLocal("bm.string.consume") + ": " + recipe.consumption + "LP/t");
|
||||
currenttip.add(StatCollector.translateToLocal("bm.string.drain") + ": " + recipe.drain + "LP/t");
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "altarrecipes";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(90, 32, 22, 16), "alchemicalwizardry.altar"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return " " + StatCollector.translateToLocal("tile.bloodAltar.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return new ResourceLocation("alchemicalwizardry", "gui/nei/altar.png").toString();
|
||||
}
|
||||
|
||||
public static Point getMousePosition() {
|
||||
Dimension size = displaySize();
|
||||
Dimension res = displayRes();
|
||||
return new Point(Mouse.getX() * size.width / res.width, size.height - Mouse.getY() * size.height / res.height - 1);
|
||||
}
|
||||
|
||||
public static Dimension displaySize() {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
return new Dimension(res.getScaledWidth(), res.getScaledHeight());
|
||||
}
|
||||
|
||||
public static Dimension displayRes() {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
return new Dimension(mc.displayWidth, mc.displayHeight);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.ShapedRecipeHandler;
|
||||
|
||||
/**
|
||||
* NEI Blood Orb Shaped Recipe Handler by joshie *
|
||||
*/
|
||||
public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
|
||||
public class CachedBloodOrbRecipe extends CachedShapedRecipe {
|
||||
public CachedBloodOrbRecipe(int width, int height, Object[] items, ItemStack out) {
|
||||
super(width, height, items, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIngredients(int width, int height, Object[] items) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
if (items[y * width + x] == null)
|
||||
continue;
|
||||
|
||||
Object o = items[y * width + x];
|
||||
if (o instanceof ItemStack) {
|
||||
PositionedStack stack = new PositionedStack(items[y * width + x], 25 + x * 18, 6 + y * 18, false);
|
||||
stack.setMaxSize(1);
|
||||
ingredients.add(stack);
|
||||
} else if (o instanceof Integer) {
|
||||
ArrayList<ItemStack> orbs = new ArrayList();
|
||||
for (Item item : NEIConfig.bloodOrbs) {
|
||||
if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) {
|
||||
orbs.add(new ItemStack(item));
|
||||
}
|
||||
}
|
||||
|
||||
PositionedStack stack = new PositionedStack(orbs, 25 + x * 18, 6 + y * 18, false);
|
||||
stack.setMaxSize(1);
|
||||
ingredients.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapedHandler.class) {
|
||||
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
|
||||
if (irecipe instanceof ShapedBloodOrbRecipe) {
|
||||
CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
recipe.computeVisuals();
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
|
||||
if (irecipe instanceof ShapedBloodOrbRecipe) {
|
||||
CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
|
||||
if (recipe == null || !NEIServerUtils.areStacksSameTypeCrafting(recipe.result.item, result))
|
||||
continue;
|
||||
|
||||
recipe.computeVisuals();
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
|
||||
CachedShapedRecipe recipe = null;
|
||||
if (irecipe instanceof ShapedBloodOrbRecipe)
|
||||
recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
|
||||
|
||||
if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem()))
|
||||
continue;
|
||||
|
||||
recipe.computeVisuals();
|
||||
if (recipe.contains(recipe.ingredients, ingredient)) {
|
||||
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private CachedBloodOrbRecipe forgeShapedRecipe(ShapedBloodOrbRecipe recipe) {
|
||||
int width;
|
||||
int height;
|
||||
try {
|
||||
width = recipe.width;
|
||||
height = recipe.height;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
Object[] items = recipe.getInput();
|
||||
for (Object item : items)
|
||||
if (item instanceof List && ((List<?>) item).isEmpty())// ore
|
||||
// handler,
|
||||
// no ores
|
||||
return null;
|
||||
|
||||
return new CachedBloodOrbRecipe(width, height, items, recipe.getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "crafting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("bm.string.crafting.orb.shaped");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.ShapelessRecipeHandler;
|
||||
|
||||
/**
|
||||
* NEI Blood Orb Shapeless Recipe Handler by joshie *
|
||||
*/
|
||||
public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
|
||||
public class CachedBloodOrbRecipe extends CachedShapelessRecipe {
|
||||
public CachedBloodOrbRecipe(ArrayList<Object> items, ItemStack recipeOutput) {
|
||||
super(items, recipeOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIngredients(List<?> items) {
|
||||
ingredients.clear();
|
||||
for (int ingred = 0; ingred < items.size(); ingred++) {
|
||||
Object o = items.get(ingred);
|
||||
if (o instanceof ItemStack) {
|
||||
PositionedStack stack = new PositionedStack(items.get(ingred), 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
|
||||
stack.setMaxSize(1);
|
||||
ingredients.add(stack);
|
||||
} else if (o instanceof Integer) {
|
||||
ArrayList<ItemStack> orbs = new ArrayList();
|
||||
for (Item item : NEIConfig.bloodOrbs) {
|
||||
if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) {
|
||||
orbs.add(new ItemStack(item));
|
||||
}
|
||||
}
|
||||
|
||||
PositionedStack stack = new PositionedStack(orbs, 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
|
||||
stack.setMaxSize(1);
|
||||
ingredients.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapelessHandler.class) {
|
||||
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes) {
|
||||
CachedBloodOrbRecipe recipe = null;
|
||||
if (irecipe instanceof ShapelessBloodOrbRecipe)
|
||||
recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
|
||||
CachedBloodOrbRecipe recipe = null;
|
||||
if (irecipe instanceof ShapelessBloodOrbRecipe)
|
||||
recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes) {
|
||||
CachedBloodOrbRecipe recipe = null;
|
||||
if (irecipe instanceof ShapelessBloodOrbRecipe)
|
||||
recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
if (recipe.contains(recipe.ingredients, ingredient)) {
|
||||
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CachedBloodOrbRecipe forgeShapelessRecipe(ShapelessBloodOrbRecipe recipe) {
|
||||
ArrayList<Object> items = recipe.getInput();
|
||||
|
||||
for (Object item : items)
|
||||
if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
|
||||
return null;
|
||||
|
||||
return new CachedBloodOrbRecipe(items, recipe.getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "crafting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("bm.string.crafting.orb.shapeless");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
|
||||
public class NEIConfig implements IConfigureNEI {
|
||||
public static ArrayList<Item> bloodOrbs = new ArrayList<Item>();
|
||||
|
||||
@Override
|
||||
public void loadConfig() {
|
||||
API.registerRecipeHandler(new NEIAlchemyRecipeHandler());
|
||||
API.registerUsageHandler(new NEIAlchemyRecipeHandler());
|
||||
API.registerRecipeHandler(new NEIAltarRecipeHandler());
|
||||
API.registerUsageHandler(new NEIAltarRecipeHandler());
|
||||
API.registerRecipeHandler(new NEIBloodOrbShapedHandler());
|
||||
API.registerUsageHandler(new NEIBloodOrbShapedHandler());
|
||||
API.registerRecipeHandler(new NEIBloodOrbShapelessHandler());
|
||||
API.registerUsageHandler(new NEIBloodOrbShapelessHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Blood Magic NEI";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "1.3";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
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 String colorCode;
|
||||
|
||||
public ColourThreshold(int t, String c)
|
||||
{
|
||||
threshold = t;
|
||||
colorCode = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.valueOf(threshold) + ", " + colorCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ColourThreshold o)
|
||||
{
|
||||
if (this.threshold > o.threshold)
|
||||
return 1;
|
||||
else if (this.threshold < o.threshold)
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the colorCode attached to the first threshold in the list that is
|
||||
* >= value. Expects that the list has been sorted by threshold ascending.
|
||||
*/
|
||||
public static String getColorCode(List<ColourThreshold> colorList, int value)
|
||||
{
|
||||
for (ColourThreshold ct : colorList)
|
||||
if (value <= ct.threshold)
|
||||
return ct.colorCode;
|
||||
|
||||
return "f";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
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;
|
||||
|
||||
public class HUDElement
|
||||
{
|
||||
public final ItemStack itemStack;
|
||||
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 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();
|
||||
|
||||
public HUDElement(ItemStack itemStack, int iconW, int iconH, int padW, int value)
|
||||
{
|
||||
this.itemStack = itemStack;
|
||||
this.iconW = iconW;
|
||||
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)
|
||||
{
|
||||
itemDamage = "\247" + ColourThreshold.getColorCode(BloodMagicConfiguration.colorList,
|
||||
(thresholdPercent ? damage * 100 / maxDamage : damage)) + this.value;
|
||||
} else if (showValue)
|
||||
itemDamage = "\247" + ColourThreshold.getColorCode(BloodMagicConfiguration.colorList,
|
||||
(thresholdPercent ? damage * 100 / maxDamage : damage)) + damage +
|
||||
(showMaxDamage ? "/" + maxDamage : "");
|
||||
else if (showPercent)
|
||||
itemDamage = "\247" + ColourThreshold.getColorCode(BloodMagicConfiguration.colorList,
|
||||
(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);
|
||||
GL11.glEnable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRenderer.zLevel = 200.0F;
|
||||
|
||||
//if (ArmorStatusHUD.alignMode.toLowerCase().contains("right"))
|
||||
boolean toRight = true;
|
||||
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
|
||||
{
|
||||
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);
|
||||
}
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,271 @@
|
|||
package WayofTime.alchemicalWizardry.client.renderer;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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;
|
||||
|
||||
/**
|
||||
* This class is a utility class that was created by bspkrs.
|
||||
* https://github.com/bspkrs/bspkrsCore/blob/master/src/main/java/bspkrs/client/util/HUDUtils.java
|
||||
*/
|
||||
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};
|
||||
|
||||
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 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
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
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 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
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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 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
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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 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
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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;
|
||||
int canvasHeight = height - topBorder - bottomBorder;
|
||||
int xPasses = canvasWidth / fillerWidth;
|
||||
int remainderWidth = canvasWidth % fillerWidth;
|
||||
int yPasses = canvasHeight / fillerHeight;
|
||||
int remainderHeight = canvasHeight % fillerHeight;
|
||||
|
||||
// Draw Border
|
||||
// Top Left
|
||||
drawTexturedModalRect(x, y, u, v, leftBorder, topBorder, zLevel);
|
||||
// Top Right
|
||||
drawTexturedModalRect(x + leftBorder + canvasWidth, y, u + leftBorder + fillerWidth, v, rightBorder, topBorder, zLevel);
|
||||
// Bottom Left
|
||||
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++)
|
||||
{
|
||||
// Left Border
|
||||
drawTexturedModalRect(x, y + topBorder + (j * fillerHeight), u, v + topBorder, leftBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel);
|
||||
// Right Border
|
||||
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;
|
||||
float var8 = 0.00390625F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((x + 0), (y + height), zLevel, ((u + 0) * var7), ((v + height) * var8));
|
||||
tessellator.addVertexWithUV((x + width), (y + height), zLevel, ((u + width) * var7), ((v + height) * var8));
|
||||
tessellator.addVertexWithUV((x + width), (y + 0), zLevel, ((u + width) * var7), ((v + 0) * var8));
|
||||
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.
|
||||
*/
|
||||
public static void renderItemOverlayIntoGUI(FontRenderer fontRenderer, ItemStack itemStack, int x, int y)
|
||||
{
|
||||
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.
|
||||
*/
|
||||
public static void renderItemOverlayIntoGUI(FontRenderer fontRenderer, ItemStack itemStack, int x, int y, boolean showDamageBar, boolean showCount)
|
||||
{
|
||||
if (itemStack != null && (showDamageBar || showCount))
|
||||
{
|
||||
if (itemStack.isItemDamaged() && showDamageBar)
|
||||
{
|
||||
int var11 = (int) Math.round(13.0D - itemStack.getItemDamageForDisplay() * 13.0D / itemStack.getMaxDamage());
|
||||
int var7 = (int) Math.round(255.0D - itemStack.getItemDamageForDisplay() * 255.0D / itemStack.getMaxDamage());
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
Tessellator var8 = Tessellator.instance;
|
||||
int var9 = 255 - var7 << 16 | var7 << 8;
|
||||
int var10 = (255 - var7) / 4 << 16 | 16128;
|
||||
renderQuad(var8, x + 2, y + 13, 13, 2, 0);
|
||||
renderQuad(var8, x + 2, y + 13, 12, 1, var10);
|
||||
renderQuad(var8, x + 2, y + 13, var11, 1, var9);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
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;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
fontRenderer.drawStringWithShadow(var6, x + 19 - 2 - fontRenderer.getStringWidth(var6), y + 6 + 3, 16777215);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public static void renderQuad(Tessellator tessellator, int x, int y, int width, int height, int color)
|
||||
{
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_I(color);
|
||||
tessellator.addVertex((x + 0), (y + 0), 0.0D);
|
||||
tessellator.addVertex((x + 0), (y + height), 0.0D);
|
||||
tessellator.addVertex((x + width), (y + height), 0.0D);
|
||||
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;
|
||||
for (int i = 0; i < player.inventory.mainInventory.length; i++)
|
||||
if (player.inventory.mainInventory[i] != null && item.equals(player.inventory.mainInventory[i].getItem()) && (md == -1 || player.inventory.mainInventory[i].getItemDamage() == md))
|
||||
count += player.inventory.mainInventory[i].stackSize;
|
||||
return count;
|
||||
}
|
||||
|
||||
public static String stripCtrl(String s)
|
||||
{
|
||||
return s.replaceAll("(?i)\247[0-9a-fklmnor]", "");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,180 @@
|
|||
package WayofTime.alchemicalWizardry.client.renderer;
|
||||
|
||||
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.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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RenderHelper
|
||||
{
|
||||
public static boolean showEquippedItem = true;
|
||||
public static boolean enableItemName = false;
|
||||
public static boolean enabled = true;
|
||||
public static boolean showInChat = true;
|
||||
|
||||
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);
|
||||
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)
|
||||
{
|
||||
List<HUDElement> elements = new ArrayList();
|
||||
|
||||
MovingObjectPosition movingobjectposition = mc.objectMouseOver;
|
||||
World world = mc.theWorld;
|
||||
|
||||
if (movingobjectposition == null)
|
||||
{
|
||||
return elements;
|
||||
} else
|
||||
{
|
||||
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))
|
||||
{
|
||||
return elements;
|
||||
}
|
||||
|
||||
IReagentHandler relay = (IReagentHandler) tile;
|
||||
|
||||
ReagentContainerInfo[] infos = relay.getContainerInfo(ForgeDirection.getOrientation(movingobjectposition.sideHit));
|
||||
|
||||
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);
|
||||
|
||||
if (itemStack != null)
|
||||
elements.add(new HUDElement(itemStack, 16, 16, 2, info.reagent.amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return elements;
|
||||
}
|
||||
|
||||
private static int getX(int width)
|
||||
{
|
||||
if (alignMode.toLowerCase().contains("center"))
|
||||
return scaledResolution.getScaledWidth() / 2 - width / 2 + (applyXOffsetToCenter ? xOffset : 0);
|
||||
else if (alignMode.toLowerCase().contains("right"))
|
||||
return scaledResolution.getScaledWidth() - width - xOffset;
|
||||
else
|
||||
return xOffset;
|
||||
}
|
||||
|
||||
private static int getY(int rowCount, int height)
|
||||
{
|
||||
if (alignMode.toLowerCase().contains("middle"))
|
||||
return (scaledResolution.getScaledHeight() / 2) - ((rowCount * height) / 2) + (applyYOffsetToMiddle ? yOffset : 0);
|
||||
else if (alignMode.equalsIgnoreCase("bottomleft") || alignMode.equalsIgnoreCase("bottomright"))
|
||||
return scaledResolution.getScaledHeight() - (rowCount * height) - yOffset;
|
||||
else if (alignMode.equalsIgnoreCase("bottomcenter"))
|
||||
return scaledResolution.getScaledHeight() - (rowCount * height) - yOffsetBottomCenter;
|
||||
else
|
||||
return yOffset;
|
||||
}
|
||||
|
||||
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"))
|
||||
{
|
||||
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"))
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,498 @@
|
|||
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 net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerCapabilities;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.event.AnvilUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
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 vazkii.botania.api.internal.IManaBurst;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.items.BoundArmour;
|
||||
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.Optional;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class AlchemicalWizardryEventHooks
|
||||
{
|
||||
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 onAnvilUpdateEvent(AnvilUpdateEvent event)
|
||||
{
|
||||
if(event.isCancelable() && event.left != null && event.left.getItem() instanceof BoundArmour && event.right != null)
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerDamageEvent(LivingAttackEvent event)
|
||||
{
|
||||
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)
|
||||
{
|
||||
GameRegistry d;
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingJumpEvent(LivingJumpEvent event)
|
||||
{
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionBoost))
|
||||
{
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier();
|
||||
event.entityLiving.motionY += (0.1f) * (2 + i);
|
||||
}
|
||||
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart))
|
||||
{
|
||||
event.entityLiving.motionY = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEndermanTeleportEvent(EnderTeleportEvent event)
|
||||
{
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding) && event.isCancelable())
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityDamaged(LivingAttackEvent event)
|
||||
{
|
||||
EntityLivingBase entityAttacked = event.entityLiving;
|
||||
|
||||
if (entityAttacked.isPotionActive(AlchemicalWizardry.customPotionReciprocation))
|
||||
{
|
||||
Entity entityAttacking = event.source.getSourceOfDamage();
|
||||
|
||||
if (entityAttacking != null && entityAttacking instanceof EntityLivingBase)
|
||||
{
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionReciprocation).getAmplifier();
|
||||
float damageRecieve = event.ammount / 2 * (i + 1);
|
||||
((EntityLivingBase) entityAttacking).attackEntityFrom(DamageSource.generic, damageRecieve);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @ForgeSubscribe
|
||||
// public void onFOVUpdate(FOVUpdateEvent event)
|
||||
// {
|
||||
// event.setResult(Result.DEFAULT);
|
||||
// }
|
||||
|
||||
// @SubscribeEvent
|
||||
// public void onPlayerTickEnd(PlayerTickEvent event)
|
||||
// {
|
||||
// if(event.type.equals(Type.PLAYER) && event.phase.equals(TickEvent.Phase.END))
|
||||
// {
|
||||
// ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, event.player.capabilities, Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"});
|
||||
// }
|
||||
// }
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityUpdate(LivingUpdateEvent event)
|
||||
{
|
||||
EntityLivingBase entityLiving = event.entityLiving;
|
||||
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)
|
||||
{
|
||||
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;
|
||||
boolean highStepListed = playersWith1Step.contains(entityPlayer.getDisplayName());
|
||||
boolean hasHighStep = entityPlayer.isPotionActive(AlchemicalWizardry.customPotionBoost);
|
||||
|
||||
if (hasHighStep && !highStepListed)
|
||||
{
|
||||
playersWith1Step.add(SpellHelper.getUsername(entityPlayer));
|
||||
}
|
||||
|
||||
if (!hasHighStep && highStepListed)
|
||||
{
|
||||
playersWith1Step.remove(SpellHelper.getUsername(entityPlayer));
|
||||
entityPlayer.stepHeight = 0.5F;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionFeatherFall))
|
||||
{
|
||||
event.entityLiving.fallDistance = 0;
|
||||
}
|
||||
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionDrowning))
|
||||
{
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionDrowning).getAmplifier();
|
||||
|
||||
if (event.entityLiving.worldObj.getWorldTime() % ((int) (20 / (i + 1))) == 0)
|
||||
{
|
||||
event.entityLiving.attackEntityFrom(DamageSource.drown, 2);
|
||||
event.entityLiving.hurtResistantTime = Math.min(event.entityLiving.hurtResistantTime, 20 / (i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionBoost))
|
||||
{
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier();
|
||||
EntityLivingBase entity = event.entityLiving;
|
||||
//if(!entity.isSneaking())
|
||||
{
|
||||
float percentIncrease = (i + 1) * 0.05f;
|
||||
|
||||
if (event.entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
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 (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionProjProt))
|
||||
{
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionProjProt).getAmplifier();
|
||||
EntityLivingBase entity = event.entityLiving;
|
||||
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);
|
||||
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();
|
||||
EntityLivingBase livingEntity;
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Entity projectile = (Entity) iterator.next();
|
||||
|
||||
if (projectile == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(projectile instanceof IProjectile) || (AlchemicalWizardry.isBotaniaLoaded && isManaBurst(projectile)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Entity throwingEntity = null;
|
||||
|
||||
if (projectile instanceof EntityArrow)
|
||||
{
|
||||
throwingEntity = ((EntityArrow) projectile).shootingEntity;
|
||||
} else if (projectile instanceof EnergyBlastProjectile)
|
||||
{
|
||||
throwingEntity = ((EnergyBlastProjectile) projectile).shootingEntity;
|
||||
} else if (projectile instanceof EntityThrowable)
|
||||
{
|
||||
throwingEntity = ((EntityThrowable) projectile).getThrower();
|
||||
}
|
||||
|
||||
if (throwingEntity != null && throwingEntity.equals(entity))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
double delX = projectile.posX - entity.posX;
|
||||
double delY = projectile.posY - entity.posY;
|
||||
double delZ = projectile.posZ - entity.posZ;
|
||||
|
||||
if (throwingEntity != null)
|
||||
{
|
||||
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;
|
||||
double newVel = Math.sqrt(projectile.motionX * projectile.motionX + projectile.motionY * projectile.motionY + projectile.motionZ * projectile.motionZ);
|
||||
projectile.motionX = newVel * delX;
|
||||
projectile.motionY = newVel * delY;
|
||||
projectile.motionZ = newVel * delZ;
|
||||
//TODO make this not affect player's projectiles
|
||||
}
|
||||
}
|
||||
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlight))
|
||||
{
|
||||
if (event.entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving;
|
||||
String ownerName = SpellHelper.getUsername(entityPlayer);
|
||||
playerFlightBuff.put(ownerName, true);
|
||||
entityPlayer.capabilities.allowFlying = true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (event.entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving;
|
||||
String ownerName = SpellHelper.getUsername(entityPlayer);
|
||||
|
||||
if (!playerFlightBuff.containsKey(ownerName))
|
||||
{
|
||||
playerFlightBuff.put(ownerName, false);
|
||||
}
|
||||
|
||||
if (playerFlightBuff.get(ownerName))
|
||||
{
|
||||
playerFlightBuff.put(ownerName, false);
|
||||
|
||||
if (!entityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
entityPlayer.capabilities.allowFlying = false;
|
||||
entityPlayer.capabilities.isFlying = false;
|
||||
entityPlayer.sendPlayerAbilities();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Botania")
|
||||
private boolean isManaBurst(Entity projectile)
|
||||
{
|
||||
return projectile instanceof IManaBurst;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
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;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class AlchemicalWizardryFuelHandler implements IFuelHandler
|
||||
{
|
||||
@Override
|
||||
public int getBurnTime(ItemStack fuel)
|
||||
{
|
||||
ItemStack itemStack = fuel;
|
||||
if (itemStack == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Item fuelItem = itemStack.getItem();
|
||||
|
||||
if (fuelItem.equals(ModItems.lavaCrystal))
|
||||
{
|
||||
LavaCrystal item = (LavaCrystal) fuel.getItem();
|
||||
|
||||
if (item.hasEnoughEssence(fuel))
|
||||
{
|
||||
return 200;
|
||||
} else
|
||||
{
|
||||
NBTTagCompound tag = itemStack.stackTagCompound;
|
||||
|
||||
if (tag == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (MinecraftServer.getServer().getConfigurationManager() == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
EntityPlayer owner = SpellHelper.getPlayerForUsername(tag.getString("ownerName"));
|
||||
|
||||
if (owner == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
owner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
public class ArmourComponent
|
||||
{
|
||||
private int xOff;
|
||||
private int zOff;
|
||||
|
||||
public ArmourComponent(int xOff, int zOff)
|
||||
{
|
||||
this.xOff = xOff;
|
||||
this.zOff = zOff;
|
||||
}
|
||||
|
||||
public int getXOff()
|
||||
{
|
||||
return xOff;
|
||||
}
|
||||
|
||||
public int getZOff()
|
||||
{
|
||||
return zOff;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
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
|
||||
{
|
||||
public static String ITEMS_PNG = "/WayofTime/alchemicalWizardry/items.png";
|
||||
public static String BLOCK_PNG = "/WayofTime/alchemicalWizardry/block.png";
|
||||
|
||||
// Client stuff
|
||||
public void registerRenderers()
|
||||
{
|
||||
// Nothing here as the server doesn't render graphics!
|
||||
}
|
||||
|
||||
public void registerEntities()
|
||||
{
|
||||
}
|
||||
|
||||
public World getClientWorld()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void registerActions()
|
||||
{
|
||||
}
|
||||
|
||||
public void registerEvents()
|
||||
{
|
||||
}
|
||||
|
||||
public void registerSoundHandler()
|
||||
{
|
||||
// Nothing here as this is a server side proxy
|
||||
}
|
||||
|
||||
public void registerTileEntities()
|
||||
{
|
||||
GameRegistry.registerTileEntity(TEAltar.class, "containerAltar");
|
||||
GameRegistry.registerTileEntity(TEMasterStone.class, "containerMasterStone");
|
||||
}
|
||||
|
||||
public void registerEntityTrackers()
|
||||
{
|
||||
EntityRegistry.registerModEntity(EnergyBlastProjectile.class, "energyBlastProjectile", 0, AlchemicalWizardry.instance, 128, 5, true);
|
||||
EntityRegistry.registerModEntity(FireProjectile.class, "fireProjectile", 1, AlchemicalWizardry.instance, 128, 5, true);
|
||||
EntityRegistry.registerModEntity(IceProjectile.class, "iceProjectile", 2, AlchemicalWizardry.instance, 128, 5, true);
|
||||
EntityRegistry.registerModEntity(ExplosionProjectile.class, "explosionProjectile", 3, AlchemicalWizardry.instance, 128, 5, true);
|
||||
EntityRegistry.registerModEntity(HolyProjectile.class, "holyProjectile", 4, AlchemicalWizardry.instance, 128, 5, true);
|
||||
EntityRegistry.registerModEntity(WindGustProjectile.class, "windGustProjectile", 5, AlchemicalWizardry.instance, 128, 5, true);
|
||||
EntityRegistry.registerModEntity(LightningBoltProjectile.class, "lightningBoltProjectile", 6, AlchemicalWizardry.instance, 128, 5, true);
|
||||
EntityRegistry.registerModEntity(WaterProjectile.class, "waterProjectile", 7, AlchemicalWizardry.instance, 128, 5, true);
|
||||
EntityRegistry.registerModEntity(MudProjectile.class, "mudProjectile", 8, AlchemicalWizardry.instance, 128, 5, true);
|
||||
EntityRegistry.registerModEntity(TeleportProjectile.class, "teleportProjectile", 9, AlchemicalWizardry.instance, 128, 5, true);
|
||||
EntityRegistry.registerModEntity(EntityEnergyBazookaMainProjectile.class, "energyBazookaMain", 10, AlchemicalWizardry.instance, 128, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityEnergyBazookaSecondaryProjectile.class, "energyBazookaSecondary", 11, AlchemicalWizardry.instance, 128, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityBloodLightProjectile.class, "bloodLightProjectile", 12, AlchemicalWizardry.instance, 128, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityMeteor.class, "meteor", 13, AlchemicalWizardry.instance, 120, 3, true);
|
||||
EntityRegistry.registerModEntity(EntitySpellProjectile.class, "spellProjectile", 14, AlchemicalWizardry.instance, 128, 3, true);
|
||||
EntityRegistry.registerModEntity(EntityParticleBeam.class, "particleBeam", 15, AlchemicalWizardry.instance, 120, 3, true);
|
||||
}
|
||||
|
||||
public void registerTickHandlers()
|
||||
{
|
||||
}
|
||||
|
||||
public void InitRendering()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon;
|
||||
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
|
||||
public class EntityAITargetAggro extends EntityAINearestAttackableTarget
|
||||
{
|
||||
private EntityDemon theCreature;
|
||||
|
||||
public EntityAITargetAggro(EntityDemon par1EntityDemon, Class par2Class, int par3, boolean par4)
|
||||
{
|
||||
super(par1EntityDemon, par2Class, par3, par4);
|
||||
this.theCreature = par1EntityDemon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the EntityAIBase should begin execution.
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
return theCreature.isAggro() && super.shouldExecute();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
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;
|
||||
|
||||
public class EntityAirElemental extends EntityElemental implements IMob
|
||||
{
|
||||
public EntityAirElemental(World world)
|
||||
{
|
||||
super(world, AlchemicalWizardry.entityAirElementalID);
|
||||
}
|
||||
|
||||
public void inflictEffectOnEntity(Entity target)
|
||||
{
|
||||
if (target instanceof EntityPlayer)
|
||||
{
|
||||
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)
|
||||
{
|
||||
((EntityLivingBase) target).motionY += 3.0D;
|
||||
((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
public interface IBindingAgent
|
||||
{
|
||||
public abstract float getSuccessRateForPotionNumber(int potionEffects);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
public interface ICatalyst
|
||||
{
|
||||
public abstract int getCatalystLevel();
|
||||
|
||||
public abstract boolean isConcentration();
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
public interface IDemon
|
||||
{
|
||||
public abstract void setSummonedConditions();
|
||||
|
||||
public boolean isAggro();
|
||||
|
||||
public void setAggro(boolean aggro);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
public interface IFillingAgent
|
||||
{
|
||||
public abstract int getFilledAmountForPotionNumber(int potionEffects);
|
||||
}
|
38
src/main/java/WayofTime/alchemicalWizardry/common/Int3.java
Normal file
38
src/main/java/WayofTime/alchemicalWizardry/common/Int3.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
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;
|
||||
|
||||
public class LifeBucketHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void onBucketFill(FillBucketEvent event)
|
||||
{
|
||||
ItemStack result = fillCustomBucket(event.world, event.target);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.result = result;
|
||||
event.setResult(Result.ALLOW);
|
||||
}
|
||||
|
||||
public ItemStack fillCustomBucket(World world, MovingObjectPosition pos)
|
||||
{
|
||||
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)
|
||||
{
|
||||
world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
|
||||
return new ItemStack(ModItems.bucketLife);
|
||||
} else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class LifeEssence extends Fluid
|
||||
{
|
||||
public LifeEssence(String fluidName)
|
||||
{
|
||||
super(fluidName);
|
||||
this.setDensity(2000);
|
||||
this.setViscosity(2000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor()
|
||||
{
|
||||
return 0xEEEEEE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedName()
|
||||
{
|
||||
return "Life Essence";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
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;
|
||||
|
||||
public class ModLivingDropsEvent
|
||||
{
|
||||
public static double rand;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityDrop(LivingDropsEvent event)
|
||||
{
|
||||
if (event.source.getDamageType().equals("player"))
|
||||
{
|
||||
rand = Math.random();
|
||||
|
||||
if (!(event.entityLiving instanceof EntityAnimal))
|
||||
{
|
||||
PotionEffect effect = event.entityLiving.getActivePotionEffect(Potion.weakness);
|
||||
|
||||
if (effect != null)
|
||||
{
|
||||
if (effect.getAmplifier() >= 2)
|
||||
if (rand < 0.50d)
|
||||
{
|
||||
event.entityLiving.dropItem(ModItems.weakBloodShard, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,954 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.ColourAndCoords;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.*;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
|
||||
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
|
||||
import cpw.mods.fml.common.network.FMLOutboundHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles the packet wrangling for IronChest
|
||||
*
|
||||
* @author cpw
|
||||
*/
|
||||
public enum NewPacketHandler
|
||||
{
|
||||
INSTANCE;
|
||||
|
||||
/**
|
||||
* Our channel "pair" from {@link NetworkRegistry}
|
||||
*/
|
||||
private EnumMap<Side, FMLEmbeddedChannel> channels;
|
||||
|
||||
|
||||
/**
|
||||
* Make our packet handler, and add an {@link IronChestCodec} always
|
||||
*/
|
||||
private NewPacketHandler()
|
||||
{
|
||||
// request a channel pair for IronChest from the network registry
|
||||
// Add the IronChestCodec as a member of both channel pipelines
|
||||
this.channels = NetworkRegistry.INSTANCE.newChannel("BloodMagic", new TEAltarCodec());
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
|
||||
{
|
||||
addClientHandler();
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void addClientHandler()
|
||||
{
|
||||
FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT);
|
||||
|
||||
String tileAltarCodec = clientChannel.findChannelHandlerNameForType(TEAltarCodec.class);
|
||||
clientChannel.pipeline().addAfter(tileAltarCodec, "TEAltarHandler", new TEAltarMessageHandler());
|
||||
clientChannel.pipeline().addAfter(tileAltarCodec, "TEOrientableHandler", new TEOrientableMessageHandler());
|
||||
clientChannel.pipeline().addAfter(tileAltarCodec, "TEPedestalHandler", new TEPedestalMessageHandler());
|
||||
clientChannel.pipeline().addAfter(tileAltarCodec, "TEPlinthHandler", new TEPlinthMessageHandler());
|
||||
clientChannel.pipeline().addAfter(tileAltarCodec, "TESocketHandler", new TESocketMessageHandler());
|
||||
clientChannel.pipeline().addAfter(tileAltarCodec, "TETeleposerHandler", new TETeleposerMessageHandler());
|
||||
clientChannel.pipeline().addAfter(tileAltarCodec, "TEWritingTableHandler", new TEWritingTableMessageHandler());
|
||||
clientChannel.pipeline().addAfter(tileAltarCodec, "ParticleHandler", new ParticleMessageHandler());
|
||||
clientChannel.pipeline().addAfter(tileAltarCodec, "VelocityHandler", new VelocityMessageHandler());
|
||||
clientChannel.pipeline().addAfter(tileAltarCodec, "TEMasterStoneHandler", new TEMasterStoneMessageHandler());
|
||||
clientChannel.pipeline().addAfter(tileAltarCodec, "TEReagentConduitHandler", new TEReagentConduitMessageHandler());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This class simply handles the {@link IronChestMessage} when it's received
|
||||
* at the client side It can contain client only code, because it's only run
|
||||
* on the client.
|
||||
*
|
||||
* @author cpw
|
||||
*/
|
||||
private static class TEAltarMessageHandler extends SimpleChannelInboundHandler<TEAltarMessage>
|
||||
{
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, TEAltarMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEAltar)
|
||||
{
|
||||
TEAltar altar = (TEAltar) te;
|
||||
|
||||
altar.handlePacketData(msg.items, msg.fluids, msg.capacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class TEOrientableMessageHandler extends SimpleChannelInboundHandler<TEOrientableMessage>
|
||||
{
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, TEOrientableMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEOrientable)
|
||||
{
|
||||
TEOrientable tile = (TEOrientable) te;
|
||||
|
||||
((TEOrientable) te).setInputDirection(ForgeDirection.getOrientation(msg.input));
|
||||
((TEOrientable) te).setOutputDirection(ForgeDirection.getOrientation(msg.output));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class TEPedestalMessageHandler extends SimpleChannelInboundHandler<TEPedestalMessage>
|
||||
{
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, TEPedestalMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEPedestal)
|
||||
{
|
||||
TEPedestal pedestal = (TEPedestal) te;
|
||||
|
||||
pedestal.handlePacketData(msg.items);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class TEPlinthMessageHandler extends SimpleChannelInboundHandler<TEPlinthMessage>
|
||||
{
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, TEPlinthMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEPlinth)
|
||||
{
|
||||
TEPlinth Plinth = (TEPlinth) te;
|
||||
|
||||
Plinth.handlePacketData(msg.items);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class TESocketMessageHandler extends SimpleChannelInboundHandler<TESocketMessage>
|
||||
{
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, TESocketMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TESocket)
|
||||
{
|
||||
TESocket Socket = (TESocket) te;
|
||||
|
||||
Socket.handlePacketData(msg.items);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class TETeleposerMessageHandler extends SimpleChannelInboundHandler<TETeleposerMessage>
|
||||
{
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, TETeleposerMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TETeleposer)
|
||||
{
|
||||
TETeleposer Teleposer = (TETeleposer) te;
|
||||
|
||||
Teleposer.handlePacketData(msg.items);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class TEWritingTableMessageHandler extends SimpleChannelInboundHandler<TEWritingTableMessage>
|
||||
{
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, TEWritingTableMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEWritingTable)
|
||||
{
|
||||
TEWritingTable WritingTable = (TEWritingTable) te;
|
||||
|
||||
WritingTable.handlePacketData(msg.items);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class ParticleMessageHandler extends SimpleChannelInboundHandler<ParticleMessage>
|
||||
{
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, ParticleMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
|
||||
world.spawnParticle(msg.particle, msg.xCoord, msg.yCoord, msg.zCoord, msg.xVel, msg.yVel, msg.zVel);
|
||||
}
|
||||
}
|
||||
|
||||
private static class VelocityMessageHandler extends SimpleChannelInboundHandler<VelocityMessage>
|
||||
{
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, VelocityMessage msg) throws Exception
|
||||
{
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
player.motionX = msg.xVel;
|
||||
player.motionY = msg.yVel;
|
||||
player.motionZ = msg.zVel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class TEMasterStoneMessageHandler extends SimpleChannelInboundHandler<TEMasterStoneMessage>
|
||||
{
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, TEMasterStoneMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEMasterStone)
|
||||
{
|
||||
TEMasterStone masterStone = (TEMasterStone) te;
|
||||
|
||||
masterStone.setCurrentRitual(msg.ritual);
|
||||
masterStone.isRunning = msg.isRunning;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class TEReagentConduitMessageHandler extends SimpleChannelInboundHandler<TEReagentConduitMessage>
|
||||
{
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, TEReagentConduitMessage msg) throws Exception
|
||||
{
|
||||
World world = AlchemicalWizardry.proxy.getClientWorld();
|
||||
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
|
||||
if (te instanceof TEReagentConduit)
|
||||
{
|
||||
TEReagentConduit reagentConduit = (TEReagentConduit) te;
|
||||
|
||||
reagentConduit.destinationList = msg.destinationList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class BMMessage
|
||||
{
|
||||
int index;
|
||||
}
|
||||
|
||||
public static class TEAltarMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
int[] items;
|
||||
int[] fluids;
|
||||
int capacity;
|
||||
}
|
||||
|
||||
public static class TEOrientableMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
int input;
|
||||
int output;
|
||||
}
|
||||
|
||||
public static class TEPedestalMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class TEPlinthMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class TESocketMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class TETeleposerMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class TEWritingTableMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
int[] items;
|
||||
}
|
||||
|
||||
public static class ParticleMessage extends BMMessage
|
||||
{
|
||||
String particle;
|
||||
|
||||
double xCoord;
|
||||
double yCoord;
|
||||
double zCoord;
|
||||
|
||||
double xVel;
|
||||
double yVel;
|
||||
double zVel;
|
||||
}
|
||||
|
||||
public static class VelocityMessage extends BMMessage
|
||||
{
|
||||
double xVel;
|
||||
double yVel;
|
||||
double zVel;
|
||||
}
|
||||
|
||||
public static class TEMasterStoneMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
String ritual;
|
||||
boolean isRunning;
|
||||
}
|
||||
|
||||
public static class TEReagentConduitMessage extends BMMessage
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
List<ColourAndCoords> destinationList;
|
||||
}
|
||||
|
||||
private class TEAltarCodec extends FMLIndexedMessageToMessageCodec<BMMessage>
|
||||
{
|
||||
public TEAltarCodec()
|
||||
{
|
||||
addDiscriminator(0, TEAltarMessage.class);
|
||||
addDiscriminator(1, TEOrientableMessage.class);
|
||||
addDiscriminator(2, TEPedestalMessage.class);
|
||||
addDiscriminator(3, TEPlinthMessage.class);
|
||||
addDiscriminator(4, TESocketMessage.class);
|
||||
addDiscriminator(5, TETeleposerMessage.class);
|
||||
addDiscriminator(6, TEWritingTableMessage.class);
|
||||
addDiscriminator(7, ParticleMessage.class);
|
||||
addDiscriminator(8, VelocityMessage.class);
|
||||
addDiscriminator(9, TEMasterStoneMessage.class);
|
||||
addDiscriminator(10, TEReagentConduitMessage.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto(ChannelHandlerContext ctx, BMMessage msg, ByteBuf target) throws Exception
|
||||
{
|
||||
target.writeInt(msg.index);
|
||||
|
||||
switch (msg.index)
|
||||
{
|
||||
case 0:
|
||||
target.writeInt(((TEAltarMessage) msg).x);
|
||||
target.writeInt(((TEAltarMessage) msg).y);
|
||||
target.writeInt(((TEAltarMessage) msg).z);
|
||||
|
||||
target.writeBoolean(((TEAltarMessage) msg).items != null);
|
||||
if (((TEAltarMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TEAltarMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
target.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
target.writeBoolean(((TEAltarMessage) msg).fluids != null);
|
||||
if (((TEAltarMessage) msg).fluids != null)
|
||||
{
|
||||
int[] fluids = ((TEAltarMessage) msg).fluids;
|
||||
for (int j = 0; j < fluids.length; j++)
|
||||
{
|
||||
int i = fluids[j];
|
||||
target.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
target.writeInt(((TEAltarMessage) msg).capacity);
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
target.writeInt(((TEOrientableMessage) msg).x);
|
||||
target.writeInt(((TEOrientableMessage) msg).y);
|
||||
target.writeInt(((TEOrientableMessage) msg).z);
|
||||
|
||||
target.writeInt(((TEOrientableMessage) msg).input);
|
||||
target.writeInt(((TEOrientableMessage) msg).output);
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
target.writeInt(((TEPedestalMessage) msg).x);
|
||||
target.writeInt(((TEPedestalMessage) msg).y);
|
||||
target.writeInt(((TEPedestalMessage) msg).z);
|
||||
|
||||
target.writeBoolean(((TEPedestalMessage) msg).items != null);
|
||||
if (((TEPedestalMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TEPedestalMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
target.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
target.writeInt(((TEPlinthMessage) msg).x);
|
||||
target.writeInt(((TEPlinthMessage) msg).y);
|
||||
target.writeInt(((TEPlinthMessage) msg).z);
|
||||
|
||||
target.writeBoolean(((TEPlinthMessage) msg).items != null);
|
||||
if (((TEPlinthMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TEPlinthMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
target.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
target.writeInt(((TESocketMessage) msg).x);
|
||||
target.writeInt(((TESocketMessage) msg).y);
|
||||
target.writeInt(((TESocketMessage) msg).z);
|
||||
|
||||
target.writeBoolean(((TESocketMessage) msg).items != null);
|
||||
if (((TESocketMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TESocketMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
target.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
target.writeInt(((TETeleposerMessage) msg).x);
|
||||
target.writeInt(((TETeleposerMessage) msg).y);
|
||||
target.writeInt(((TETeleposerMessage) msg).z);
|
||||
|
||||
target.writeBoolean(((TETeleposerMessage) msg).items != null);
|
||||
if (((TETeleposerMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TETeleposerMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
target.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
target.writeInt(((TEWritingTableMessage) msg).x);
|
||||
target.writeInt(((TEWritingTableMessage) msg).y);
|
||||
target.writeInt(((TEWritingTableMessage) msg).z);
|
||||
|
||||
target.writeBoolean(((TEWritingTableMessage) msg).items != null);
|
||||
if (((TEWritingTableMessage) msg).items != null)
|
||||
{
|
||||
int[] items = ((TEWritingTableMessage) msg).items;
|
||||
for (int j = 0; j < items.length; j++)
|
||||
{
|
||||
int i = items[j];
|
||||
target.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 7:
|
||||
String str = ((ParticleMessage) msg).particle;
|
||||
target.writeInt(str.length());
|
||||
for (int i = 0; i < str.length(); i++)
|
||||
{
|
||||
target.writeChar(str.charAt(i));
|
||||
}
|
||||
|
||||
target.writeDouble(((ParticleMessage) msg).xCoord);
|
||||
target.writeDouble(((ParticleMessage) msg).yCoord);
|
||||
target.writeDouble(((ParticleMessage) msg).zCoord);
|
||||
|
||||
target.writeDouble(((ParticleMessage) msg).xVel);
|
||||
target.writeDouble(((ParticleMessage) msg).yVel);
|
||||
target.writeDouble(((ParticleMessage) msg).zVel);
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
target.writeDouble(((VelocityMessage) msg).xVel);
|
||||
target.writeDouble(((VelocityMessage) msg).yVel);
|
||||
target.writeDouble(((VelocityMessage) msg).zVel);
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
target.writeInt(((TEMasterStoneMessage) msg).x);
|
||||
target.writeInt(((TEMasterStoneMessage) msg).y);
|
||||
target.writeInt(((TEMasterStoneMessage) msg).z);
|
||||
|
||||
String ritual = ((TEMasterStoneMessage) msg).ritual;
|
||||
target.writeInt(ritual.length());
|
||||
for (int i = 0; i < ritual.length(); i++)
|
||||
{
|
||||
target.writeChar(ritual.charAt(i));
|
||||
}
|
||||
|
||||
target.writeBoolean(((TEMasterStoneMessage) msg).isRunning);
|
||||
|
||||
break;
|
||||
|
||||
case 10:
|
||||
target.writeInt(((TEReagentConduitMessage) msg).x);
|
||||
target.writeInt(((TEReagentConduitMessage) msg).y);
|
||||
target.writeInt(((TEReagentConduitMessage) msg).z);
|
||||
|
||||
List<ColourAndCoords> list = ((TEReagentConduitMessage) msg).destinationList;
|
||||
target.writeInt(list.size());
|
||||
|
||||
for (ColourAndCoords colourSet : list)
|
||||
{
|
||||
target.writeInt(colourSet.colourRed);
|
||||
target.writeInt(colourSet.colourGreen);
|
||||
target.writeInt(colourSet.colourBlue);
|
||||
target.writeInt(colourSet.colourIntensity);
|
||||
target.writeInt(colourSet.xCoord);
|
||||
target.writeInt(colourSet.yCoord);
|
||||
target.writeInt(colourSet.zCoord);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf dat, BMMessage msg)
|
||||
{
|
||||
int index = dat.readInt();
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
((TEAltarMessage) msg).x = dat.readInt();
|
||||
((TEAltarMessage) msg).y = dat.readInt();
|
||||
((TEAltarMessage) msg).z = dat.readInt();
|
||||
boolean hasStacks = dat.readBoolean();
|
||||
|
||||
((TEAltarMessage) msg).items = new int[TEAltar.sizeInv * 3];
|
||||
if (hasStacks)
|
||||
{
|
||||
((TEAltarMessage) msg).items = new int[TEAltar.sizeInv * 3];
|
||||
for (int i = 0; i < ((TEAltarMessage) msg).items.length; i++)
|
||||
{
|
||||
((TEAltarMessage) msg).items[i] = dat.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasFluids = dat.readBoolean();
|
||||
((TEAltarMessage) msg).fluids = new int[6];
|
||||
if (hasFluids)
|
||||
for (int i = 0; i < ((TEAltarMessage) msg).fluids.length; i++)
|
||||
{
|
||||
((TEAltarMessage) msg).fluids[i] = dat.readInt();
|
||||
}
|
||||
|
||||
((TEAltarMessage) msg).capacity = dat.readInt();
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
((TEOrientableMessage) msg).x = dat.readInt();
|
||||
((TEOrientableMessage) msg).y = dat.readInt();
|
||||
((TEOrientableMessage) msg).z = dat.readInt();
|
||||
|
||||
((TEOrientableMessage) msg).input = dat.readInt();
|
||||
((TEOrientableMessage) msg).output = dat.readInt();
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
((TEPedestalMessage) msg).x = dat.readInt();
|
||||
((TEPedestalMessage) msg).y = dat.readInt();
|
||||
((TEPedestalMessage) msg).z = dat.readInt();
|
||||
|
||||
boolean hasStacks1 = dat.readBoolean();
|
||||
|
||||
((TEPedestalMessage) msg).items = new int[TEPedestal.sizeInv * 3];
|
||||
if (hasStacks1)
|
||||
{
|
||||
((TEPedestalMessage) msg).items = new int[TEPedestal.sizeInv * 3];
|
||||
for (int i = 0; i < ((TEPedestalMessage) msg).items.length; i++)
|
||||
{
|
||||
((TEPedestalMessage) msg).items[i] = dat.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
((TEPlinthMessage) msg).x = dat.readInt();
|
||||
((TEPlinthMessage) msg).y = dat.readInt();
|
||||
((TEPlinthMessage) msg).z = dat.readInt();
|
||||
|
||||
boolean hasStacks2 = dat.readBoolean();
|
||||
|
||||
((TEPlinthMessage) msg).items = new int[TEPlinth.sizeInv * 3];
|
||||
if (hasStacks2)
|
||||
{
|
||||
((TEPlinthMessage) msg).items = new int[TEPlinth.sizeInv * 3];
|
||||
for (int i = 0; i < ((TEPlinthMessage) msg).items.length; i++)
|
||||
{
|
||||
((TEPlinthMessage) msg).items[i] = dat.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
((TESocketMessage) msg).x = dat.readInt();
|
||||
((TESocketMessage) msg).y = dat.readInt();
|
||||
((TESocketMessage) msg).z = dat.readInt();
|
||||
|
||||
boolean hasStacks3 = dat.readBoolean();
|
||||
|
||||
((TESocketMessage) msg).items = new int[TESocket.sizeInv * 3];
|
||||
if (hasStacks3)
|
||||
{
|
||||
((TESocketMessage) msg).items = new int[TESocket.sizeInv * 3];
|
||||
for (int i = 0; i < ((TESocketMessage) msg).items.length; i++)
|
||||
{
|
||||
((TESocketMessage) msg).items[i] = dat.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
((TETeleposerMessage) msg).x = dat.readInt();
|
||||
((TETeleposerMessage) msg).y = dat.readInt();
|
||||
((TETeleposerMessage) msg).z = dat.readInt();
|
||||
|
||||
boolean hasStacks4 = dat.readBoolean();
|
||||
|
||||
((TETeleposerMessage) msg).items = new int[TETeleposer.sizeInv * 3];
|
||||
if (hasStacks4)
|
||||
{
|
||||
((TETeleposerMessage) msg).items = new int[TETeleposer.sizeInv * 3];
|
||||
for (int i = 0; i < ((TETeleposerMessage) msg).items.length; i++)
|
||||
{
|
||||
((TETeleposerMessage) msg).items[i] = dat.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
((TEWritingTableMessage) msg).x = dat.readInt();
|
||||
((TEWritingTableMessage) msg).y = dat.readInt();
|
||||
((TEWritingTableMessage) msg).z = dat.readInt();
|
||||
|
||||
boolean hasStacks5 = dat.readBoolean();
|
||||
|
||||
((TEWritingTableMessage) msg).items = new int[TEWritingTable.sizeInv * 3];
|
||||
if (hasStacks5)
|
||||
{
|
||||
((TEWritingTableMessage) msg).items = new int[TEWritingTable.sizeInv * 3];
|
||||
for (int i = 0; i < ((TEWritingTableMessage) msg).items.length; i++)
|
||||
{
|
||||
((TEWritingTableMessage) msg).items[i] = dat.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 7:
|
||||
int size = dat.readInt();
|
||||
String str = "";
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
str = str + dat.readChar();
|
||||
}
|
||||
|
||||
((ParticleMessage) msg).particle = str;
|
||||
|
||||
((ParticleMessage) msg).xCoord = dat.readDouble();
|
||||
((ParticleMessage) msg).yCoord = dat.readDouble();
|
||||
((ParticleMessage) msg).zCoord = dat.readDouble();
|
||||
|
||||
((ParticleMessage) msg).xVel = dat.readDouble();
|
||||
((ParticleMessage) msg).yVel = dat.readDouble();
|
||||
((ParticleMessage) msg).zVel = dat.readDouble();
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
((VelocityMessage) msg).xVel = dat.readDouble();
|
||||
((VelocityMessage) msg).yVel = dat.readDouble();
|
||||
((VelocityMessage) msg).zVel = dat.readDouble();
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
((TEMasterStoneMessage) msg).x = dat.readInt();
|
||||
((TEMasterStoneMessage) msg).y = dat.readInt();
|
||||
((TEMasterStoneMessage) msg).z = dat.readInt();
|
||||
|
||||
int ritualStrSize = dat.readInt();
|
||||
String ritual = "";
|
||||
|
||||
for (int i = 0; i < ritualStrSize; i++)
|
||||
{
|
||||
ritual = ritual + dat.readChar();
|
||||
}
|
||||
|
||||
((TEMasterStoneMessage) msg).ritual = ritual;
|
||||
((TEMasterStoneMessage) msg).isRunning = dat.readBoolean();
|
||||
|
||||
break;
|
||||
|
||||
case 10:
|
||||
((TEReagentConduitMessage) msg).x = dat.readInt();
|
||||
((TEReagentConduitMessage) msg).y = dat.readInt();
|
||||
((TEReagentConduitMessage) msg).z = dat.readInt();
|
||||
|
||||
int listSize = dat.readInt();
|
||||
|
||||
List<ColourAndCoords> list = new LinkedList();
|
||||
|
||||
for (int i = 0; i < listSize; i++)
|
||||
{
|
||||
list.add(new ColourAndCoords(dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt(), dat.readInt()));
|
||||
}
|
||||
|
||||
((TEReagentConduitMessage) msg).destinationList = list;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Packets to be obtained
|
||||
public static Packet getPacket(TEAltar tileAltar)
|
||||
{
|
||||
TEAltarMessage msg = new TEAltarMessage();
|
||||
msg.index = 0;
|
||||
msg.x = tileAltar.xCoord;
|
||||
msg.y = tileAltar.yCoord;
|
||||
msg.z = tileAltar.zCoord;
|
||||
msg.items = tileAltar.buildIntDataList();
|
||||
msg.fluids = tileAltar.buildFluidList();
|
||||
msg.capacity = tileAltar.getCapacity();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getPacket(TEOrientable tileOrientable)
|
||||
{
|
||||
TEOrientableMessage msg = new TEOrientableMessage();
|
||||
msg.index = 1;
|
||||
msg.x = tileOrientable.xCoord;
|
||||
msg.y = tileOrientable.yCoord;
|
||||
msg.z = tileOrientable.zCoord;
|
||||
msg.input = tileOrientable.getIntForForgeDirection(tileOrientable.getInputDirection());
|
||||
msg.output = tileOrientable.getIntForForgeDirection(tileOrientable.getOutputDirection());
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getPacket(TEPedestal tilePedestal)
|
||||
{
|
||||
TEPedestalMessage msg = new TEPedestalMessage();
|
||||
msg.index = 2;
|
||||
msg.x = tilePedestal.xCoord;
|
||||
msg.y = tilePedestal.yCoord;
|
||||
msg.z = tilePedestal.zCoord;
|
||||
msg.items = tilePedestal.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getPacket(TEPlinth tilePlinth)
|
||||
{
|
||||
TEPlinthMessage msg = new TEPlinthMessage();
|
||||
msg.index = 3;
|
||||
msg.x = tilePlinth.xCoord;
|
||||
msg.y = tilePlinth.yCoord;
|
||||
msg.z = tilePlinth.zCoord;
|
||||
msg.items = tilePlinth.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getPacket(TESocket tileSocket)
|
||||
{
|
||||
TESocketMessage msg = new TESocketMessage();
|
||||
msg.index = 4;
|
||||
msg.x = tileSocket.xCoord;
|
||||
msg.y = tileSocket.yCoord;
|
||||
msg.z = tileSocket.zCoord;
|
||||
msg.items = tileSocket.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getPacket(TETeleposer tileTeleposer)
|
||||
{
|
||||
TETeleposerMessage msg = new TETeleposerMessage();
|
||||
msg.index = 5;
|
||||
msg.x = tileTeleposer.xCoord;
|
||||
msg.y = tileTeleposer.yCoord;
|
||||
msg.z = tileTeleposer.zCoord;
|
||||
msg.items = tileTeleposer.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getPacket(TEWritingTable tileWritingTable)
|
||||
{
|
||||
TEWritingTableMessage msg = new TEWritingTableMessage();
|
||||
msg.index = 6;
|
||||
msg.x = tileWritingTable.xCoord;
|
||||
msg.y = tileWritingTable.yCoord;
|
||||
msg.z = tileWritingTable.zCoord;
|
||||
msg.items = tileWritingTable.buildIntDataList();
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getParticlePacket(String str, double xCoord, double yCoord, double zCoord, double xVel, double yVel, double zVel)
|
||||
{
|
||||
ParticleMessage msg = new ParticleMessage();
|
||||
msg.index = 7;
|
||||
msg.particle = str;
|
||||
msg.xCoord = xCoord;
|
||||
msg.yCoord = yCoord;
|
||||
msg.zCoord = zCoord;
|
||||
msg.xVel = xVel;
|
||||
msg.yVel = yVel;
|
||||
msg.zVel = zVel;
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getVelSettingPacket(double xVel, double yVel, double zVel)
|
||||
{
|
||||
VelocityMessage msg = new VelocityMessage();
|
||||
msg.index = 8;
|
||||
msg.xVel = xVel;
|
||||
msg.yVel = yVel;
|
||||
msg.zVel = zVel;
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getPacket(TEMasterStone tile)
|
||||
{
|
||||
TEMasterStoneMessage msg = new TEMasterStoneMessage();
|
||||
msg.index = 9;
|
||||
msg.x = tile.xCoord;
|
||||
msg.y = tile.yCoord;
|
||||
msg.z = tile.zCoord;
|
||||
|
||||
msg.ritual = tile.getCurrentRitual();
|
||||
msg.isRunning = tile.isRunning;
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getPacket(TEReagentConduit tile)
|
||||
{
|
||||
TEReagentConduitMessage msg = new TEReagentConduitMessage();
|
||||
msg.index = 10;
|
||||
msg.x = tile.xCoord;
|
||||
msg.y = tile.yCoord;
|
||||
msg.z = tile.zCoord;
|
||||
|
||||
msg.destinationList = tile.destinationList;
|
||||
|
||||
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public void sendTo(Packet message, EntityPlayerMP player)
|
||||
{
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
|
||||
public void sendToAll(Packet message)
|
||||
{
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
|
||||
public void sendToAllAround(Packet message, NetworkRegistry.TargetPoint point)
|
||||
{
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
public class PlinthComponent
|
||||
{
|
||||
public int xOffset;
|
||||
public int yOffset;
|
||||
public int zOffset;
|
||||
public int ring;
|
||||
|
||||
public PlinthComponent(int xOffset, int yOffset, int zOffset, int ring)
|
||||
{
|
||||
this.xOffset = xOffset;
|
||||
this.yOffset = yOffset;
|
||||
this.zOffset = zOffset;
|
||||
this.ring = ring;
|
||||
}
|
||||
|
||||
public int getXOffset()
|
||||
{
|
||||
return xOffset;
|
||||
}
|
||||
|
||||
public int getYOffset()
|
||||
{
|
||||
return yOffset;
|
||||
}
|
||||
|
||||
public int getZOffset()
|
||||
{
|
||||
return zOffset;
|
||||
}
|
||||
|
||||
public int getRing()
|
||||
{
|
||||
return ring;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package WayofTime.alchemicalWizardry.common.alchemy;
|
||||
|
||||
import net.minecraft.potion.Potion;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package WayofTime.alchemicalWizardry.common.alchemy;
|
||||
|
||||
public interface ICombinationalCatalyst
|
||||
{
|
||||
}
|
|
@ -0,0 +1,332 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
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.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ArmourForge extends Block
|
||||
{
|
||||
public static List<ArmourComponent> helmetList = new ArrayList();
|
||||
public static List<ArmourComponent> plateList = new ArrayList();
|
||||
public static List<ArmourComponent> leggingsList = new ArrayList();
|
||||
public static List<ArmourComponent> bootsList = new ArrayList();
|
||||
|
||||
public ArmourForge()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("armourForge");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SoulForge");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int armourType = getArmourType(world, x, y, z);
|
||||
|
||||
if (armourType == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int direction = getDirectionForArmourType(world, x, y, z, armourType);
|
||||
|
||||
if (!isParadigmValid(armourType, direction, world, x, y, z))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
List<ArmourComponent> list = null;
|
||||
ItemStack armourPiece = null;
|
||||
|
||||
switch (armourType)
|
||||
{
|
||||
case 0:
|
||||
list = plateList;
|
||||
armourPiece = new ItemStack(ModItems.boundPlate, 1, 0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
list = leggingsList;
|
||||
armourPiece = new ItemStack(ModItems.boundLeggings, 1, 0);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
list = helmetList;
|
||||
armourPiece = new ItemStack(ModItems.boundHelmet, 1, 0);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
list = bootsList;
|
||||
armourPiece = new ItemStack(ModItems.boundBoots, 1, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (list == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (armourPiece == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (armourPiece.stackTagCompound == null)
|
||||
{
|
||||
armourPiece.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
for (ArmourComponent ac : list)
|
||||
{
|
||||
int xOff = ac.getXOff();
|
||||
int zOff = ac.getZOff();
|
||||
TileEntity tileEntity;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 1:
|
||||
tileEntity = world.getTileEntity(x + xOff, y, z - zOff);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
tileEntity = world.getTileEntity(x + zOff, y, z + xOff);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
tileEntity = world.getTileEntity(x - xOff, y, z + zOff);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
tileEntity = world.getTileEntity(x - zOff, y, z - xOff);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
tileEntity = world.getTileEntity(x + xOff, y + zOff, z);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
tileEntity = world.getTileEntity(x, y + zOff, z + xOff);
|
||||
break;
|
||||
|
||||
default:
|
||||
tileEntity = null;
|
||||
}
|
||||
|
||||
if (tileEntity instanceof TESocket)
|
||||
{
|
||||
ItemStack itemStack = ((TESocket) tileEntity).getStackInSlot(0);
|
||||
int xCoord = tileEntity.xCoord;
|
||||
int yCoord = tileEntity.yCoord;
|
||||
int zCoord = tileEntity.zCoord;
|
||||
((TESocket) tileEntity).setInventorySlotContents(0, null);
|
||||
world.setBlockToAir(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, world.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
Item item = itemStack.getItem();
|
||||
|
||||
if (item instanceof ArmourUpgrade)
|
||||
{
|
||||
((BoundArmour) armourPiece.getItem()).hasAddedToInventory(armourPiece, itemStack.copy());
|
||||
((TESocket) tileEntity).setInventorySlotContents(0, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (armourPiece != null)
|
||||
{
|
||||
int xOff = (world.rand.nextInt(11) - 5);
|
||||
int zOff = (int) (Math.sqrt(25 - xOff * xOff) * (world.rand.nextInt(2) - 0.5) * 2);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x + xOff, y + 5, z + zOff));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y + 1, z, armourPiece));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//0 for plate, 1 for leggings, 2 for helmet, 3 for boots
|
||||
public int getArmourType(World world, int x, int y, int z)
|
||||
{
|
||||
for (int i = 0; i <= 3; i++)
|
||||
{
|
||||
if (getDirectionForArmourType(world, x, y, z, i) != -1)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getDirectionForArmourType(World world, int x, int y, int z, int armourType)
|
||||
{
|
||||
for (int i = 1; i <= 6; i++)
|
||||
{
|
||||
if (isParadigmValid(armourType, i, world, x, y, z))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean isParadigmValid(int armourType, int direction, World world, int x, int y, int z)
|
||||
{
|
||||
List<ArmourComponent> list = null;
|
||||
|
||||
switch (armourType)
|
||||
{
|
||||
case 0:
|
||||
list = plateList;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
list = leggingsList;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
list = helmetList;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
list = bootsList;
|
||||
break;
|
||||
}
|
||||
|
||||
if (list == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (ArmourComponent ac : list)
|
||||
{
|
||||
int xOff = ac.getXOff();
|
||||
int zOff = ac.getZOff();
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 1:
|
||||
if (!(world.getTileEntity(x + xOff, y, z - zOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (!(world.getTileEntity(x + zOff, y, z + xOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (!(world.getTileEntity(x - xOff, y, z + zOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (!(world.getTileEntity(x - zOff, y, z - xOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (!(world.getTileEntity(x + xOff, y + zOff, z) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
if (!(world.getTileEntity(x, y + zOff, z + xOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void initializeRecipes()
|
||||
{
|
||||
helmetList.add(new ArmourComponent(-1, 1));
|
||||
helmetList.add(new ArmourComponent(0, 1));
|
||||
helmetList.add(new ArmourComponent(1, 1));
|
||||
helmetList.add(new ArmourComponent(-1, 0));
|
||||
helmetList.add(new ArmourComponent(1, 0));
|
||||
bootsList.add(new ArmourComponent(-1, 1));
|
||||
bootsList.add(new ArmourComponent(1, 1));
|
||||
bootsList.add(new ArmourComponent(-1, 0));
|
||||
bootsList.add(new ArmourComponent(1, 0));
|
||||
plateList.add(new ArmourComponent(-1, 0));
|
||||
plateList.add(new ArmourComponent(1, 0));
|
||||
plateList.add(new ArmourComponent(-1, -1));
|
||||
plateList.add(new ArmourComponent(0, -1));
|
||||
plateList.add(new ArmourComponent(1, -1));
|
||||
plateList.add(new ArmourComponent(-1, -2));
|
||||
plateList.add(new ArmourComponent(0, -2));
|
||||
plateList.add(new ArmourComponent(1, -2));
|
||||
leggingsList.add(new ArmourComponent(-1, 1));
|
||||
leggingsList.add(new ArmourComponent(0, 1));
|
||||
leggingsList.add(new ArmourComponent(1, 1));
|
||||
leggingsList.add(new ArmourComponent(-1, 0));
|
||||
leggingsList.add(new ArmourComponent(1, 0));
|
||||
leggingsList.add(new ArmourComponent(-1, -1));
|
||||
leggingsList.add(new ArmourComponent(1, -1));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,167 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockAlchemicCalcinator extends BlockContainer
|
||||
{
|
||||
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
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world,
|
||||
x + rx, y + ry, z + rz,
|
||||
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public 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);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
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();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
}
|
||||
} 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)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(1));
|
||||
tileEntity.setInventorySlotContents(1, null);
|
||||
} else if (tileEntity.getStackInSlot(0) != null)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
}
|
||||
}
|
||||
|
||||
tileEntity.getWorldObj().markBlockForUpdate(x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,273 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
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 java.util.Random;
|
||||
|
||||
public class BlockAltar extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockAltar()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodAltar");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Top");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType1");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride()
|
||||
{
|
||||
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 TEAltar)
|
||||
{
|
||||
ItemStack stack = ((TEAltar) tile).getStackInSlot(0);
|
||||
|
||||
if (stack != null && stack.getItem() instanceof EnergyBattery)
|
||||
{
|
||||
EnergyBattery bloodOrb = (EnergyBattery) stack.getItem();
|
||||
int maxEssence = bloodOrb.getMaxEssence();
|
||||
int currentEssence = bloodOrb.getCurrentEssence(stack);
|
||||
int level = currentEssence * 15 / maxEssence;
|
||||
return ((int) (Math.min(15, level))) % 16;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@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.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem().equals(ModItems.divinationSigil))
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
{
|
||||
tileEntity.sendChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (playerItem.getItem().equals(ModItems.itemSeerSigil))
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
{
|
||||
tileEntity.sendMoreChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (playerItem.getItem().equals(ModItems.sigilOfHolding))
|
||||
{
|
||||
ItemStack item = ((SigilOfHolding) playerItem.getItem()).getCurrentItem(playerItem);
|
||||
|
||||
if (item != null && item.getItem().equals(ModItems.divinationSigil))
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
{
|
||||
tileEntity.sendChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (item != null && item.getItem().equals(ModItems.itemSeerSigil))
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
{
|
||||
tileEntity.sendMoreChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tileEntity.getStackInSlot(0) == null && playerItem != null)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
tileEntity.startCycle();
|
||||
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world,
|
||||
x + rx, y + ry, z + rz,
|
||||
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
TEAltar tileEntity = (TEAltar) world.getTileEntity(x, y, z);
|
||||
|
||||
if (!tileEntity.isActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (rand.nextInt(3) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return new TEAltar();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
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.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BlockBelljar extends BlockContainer
|
||||
{
|
||||
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 TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEBellJar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride()
|
||||
{
|
||||
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();
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockBloodLightSource extends Block
|
||||
{
|
||||
public BlockBloodLightSource()
|
||||
{
|
||||
super(Material.cloth);
|
||||
this.setBlockName("blockBloodLightSource");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlockBloodLight");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
if (rand.nextInt(3) != 0)
|
||||
{
|
||||
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;
|
||||
world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.5D, z + 0.5D + rand.nextGaussian() / 8, f1, f2, f3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
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;
|
||||
|
||||
public class BlockConduit extends BlockOrientable
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockConduit()
|
||||
{
|
||||
super();
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockConduit");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Top");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType1");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int noClue)
|
||||
{
|
||||
return new TEConduit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.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;
|
||||
|
||||
public class BlockDemonPortal extends BlockContainer
|
||||
{
|
||||
public BlockDemonPortal()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("demonPortal");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return new TEDemonPortal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public 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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
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;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockHomHeart extends BlockContainer
|
||||
{
|
||||
public IIcon bottomIcon;
|
||||
public IIcon topIcon;
|
||||
public IIcon sideIcon;
|
||||
|
||||
public BlockHomHeart()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockHomHeart");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_top");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_bottom");
|
||||
this.sideIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEHomHeart tileEntity = (TEHomHeart) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem() instanceof BlankSpell)
|
||||
{
|
||||
if (playerItem.stackTagCompound == null)
|
||||
{
|
||||
playerItem.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = playerItem.stackTagCompound;
|
||||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metaMaybe)
|
||||
{
|
||||
return new TEHomHeart();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
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;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMasterStone extends BlockContainer
|
||||
{
|
||||
public BlockMasterStone()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockMasterStone");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEMasterStone tileEntity = (TEMasterStone) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = playerItem.getItem();
|
||||
|
||||
if (!(item instanceof ActivationCrystal))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ActivationCrystal acItem = (ActivationCrystal) item;
|
||||
tileEntity.setOwner(acItem.getOwnerName(playerItem));
|
||||
tileEntity.activateRitual(world, acItem.getCrystalLevel(playerItem), player);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEMasterStone();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,205 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable;
|
||||
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);
|
||||
}
|
||||
|
||||
@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.
|
||||
if (world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ForgeDirection sideClicked = ForgeDirection.getOrientation(side);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return metadata;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,179 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPedestal extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockPedestal()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodPedestal");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:ArcanePedestal");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEPedestal tileEntity = (TEPedestal) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (tileEntity.getStackInSlot(0) == null && playerItem != null)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEPedestal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3)
|
||||
{
|
||||
float f = 0.3125F;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f);
|
||||
return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3, par6Vec3);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,179 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPlinth extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockPlinth()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodPlinth");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:ArcanePlinth");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEPlinth tileEntity = (TEPlinth) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (tileEntity.getStackInSlot(0) == null && playerItem != null)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEPlinth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3)
|
||||
{
|
||||
float f = 0.0625F;
|
||||
this.setBlockBounds(f, 0.0F, f, 1.0f - f, 0.875f, 1.0f - f);
|
||||
return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3, par6Vec3);
|
||||
}
|
||||
}
|
|
@ -0,0 +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;
|
||||
|
||||
public class BlockReagentConduit extends BlockContainer
|
||||
{
|
||||
public BlockReagentConduit()
|
||||
{
|
||||
super(Material.cloth);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setBlockName("blockReagentConduit");
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SimpleTransCircle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEReagentConduit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
|
@ -0,0 +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;
|
||||
|
||||
public class BlockSchematicSaver extends BlockContainer
|
||||
{
|
||||
public BlockSchematicSaver()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("schematicSaver");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return new TESchematicSaver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public 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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
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 java.util.Random;
|
||||
|
||||
public class BlockSocket extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockSocket()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodSocket");
|
||||
//func_111022_d("AlchemicalWizardry:blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TESocket tileEntity = (TESocket) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
if (tileEntity.getStackInSlot(0) == null && playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem() instanceof ArmourUpgrade)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
}
|
||||
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESocket();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSpectralContainer extends BlockContainer
|
||||
{
|
||||
public BlockSpectralContainer()
|
||||
{
|
||||
super(Material.cloth);
|
||||
this.setBlockName("blockSpectralContainer");
|
||||
this.setBlockBounds(0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlockBloodLight");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class BlockSpellEffect extends BlockOrientable
|
||||
{
|
||||
public BlockSpellEffect()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellEffect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESpellEffectBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class BlockSpellEnhancement extends BlockOrientable
|
||||
{
|
||||
public BlockSpellEnhancement()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellEnhancement");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESpellEnhancementBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class BlockSpellModifier extends BlockOrientable
|
||||
{
|
||||
public BlockSpellModifier()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellModifier");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESpellModifierBlock();
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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.world.World;
|
||||
|
||||
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 TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESpellParadigmBlock();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
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)
|
||||
{
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
if (stack != null && stack.getItem() instanceof ItemComplexSpellCrystal)
|
||||
{
|
||||
if (stack.stackTagCompound == null)
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = stack.stackTagCompound;
|
||||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
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 java.util.Random;
|
||||
|
||||
public class BlockTeleposer extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockTeleposer()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodTeleposer");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Top");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TETeleposer tileEntity = (TETeleposer) world.getTileEntity(x, y, z);
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem() instanceof TelepositionFocus)
|
||||
{
|
||||
if (playerItem.stackTagCompound == null)
|
||||
{
|
||||
playerItem.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = playerItem.stackTagCompound;
|
||||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
player.openGui(AlchemicalWizardry.instance, 1, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TETeleposer();
|
||||
}
|
||||
|
||||
public static boolean swapBlocks(World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf)
|
||||
{
|
||||
TileEntity tileEntityI = worldI.getTileEntity(xi, yi, zi);
|
||||
TileEntity tileEntityF = worldF.getTileEntity(xf, yf, zf);
|
||||
TileEntity tileI;
|
||||
TileEntity tileF;
|
||||
|
||||
NBTTagCompound nbttag1 = new NBTTagCompound();
|
||||
NBTTagCompound nbttag2 = new NBTTagCompound();
|
||||
|
||||
if (tileEntityI != null)
|
||||
{
|
||||
tileEntityI.writeToNBT(nbttag1);
|
||||
}
|
||||
|
||||
if (tileEntityF != null)
|
||||
{
|
||||
tileEntityF.writeToNBT(nbttag2);
|
||||
}
|
||||
|
||||
Block blockI = worldI.getBlock(xi, yi, zi);
|
||||
Block blockF = worldF.getBlock(xf, yf, zf);
|
||||
|
||||
|
||||
if (blockI.equals(Blocks.air) && blockF.equals(Blocks.air))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (blockI instanceof BlockMobSpawner || blockF instanceof BlockMobSpawner)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int metaI = worldI.getBlockMetadata(xi, yi, zi);
|
||||
int metaF = worldF.getBlockMetadata(xf, yf, zf);
|
||||
worldI.playSoundEffect(xi, yi, zi, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
worldF.playSoundEffect(xf, yf, zf, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
//CLEAR TILES
|
||||
Block finalBlock = blockF;
|
||||
|
||||
if (finalBlock != null)
|
||||
{
|
||||
TileEntity tileToSet = finalBlock.createTileEntity(worldF, metaF);
|
||||
|
||||
worldF.setTileEntity(xf, yf, zf, tileToSet);
|
||||
}
|
||||
|
||||
Block initialBlock = blockI;
|
||||
|
||||
if (initialBlock != null)
|
||||
{
|
||||
TileEntity tileToSet = initialBlock.createTileEntity(worldI, metaI);
|
||||
|
||||
worldI.setTileEntity(xi, yi, zi, tileToSet);
|
||||
}
|
||||
|
||||
//TILES CLEARED
|
||||
worldF.setBlock(xf, yf, zf, initialBlock, metaI, 3);
|
||||
|
||||
if (tileEntityI != null)
|
||||
{
|
||||
TileEntity newTileEntityI = TileEntity.createAndLoadEntity(nbttag1);
|
||||
worldF.setTileEntity(xf, yf, zf, newTileEntityI);
|
||||
newTileEntityI.xCoord = xf;
|
||||
newTileEntityI.yCoord = yf;
|
||||
newTileEntityI.zCoord = zf;
|
||||
}
|
||||
|
||||
worldI.setBlock(xi, yi, zi, finalBlock, metaF, 3);
|
||||
|
||||
if (tileEntityF != null)
|
||||
{
|
||||
TileEntity newTileEntityF = TileEntity.createAndLoadEntity(nbttag2);
|
||||
worldI.setTileEntity(xi, yi, zi, newTileEntityF);
|
||||
newTileEntityF.xCoord = xi;
|
||||
newTileEntityF.yCoord = yi;
|
||||
newTileEntityF.zCoord = zi;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,175 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockWritingTable extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockWritingTable()
|
||||
{
|
||||
super(Material.wood);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setBlockName("blockWritingTable");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:AlchemicChemistrySet");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType1");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float what, float these, float are)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//code to open gui explained later
|
||||
player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world,
|
||||
x + rx, y + ry, z + rz,
|
||||
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEWritingTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
this.setBlockBounds(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.9375F, 0.5625F);
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
this.setBlockBoundsForItemRender();
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
|
||||
public void setBlockBoundsForItemRender()
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
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;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BloodRune extends Block
|
||||
{
|
||||
//private Icon bloodRuneIcon;
|
||||
private IIcon altarCapacityRuneIcon;
|
||||
private IIcon dislocationRuneIcon;
|
||||
private IIcon orbCapacityRuneIcon;
|
||||
private IIcon betterCapacityRuneIcon;
|
||||
|
||||
public BloodRune()
|
||||
{
|
||||
super(Material.iron);
|
||||
this.setBlockName("bloodRune");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlankRune");
|
||||
this.altarCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:AltarCapacityRune");
|
||||
this.dislocationRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:DislocationRune");
|
||||
this.orbCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:OrbCapacityRune");
|
||||
this.betterCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:BetterCapacityRune");
|
||||
}
|
||||
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
switch (metaData)
|
||||
{
|
||||
case 0:
|
||||
return 0;
|
||||
|
||||
case 1: //Altar Capacity rune
|
||||
return 5;
|
||||
|
||||
case 2: //Filling/emptying rune
|
||||
return 6;
|
||||
|
||||
case 3: //Orb Capacity rune
|
||||
return 7;
|
||||
|
||||
case 4: //Better Capacity rune
|
||||
return 8;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
if (this.equals(ModBlocks.bloodRune))
|
||||
{
|
||||
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));
|
||||
par3List.add(new ItemStack(par1, 1, 4));
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return blockIcon;
|
||||
|
||||
case 1:
|
||||
return altarCapacityRuneIcon;
|
||||
|
||||
case 2:
|
||||
return dislocationRuneIcon;
|
||||
|
||||
case 3:
|
||||
return this.orbCapacityRuneIcon;
|
||||
|
||||
case 4:
|
||||
return this.betterCapacityRuneIcon;
|
||||
|
||||
default:
|
||||
return blockIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return metadata;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
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.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class BloodStoneBrick extends Block
|
||||
{
|
||||
public BloodStoneBrick()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodStoneBrick");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodStoneBrick");
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue