Sigil of Holding remake!

This commit is contained in:
Arcaratus 2015-05-18 18:33:23 -04:00
parent 61cb569ffb
commit 0f3c0196cd
39 changed files with 874 additions and 327 deletions

View file

@ -12,6 +12,8 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import WayofTime.alchemicalWizardry.api.bindingRegistry.UnbindingRegistry;
import WayofTime.alchemicalWizardry.common.items.sigil.holding.HoldingPacketHandler;
import WayofTime.alchemicalWizardry.common.items.sigil.holding.ScrollHelper;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@ -115,7 +117,7 @@ import WayofTime.alchemicalWizardry.common.harvest.PamHarvestCompatRegistry;
import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner;
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour;
import WayofTime.alchemicalWizardry.common.items.forestry.ItemBloodFrame;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.items.sigil.holding.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.items.thaumcraft.ItemSanguineArmour;
import WayofTime.alchemicalWizardry.common.omega.OmegaParadigmEarth;
import WayofTime.alchemicalWizardry.common.omega.OmegaParadigmFire;
@ -464,6 +466,7 @@ public class AlchemicalWizardry
@SidedProxy(clientSide = "WayofTime.alchemicalWizardry.client.ClientProxy", serverSide = "WayofTime.alchemicalWizardry.common.CommonProxy")
public static CommonProxy proxy;
public static final HoldingPacketHandler packetPipeline = new HoldingPacketHandler();
@EventHandler
public void preInit(FMLPreInitializationEvent event)
@ -551,13 +554,14 @@ public class AlchemicalWizardry
ModItems.init();
ModItems.registerItems();
RecipeSorter.INSTANCE.register("AWWayofTime:shapedorb", ShapedBloodOrbRecipe.class, Category.SHAPED, "before:minecraft:shapeless");
RecipeSorter.INSTANCE.register("AWWayofTime:shapelessorb", ShapelessBloodOrbRecipe.class, Category.SHAPELESS, "after:minecraft:shapeless");
RecipeSorter.register("AWWayofTime:shapedorb", ShapedBloodOrbRecipe.class, Category.SHAPED, "before:minecraft:shapeless");
RecipeSorter.register("AWWayofTime:shapelessorb", ShapelessBloodOrbRecipe.class, Category.SHAPELESS, "after:minecraft:shapeless");
Object eventHook = new AlchemicalWizardryEventHooks();
FMLCommonHandler.instance().bus().register(eventHook);
MinecraftForge.EVENT_BUS.register(eventHook);
NewPacketHandler.INSTANCE.ordinal();
HoldingPacketHandler.init();
ClientToServerPacketHandler.init();
ModAchievements.init();
}
@ -804,29 +808,29 @@ public class AlchemicalWizardry
//Gui registration
UpgradedAltars.loadAltars();
SigilOfHolding.initiateSigilOfHolding();
ArmourForge.initializeRecipes();
TEPlinth.initialize();
this.initAlchemyPotionRecipes();
this.initAltarRecipes();
this.initBindingRecipes();
this.initHarvestRegistry();
this.initCombinedAlchemyPotionRecipes();
initAlchemyPotionRecipes();
initAltarRecipes();
initBindingRecipes();
initHarvestRegistry();
initCombinedAlchemyPotionRecipes();
ReagentRegistry.initReagents();
this.initReagentRegistries();
this.initRituals();
this.initDemonPacketRegistiry();
this.initiateRegistry();
initReagentRegistries();
initRituals();
this.blacklistDemons();
initDemonPacketRegistiry();
initiateRegistry();
this.blacklistAccelerators();
blacklistDemons();
blacklistAccelerators();
MinecraftForge.EVENT_BUS.register(new ModLivingDropsEvent());
MinecraftForge.EVENT_BUS.register(new ScrollHelper());
proxy.InitRendering();
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
@ -892,20 +896,20 @@ public class AlchemicalWizardry
HomSpellRegistry.registerBasicSpell(new ItemStack(Items.water_bucket), new SpellWateryGrave());
HomSpellRegistry.registerBasicSpell(new ItemStack(Blocks.obsidian), new SpellEarthBender());
HomSpellRegistry.registerBasicSpell(new ItemStack(Items.ender_pearl), new SpellTeleport());
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityFallenAngelID), new ItemStack[]{sanctusStack, sanctusStack, sanctusStack, aetherStack, tennebraeStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityLowerGuardianID), new ItemStack[]{cobblestoneStack, cobblestoneStack, terraeStack, tennebraeStack, new ItemStack(Items.iron_ingot), new ItemStack(Items.gold_nugget)}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityBileDemonID), new ItemStack[]{new ItemStack(Items.poisonous_potato), tennebraeStack, terraeStack, new ItemStack(Items.porkchop), new ItemStack(Items.egg), new ItemStack(Items.beef)}, new ItemStack[]{crepitousStack, crepitousStack, terraeStack, ironBlockStack, ironBlockStack, diamondStack}, new ItemStack[]{}, 0, 5);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityWingedFireDemonID), new ItemStack[]{aetherStack, incendiumStack, incendiumStack, incendiumStack, tennebraeStack, new ItemStack(Blocks.netherrack)}, new ItemStack[]{diamondStack, new ItemStack(Blocks.gold_block), magicalesStack, magicalesStack, new ItemStack(Items.fire_charge), new ItemStack(Blocks.coal_block)}, new ItemStack[]{}, 0, 5);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entitySmallEarthGolemID), new ItemStack[]{new ItemStack(Items.clay_ball), terraeStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityIceDemonID), new ItemStack[]{crystallosStack, crystallosStack, aquasalusStack, crystallosStack, sanctusStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityBoulderFistID), new ItemStack[]{terraeStack, sanctusStack, tennebraeStack, new ItemStack(Items.bone), new ItemStack(Items.cooked_beef), new ItemStack(Items.cooked_beef)}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityShadeID), new ItemStack[]{tennebraeStack, tennebraeStack, tennebraeStack, aetherStack, glassStack, new ItemStack(Items.glass_bottle)}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityAirElementalID), new ItemStack[]{aetherStack, aetherStack, aetherStack, aetherStack, aetherStack, aetherStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityWaterElementalID), new ItemStack[]{aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityEarthElementalID), new ItemStack[]{terraeStack, terraeStack, terraeStack, terraeStack, terraeStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityFireElementalID), new ItemStack[]{incendiumStack, incendiumStack, incendiumStack, incendiumStack, incendiumStack, incendiumStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityShadeElementalID), new ItemStack[]{tennebraeStack, tennebraeStack, tennebraeStack, tennebraeStack, tennebraeStack, tennebraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityHolyElementalID), new ItemStack[]{sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(entityFallenAngelID), new ItemStack[]{sanctusStack, sanctusStack, sanctusStack, aetherStack, tennebraeStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(entityLowerGuardianID), new ItemStack[]{cobblestoneStack, cobblestoneStack, terraeStack, tennebraeStack, new ItemStack(Items.iron_ingot), new ItemStack(Items.gold_nugget)}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(entityBileDemonID), new ItemStack[]{new ItemStack(Items.poisonous_potato), tennebraeStack, terraeStack, new ItemStack(Items.porkchop), new ItemStack(Items.egg), new ItemStack(Items.beef)}, new ItemStack[]{crepitousStack, crepitousStack, terraeStack, ironBlockStack, ironBlockStack, diamondStack}, new ItemStack[]{}, 0, 5);
SummoningRegistry.registerSummon(new SummoningHelperAW(entityWingedFireDemonID), new ItemStack[]{aetherStack, incendiumStack, incendiumStack, incendiumStack, tennebraeStack, new ItemStack(Blocks.netherrack)}, new ItemStack[]{diamondStack, new ItemStack(Blocks.gold_block), magicalesStack, magicalesStack, new ItemStack(Items.fire_charge), new ItemStack(Blocks.coal_block)}, new ItemStack[]{}, 0, 5);
SummoningRegistry.registerSummon(new SummoningHelperAW(entitySmallEarthGolemID), new ItemStack[]{new ItemStack(Items.clay_ball), terraeStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(entityIceDemonID), new ItemStack[]{crystallosStack, crystallosStack, aquasalusStack, crystallosStack, sanctusStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(entityBoulderFistID), new ItemStack[]{terraeStack, sanctusStack, tennebraeStack, new ItemStack(Items.bone), new ItemStack(Items.cooked_beef), new ItemStack(Items.cooked_beef)}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(entityShadeID), new ItemStack[]{tennebraeStack, tennebraeStack, tennebraeStack, aetherStack, glassStack, new ItemStack(Items.glass_bottle)}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(entityAirElementalID), new ItemStack[]{aetherStack, aetherStack, aetherStack, aetherStack, aetherStack, aetherStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(entityWaterElementalID), new ItemStack[]{aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(entityEarthElementalID), new ItemStack[]{terraeStack, terraeStack, terraeStack, terraeStack, terraeStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(entityFireElementalID), new ItemStack[]{incendiumStack, incendiumStack, incendiumStack, incendiumStack, incendiumStack, incendiumStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(entityShadeElementalID), new ItemStack[]{tennebraeStack, tennebraeStack, tennebraeStack, tennebraeStack, tennebraeStack, tennebraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(entityHolyElementalID), new ItemStack[]{sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
// SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityMinorDemonGruntID), new ItemStack[]{incendiumStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
//Custom mobs
@ -947,9 +951,9 @@ public class AlchemicalWizardry
//Ore Dictionary Registration
OreDictionary.registerOre("oreCoal", Blocks.coal_ore);
MeteorRegistry.registerMeteorParadigm(diamondStack, diamondMeteorArray, diamondMeteorRadius);
MeteorRegistry.registerMeteorParadigm(stoneStack, this.stoneMeteorArray, this.stoneMeteorRadius);
MeteorRegistry.registerMeteorParadigm(ironBlockStack, this.ironBlockMeteorArray, this.ironBlockMeteorRadius);
MeteorRegistry.registerMeteorParadigm(new ItemStack(Items.nether_star), this.netherStarMeteorArray, this.netherStarMeteorRadius);
MeteorRegistry.registerMeteorParadigm(stoneStack, stoneMeteorArray, stoneMeteorRadius);
MeteorRegistry.registerMeteorParadigm(ironBlockStack, ironBlockMeteorArray, ironBlockMeteorRadius);
MeteorRegistry.registerMeteorParadigm(new ItemStack(Items.nether_star), netherStarMeteorArray, netherStarMeteorRadius);
ItemStack stickStack = new ItemStack(Items.stick, 1, craftingConstant);
@ -1126,7 +1130,7 @@ public class AlchemicalWizardry
//TODO Thaumcraft Integration
if (Loader.isModLoaded("Thaumcraft"))
{
this.isThaumcraftLoaded = true;
isThaumcraftLoaded = true;
try
{
@ -1182,7 +1186,7 @@ public class AlchemicalWizardry
}
} else
{
this.isThaumcraftLoaded = false;
isThaumcraftLoaded = false;
}
if(Loader.isModLoaded("guideapi"))
@ -1192,12 +1196,12 @@ public class AlchemicalWizardry
long finalTime = System.nanoTime();
AlchemicalWizardry.logger.info("Recipe Holder initialized: took " + (finalTime - initialTime)/1000000f + "ms.");
this.registerBMBook();
registerBMBook();
}
if (Loader.isModLoaded("Forestry"))
{
this.isForestryLoaded = true;
isForestryLoaded = true;
ModItems.itemBloodFrame = new ItemBloodFrame().setUnlocalizedName("bloodFrame");
@ -1209,7 +1213,7 @@ public class AlchemicalWizardry
}
} else
{
this.isForestryLoaded = false;
isForestryLoaded = false;
}
if (Loader.isModLoaded("harvestcraft"))
@ -1230,9 +1234,9 @@ public class AlchemicalWizardry
AlchemicalWizardry.logger.info("Loaded AgriCraft Handlers!");
}
this.isBotaniaLoaded = Loader.isModLoaded("Botania");
isBotaniaLoaded = Loader.isModLoaded("Botania");
this.isFMPLoaded = Loader.isModLoaded("ForgeMultipart");
isFMPLoaded = Loader.isModLoaded("ForgeMultipart");
BloodMagicConfiguration.loadBlacklist();
BloodMagicConfiguration.blacklistRituals();

View file

@ -72,27 +72,27 @@ import WayofTime.alchemicalWizardry.common.items.potion.WeakBindingAgent;
import WayofTime.alchemicalWizardry.common.items.potion.WeakFillingAgent;
import WayofTime.alchemicalWizardry.common.items.routing.InputRoutingFocus;
import WayofTime.alchemicalWizardry.common.items.routing.OutputRoutingFocus;
import WayofTime.alchemicalWizardry.common.items.sigil.AirSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.DivinationSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemBloodLightSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemFluidSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemHarvestSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemPackRatSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemSeerSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemSigilOfEnderSeverance;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemSigilOfSupression;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemSigilOfTheAssassin;
import WayofTime.alchemicalWizardry.common.items.sigil.LavaSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilAir;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilDivination;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilBloodLight;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilFluid;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilHarvest;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilPackRat;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilSeer;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfEnderSeverance;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfSupression;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfTheAssassin;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilLava;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfElementalAffinity;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfGrowth;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHaste;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.items.sigil.holding.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfMagnetism;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfTheBridge;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfTheFastMiner;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfWind;
import WayofTime.alchemicalWizardry.common.items.sigil.VoidSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.WaterSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilVoid;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilWater;
import cpw.mods.fml.common.registry.GameRegistry;
/**
@ -255,19 +255,19 @@ public class ModItems
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");
waterSigil = new SigilWater().setUnlocalizedName("waterSigil");
lavaSigil = new SigilLava().setUnlocalizedName("lavaSigil");
voidSigil = new SigilVoid().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");
airSigil = new SigilAir().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");
divinationSigil = new SigilDivination().setUnlocalizedName("divinationSigil");
waterScribeTool = new WaterScribeTool().setUnlocalizedName("waterScribeTool");
fireScribeTool = new FireScribeTool().setUnlocalizedName("fireScribeTool");
earthScribeTool = new EarthScribeTool().setUnlocalizedName("earthScribeTool");
@ -323,15 +323,15 @@ public class ModItems
sigilOfMagnetism = new SigilOfMagnetism().setUnlocalizedName("sigilOfMagnetism");
itemKeyOfDiablo = new ItemDiabloKey().setUnlocalizedName("itemDiabloKey");
energyBazooka = new EnergyBazooka().setUnlocalizedName("energyBazooka");
itemBloodLightSigil = new ItemBloodLightSigil().setUnlocalizedName("bloodLightSigil");
itemBloodLightSigil = new SigilBloodLight().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");
itemSigilOfEnderSeverance = (new SigilOfEnderSeverance()).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");
itemSigilOfSupression = new SigilOfSupression().setUnlocalizedName("itemSigilOfSupression");
itemFluidSigil = new SigilFluid().setUnlocalizedName("itemFluidSigil");
itemSeerSigil = new SigilSeer().setUnlocalizedName("itemSeerSigil");
customTool = new ItemSpellMultiTool().setUnlocalizedName("multiTool");
SpellParadigmTool.customTool = customTool;
@ -345,9 +345,9 @@ public class ModItems
dawnScribeTool = new DawnScribeTool().setUnlocalizedName("dawnScribeTool");
itemBloodPack = new ItemBloodLetterPack().setUnlocalizedName("itemBloodPack");
itemHarvestSigil = new ItemHarvestSigil().setUnlocalizedName("itemHarvestSigil");
itemCompressionSigil = new ItemPackRatSigil().setUnlocalizedName("itemCompressionSigil");
itemAssassinSigil = new ItemSigilOfTheAssassin().setUnlocalizedName("itemAssassinSigil");
itemHarvestSigil = new SigilHarvest().setUnlocalizedName("itemHarvestSigil");
itemCompressionSigil = new SigilPackRat().setUnlocalizedName("itemCompressionSigil");
itemAssassinSigil = new SigilOfTheAssassin().setUnlocalizedName("itemAssassinSigil");
boundHelmetWater = new OmegaArmourWater(0).setUnlocalizedName("boundHelmetWater");
boundPlateWater = new OmegaArmourWater(1).setUnlocalizedName("boundPlateWater");

View file

@ -0,0 +1,4 @@
package WayofTime.alchemicalWizardry.api.items.interfaces;
public interface ISigil {
}

View file

@ -60,8 +60,8 @@ public class MessageKeyPressed implements IMessage, IMessageHandler<MessageKeyPr
return null;
}
public static enum Key
public enum Key
{
OMEGA_ACTIVE;
OMEGA_ACTIVE
}
}

View file

@ -38,21 +38,14 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Handles the packet wrangling for IronChest
*
* @author cpw
*/
public enum NewPacketHandler
{
INSTANCE;
private EnumMap<Side, FMLEmbeddedChannel> channels;
private NewPacketHandler()
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)
{

View file

@ -18,7 +18,7 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.items.IAltarManipulator;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.items.sigil.holding.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -138,7 +138,7 @@ public class BlockAltar extends BlockContainer
}
else if (playerItem.getItem().equals(ModItems.sigilOfHolding))
{
ItemStack item = ((SigilOfHolding) playerItem.getItem()).getCurrentItem(playerItem);
ItemStack item = SigilOfHolding.getCurrentSigil(playerItem);
if (item != null && item.getItem().equals(ModItems.divinationSigil))
{

View file

@ -30,7 +30,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ILPGauge;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.items.sigil.DivinationSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilDivination;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaArmour;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.Optional.Interface;
@ -685,7 +685,7 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA
}
if (item.getItem() instanceof ArmourUpgrade && blood > 0)
{
if (item.getItem() instanceof DivinationSigil)
if (item.getItem() instanceof SigilDivination)
{
return true;
}

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -15,11 +16,11 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class AirSigil extends EnergyItems implements ArmourUpgrade
public class SigilAir extends EnergyItems implements ArmourUpgrade, ISigil
{
private int energyUsed;
public AirSigil()
public SigilAir()
{
super();
this.maxStackSize = 1;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -19,11 +20,11 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBloodLightSigil extends EnergyItems implements IHolding, ArmourUpgrade
public class SigilBloodLight extends EnergyItems implements IHolding, ArmourUpgrade, ISigil
{
private int tickDelay = 100;
public ItemBloodLightSigil()
public SigilBloodLight()
{
super();
this.maxStackSize = 1;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -24,9 +25,9 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class DivinationSigil extends Item implements ArmourUpgrade, IReagentManipulator, IBindable
public class SigilDivination extends Item implements ArmourUpgrade, IReagentManipulator, IBindable, ISigil
{
public DivinationSigil()
public SigilDivination()
{
super();
this.maxStackSize = 1;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
@ -23,7 +24,7 @@ import net.minecraftforge.fluids.*;
import java.util.ArrayList;
import java.util.List;
public class ItemFluidSigil extends Item implements IFluidContainerItem
public class SigilFluid extends Item implements IFluidContainerItem, ISigil
{
private int capacity = 128 * 1000;
private static final int STATE_SYPHON = 0;
@ -34,7 +35,7 @@ public class ItemFluidSigil extends Item implements IFluidContainerItem
private static final int STATE_BEAST_DRAIN = 5;
private static final int maxNumOfStates = 6;
public ItemFluidSigil()
public SigilFluid()
{
super();
this.setMaxDamage(0);

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@ -18,14 +19,14 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemHarvestSigil extends EnergyItems implements IHolding, ArmourUpgrade
public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade, ISigil
{
@SideOnly(Side.CLIENT)
private static IIcon activeIcon;
@SideOnly(Side.CLIENT)
private static IIcon passiveIcon;
public ItemHarvestSigil()
public SigilHarvest()
{
super();
this.maxStackSize = 1;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
@ -25,7 +26,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class LavaSigil extends ItemBucket implements ArmourUpgrade
public class SigilLava extends ItemBucket implements ArmourUpgrade, ISigil
{
/**
* field for checking if the bucket has been filled.
@ -33,7 +34,7 @@ public class LavaSigil extends ItemBucket implements ArmourUpgrade
private Block isFull = Blocks.lava;
private int energyUsed;
public LavaSigil()
public SigilLava()
{
super(Blocks.lava);
this.maxStackSize = 1;

View file

@ -1,6 +1,7 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -17,7 +18,7 @@ import net.minecraft.world.World;
import java.util.List;
public class SigilOfElementalAffinity extends EnergyItems
public class SigilOfElementalAffinity extends EnergyItems implements ISigil
{
@SideOnly(Side.CLIENT)
private static IIcon activeIcon;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;
@ -19,14 +20,14 @@ import net.minecraft.world.World;
import java.util.List;
public class ItemSigilOfEnderSeverance extends EnergyItems implements IHolding
public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISigil
{
@SideOnly(Side.CLIENT)
private static IIcon activeIcon;
@SideOnly(Side.CLIENT)
private static IIcon passiveIcon;
public ItemSigilOfEnderSeverance()
public SigilOfEnderSeverance()
{
super();
this.maxStackSize = 1;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.relauncher.Side;
@ -23,7 +24,7 @@ import net.minecraftforge.event.entity.player.BonemealEvent;
import java.util.List;
public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade
public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
{
private static IIcon activeIcon;
private static IIcon passiveIcon;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -17,7 +18,7 @@ import net.minecraft.world.World;
import java.util.List;
public class SigilOfHaste extends EnergyItems implements ArmourUpgrade
public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil
{
@SideOnly(Side.CLIENT)
private static IIcon activeIcon;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
@ -19,7 +20,7 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHolding
public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHolding, ISigil
{
private static IIcon activeIcon;
private static IIcon passiveIcon;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
@ -21,7 +22,7 @@ import net.minecraft.world.World;
import java.util.List;
public class ItemSigilOfSupression extends EnergyItems implements ArmourUpgrade
public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISigil
{
private static IIcon activeIcon;
private static IIcon passiveIcon;
@ -29,7 +30,7 @@ public class ItemSigilOfSupression extends EnergyItems implements ArmourUpgrade
private int radius = 5;
private int refresh = 100;
public ItemSigilOfSupression()
public SigilOfSupression()
{
super();
this.maxStackSize = 1;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
@ -27,9 +28,9 @@ import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemSigilOfTheAssassin extends EnergyItems implements ArmourUpgrade
public class SigilOfTheAssassin extends EnergyItems implements ArmourUpgrade, ISigil
{
public ItemSigilOfTheAssassin()
public SigilOfTheAssassin()
{
super();
this.maxStackSize = 1;

View file

@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
import cpw.mods.fml.relauncher.Side;
@ -20,7 +21,7 @@ import net.minecraft.world.World;
import java.util.List;
public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade
public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISigil
{
private static IIcon activeIcon;
private static IIcon passiveIcon;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -18,7 +19,7 @@ import net.minecraft.world.World;
import java.util.List;
public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade
public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, ISigil
{
@SideOnly(Side.CLIENT)
private static IIcon activeIcon;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -17,7 +18,7 @@ import net.minecraft.world.World;
import java.util.List;
public class SigilOfWind extends EnergyItems implements ArmourUpgrade
public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil
{
@SideOnly(Side.CLIENT)
private static IIcon activeIcon;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
@ -19,14 +20,14 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemPackRatSigil extends EnergyItems implements IHolding, ArmourUpgrade
public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade, ISigil
{
@SideOnly(Side.CLIENT)
private static IIcon activeIcon;
@SideOnly(Side.CLIENT)
private static IIcon passiveIcon;
public ItemPackRatSigil()
public SigilPackRat()
{
super();
this.maxStackSize = 1;

View file

@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -16,9 +17,9 @@ import net.minecraft.world.World;
import java.util.List;
public class ItemSeerSigil extends Item implements IHolding, ArmourUpgrade
public class SigilSeer extends Item implements IHolding, ArmourUpgrade, ISigil
{
public ItemSeerSigil()
public SigilSeer()
{
super();
this.maxStackSize = 1;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBucket;
@ -19,12 +20,12 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class VoidSigil extends ItemBucket implements ArmourUpgrade
public class SigilVoid extends ItemBucket implements ArmourUpgrade, ISigil
{
private int isFull;
private int energyUsed;
public VoidSigil()
public SigilVoid()
{
super(null);
this.maxStackSize = 1;

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
@ -24,12 +25,12 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class WaterSigil extends ItemBucket implements ArmourUpgrade
public class SigilWater extends ItemBucket implements ArmourUpgrade, ISigil
{
private Block isFull = Blocks.water;
private int energyUsed;
public WaterSigil()
public SigilWater()
{
super(Blocks.water);
this.maxStackSize = 1;

View file

@ -0,0 +1,195 @@
package WayofTime.alchemicalWizardry.common.items.sigil.holding;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerHolding extends Container
{
protected final int PLAYER_INVENTORY_ROWS = 3;
protected final int PLAYER_INVENTORY_COLUMNS = 9;
private int inventoryColumns = 5;
private final EntityPlayer player;
public final InventoryHolding inventoryHolding;
public ContainerHolding(EntityPlayer player, InventoryHolding inventoryHolding)
{
this.player = player;
this.inventoryHolding = inventoryHolding;
int currentSlotHeldIn = player.inventory.currentItem;
for (int columnIndex = 0; columnIndex < inventoryColumns; ++columnIndex)
{
this.addSlotToContainer(new SlotHolding(this, inventoryHolding, player, columnIndex, 8 + columnIndex * 36, 15));
}
for (int rowIndex = 0; rowIndex < PLAYER_INVENTORY_ROWS; ++rowIndex)
{
for (int columnIndex = 0; columnIndex < PLAYER_INVENTORY_COLUMNS; ++columnIndex)
{
this.addSlotToContainer(new Slot(player.inventory, columnIndex + rowIndex * 9 + 9, 8 + columnIndex * 18, 39 + rowIndex * 18));
}
}
for (int actionBarIndex = 0; actionBarIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarIndex)
{
if (actionBarIndex == currentSlotHeldIn)
{
this.addSlotToContainer(new SlotDisabled(player.inventory, actionBarIndex, 8 + actionBarIndex * 18, 97));
}
else
{
this.addSlotToContainer(new Slot(player.inventory, actionBarIndex, 8 + actionBarIndex * 18, 97));
}
}
}
@Override
public boolean canInteractWith(EntityPlayer entityPlayer)
{
return true;
}
@Override
public void onContainerClosed(EntityPlayer entityPlayer)
{
super.onContainerClosed(entityPlayer);
if (!entityPlayer.worldObj.isRemote)
{
saveInventory(entityPlayer);
}
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
if (!player.worldObj.isRemote)
{
saveInventory(player);
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex)
{
ItemStack stack = null;
Slot slotObject = (Slot) inventorySlots.get(slotIndex);
int slots = inventorySlots.size();
if (slotObject != null && slotObject.getHasStack())
{
ItemStack stackInSlot = slotObject.getStack();
stack = stackInSlot.copy();
if (stack.getItem() instanceof ISigil)
{
if (slotIndex < inventoryColumns)
{
if (!this.mergeItemStack(stackInSlot, inventoryColumns, slots, false))
{
return null;
}
}
else if (!this.mergeItemStack(stackInSlot, 0, inventoryColumns, false))
{
return null;
}
}
else if (stack.getItem() instanceof SigilOfHolding)
{
if (slotIndex < inventoryColumns + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS))
{
if (!this.mergeItemStack(stackInSlot, inventoryColumns + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS), inventorySlots.size(), false))
{
return null;
}
}
else if (!this.mergeItemStack(stackInSlot, inventoryColumns, inventoryColumns + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS), false))
{
return null;
}
}
if (stackInSlot.stackSize == 0)
{
slotObject.putStack(null);
} else
{
slotObject.onSlotChanged();
}
if (stackInSlot.stackSize == stack.stackSize)
{
return null;
}
slotObject.onPickupFromSlot(player, stackInSlot);
}
return stack;
}
public void saveInventory(EntityPlayer entityPlayer)
{
inventoryHolding.onGuiSaved(entityPlayer);
}
private class SlotHolding extends Slot
{
private final EntityPlayer player;
private ContainerHolding containerHolding;
public SlotHolding(ContainerHolding containerHolding, IInventory inventory, EntityPlayer player, int slotIndex, int x, int y)
{
super(inventory, slotIndex, x, y);
this.player = player;
this.containerHolding = containerHolding;
}
@Override
public void onSlotChanged()
{
super.onSlotChanged();
if (FMLCommonHandler.instance().getEffectiveSide().isServer())
{
containerHolding.saveInventory(player);
}
}
@Override
public boolean isItemValid(ItemStack itemStack)
{
return itemStack.getItem() instanceof ISigil;
}
}
private class SlotDisabled extends Slot
{
public SlotDisabled(IInventory inventory, int slotIndex, int x, int y)
{
super(inventory, slotIndex, x, y);
}
@Override
public boolean isItemValid(ItemStack itemStack)
{
return false;
}
@Override
public boolean canTakeStack(EntityPlayer player)
{
return false;
}
}
}

View file

@ -0,0 +1,38 @@
package WayofTime.alchemicalWizardry.common.items.sigil.holding;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class GuiHolding extends GuiContainer
{
public GuiHolding(EntityPlayer player, InventoryHolding inventoryHolding)
{
super(new ContainerHolding(player, inventoryHolding));
xSize = 176;
ySize = 121;
}
@Override
protected void drawGuiContainerForegroundLayer(int param1, int param2)
{
//the parameters for drawString are: string, x, y, color
fontRendererObj.drawString("Sigil of Holding", 52, 4, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
//draw your Gui here, only thing you need to change is the path
ResourceLocation test = new ResourceLocation("alchemicalwizardry", "gui/SigilOfHolding.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(test);
int x = (width - xSize) / 2;
int y = (height - ySize) / 2;
this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
}
}

View file

@ -0,0 +1,15 @@
package WayofTime.alchemicalWizardry.common.items.sigil.holding;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;
public class HoldingPacketHandler
{
public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel("SigilOfHolding");
public static void init()
{
INSTANCE.registerMessage(HoldingPacketProcessor.class, HoldingPacketProcessor.class, 0, Side.SERVER);
}
}

View file

@ -0,0 +1,55 @@
package WayofTime.alchemicalWizardry.common.items.sigil.holding;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;
public class HoldingPacketProcessor implements IMessage, IMessageHandler<HoldingPacketProcessor, IMessage>
{
private int slot;
private int mode;
public HoldingPacketProcessor()
{
}
public HoldingPacketProcessor(int slot, int mode)
{
this.slot = slot;
this.mode = mode;
}
@Override
public void toBytes(ByteBuf buffer)
{
buffer.writeInt(slot);
buffer.writeInt(mode);
}
@Override
public void fromBytes(ByteBuf buffer)
{
slot = buffer.readInt();
mode = buffer.readInt();
}
@Override
public IMessage onMessage(HoldingPacketProcessor message, MessageContext ctx)
{
ItemStack itemStack = null;
if (message.slot > -1 && message.slot < 9)
{
itemStack = ctx.getServerHandler().playerEntity.inventory.getStackInSlot(message.slot);
}
if (itemStack != null)
{
SigilOfHolding.cycleSigil(itemStack, message.mode);
}
return null;
}
}

View file

@ -0,0 +1,261 @@
package WayofTime.alchemicalWizardry.common.items.sigil.holding;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import java.util.UUID;
public class InventoryHolding implements IInventory
{
public ItemStack parentItemStack;
protected ItemStack[] inventory;
protected static String NBT_MOST_SIG = "MostSig";
protected static String NBT_LEAST_SIG = "LeastSig";
protected static String NBT_ITEMS = "Items";
public InventoryHolding(ItemStack itemStack)
{
parentItemStack = itemStack;
inventory = new ItemStack[5];
readFromNBT(itemStack.getTagCompound());
}
public void onGuiSaved(EntityPlayer entityPlayer)
{
parentItemStack = findParentItemStack(entityPlayer);
if (parentItemStack != null)
{
save();
}
}
public ItemStack findParentItemStack(EntityPlayer entityPlayer)
{
if (hasUUID(parentItemStack))
{
UUID parentItemStackUUID = new UUID(parentItemStack.getTagCompound().getLong(NBT_MOST_SIG), parentItemStack.getTagCompound().getLong(NBT_LEAST_SIG));
for (int i = 0; i < entityPlayer.inventory.getSizeInventory(); i++)
{
ItemStack itemStack = entityPlayer.inventory.getStackInSlot(i);
if (hasUUID(itemStack))
{
if (itemStack.getTagCompound().getLong(NBT_MOST_SIG) == parentItemStackUUID.getMostSignificantBits() && itemStack.getTagCompound().getLong(NBT_LEAST_SIG) == parentItemStackUUID.getLeastSignificantBits())
{
return itemStack;
}
}
}
}
return null;
}
public void save()
{
NBTTagCompound nbtTagCompound = parentItemStack.getTagCompound();
if (nbtTagCompound == null)
{
nbtTagCompound = new NBTTagCompound();
UUID uuid = UUID.randomUUID();
nbtTagCompound.setLong(NBT_MOST_SIG, uuid.getMostSignificantBits());
nbtTagCompound.setLong(NBT_LEAST_SIG, uuid.getLeastSignificantBits());
}
writeToNBT(nbtTagCompound);
parentItemStack.setTagCompound(nbtTagCompound);
}
@Override
public int getSizeInventory()
{
return inventory.length;
}
@Override
public ItemStack getStackInSlot(int slotIndex)
{
return slotIndex >= 0 && slotIndex < this.inventory.length ? inventory[slotIndex] : null;
}
@Override
public ItemStack decrStackSize(int slotIndex, int decrementAmount)
{
ItemStack itemStack = getStackInSlot(slotIndex);
if (itemStack != null)
{
if (itemStack.stackSize <= decrementAmount)
{
setInventorySlotContents(slotIndex, null);
}
else
{
itemStack = itemStack.splitStack(decrementAmount);
if (itemStack.stackSize == 0)
{
setInventorySlotContents(slotIndex, null);
}
}
}
return itemStack;
}
@Override
public ItemStack getStackInSlotOnClosing(int slotIndex)
{
if (inventory[slotIndex] != null)
{
ItemStack itemStack = inventory[slotIndex];
inventory[slotIndex] = null;
return itemStack;
}
else
{
return null;
}
}
@Override
public void setInventorySlotContents(int slotIndex, ItemStack itemStack)
{
if (slotIndex >= 0 && slotIndex < this.inventory.length)
{
this.inventory[slotIndex] = itemStack;
}
}
@Override
public String getInventoryName()
{
return "SigilOfHolding";
}
@Override
public boolean hasCustomInventoryName()
{
return false;
}
@Override
public int getInventoryStackLimit()
{
return 1;
}
@Override
public void markDirty()
{
// NOOP
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityPlayer)
{
return true;
}
@Override
public void openInventory()
{
// NOOP
}
@Override
public void closeInventory()
{
// NOOP
}
@Override
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack)
{
return itemStack.getItem() instanceof ISigil;
}
public void readFromNBT(NBTTagCompound nbtTagCompound)
{
if (nbtTagCompound != null && nbtTagCompound.hasKey(NBT_ITEMS))
{
// Read in the ItemStacks in the inventory from NBT
if (nbtTagCompound.hasKey(NBT_ITEMS))
{
NBTTagList tagList = nbtTagCompound.getTagList(NBT_ITEMS, 10);
inventory = new ItemStack[this.getSizeInventory()];
for (int i = 0; i < tagList.tagCount(); ++i)
{
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
byte slotIndex = tagCompound.getByte("Slot");
if (slotIndex >= 0 && slotIndex < inventory.length)
{
inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
}
}
}
}
}
public void writeToNBT(NBTTagCompound nbtTagCompound)
{
// Write the ItemStacks in the inventory to NBT
NBTTagList tagList = new NBTTagList();
for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex)
{
if (inventory[currentIndex] != null)
{
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setByte("Slot", (byte) currentIndex);
inventory[currentIndex].writeToNBT(tagCompound);
tagList.appendTag(tagCompound);
}
}
nbtTagCompound.setTag(NBT_ITEMS, tagList);
}
public static boolean hasTag(ItemStack itemStack, String keyName)
{
return itemStack != null && itemStack.stackTagCompound != null && itemStack.stackTagCompound.hasKey(keyName);
}
public static boolean hasUUID(ItemStack itemStack)
{
return hasTag(itemStack, NBT_MOST_SIG) && hasTag(itemStack, NBT_LEAST_SIG);
}
public static void setUUID(ItemStack itemStack)
{
initNBTTagCompound(itemStack);
if (!hasTag(itemStack, NBT_MOST_SIG) && !hasTag(itemStack, NBT_LEAST_SIG))
{
UUID itemUUID = UUID.randomUUID();
setLong(itemStack, NBT_MOST_SIG, itemUUID.getMostSignificantBits());
setLong(itemStack, NBT_LEAST_SIG, itemUUID.getLeastSignificantBits());
}
}
private static void initNBTTagCompound(ItemStack itemStack)
{
if (itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
}
public static void setLong(ItemStack itemStack, String keyName, long keyValue)
{
initNBTTagCompound(itemStack);
itemStack.stackTagCompound.setLong(keyName, keyValue);
}
}

View file

@ -0,0 +1,45 @@
package WayofTime.alchemicalWizardry.common.items.sigil.holding;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.MouseEvent;
@SideOnly(Side.CLIENT)
public class ScrollHelper
{
@SubscribeEvent
public void onMouseEvent(MouseEvent event)
{
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
if (event.dwheel != 0 && player != null && player.isSneaking())
{
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null)
{
Item item = stack.getItem();
if (item instanceof SigilOfHolding)
{
cycleSigil(stack, player, event.dwheel);
event.setCanceled(true);
}
}
}
}
private void cycleSigil(ItemStack stack, EntityPlayer player, int dWheel)
{
int mode = SigilOfHolding.getCurrentItem(stack);
mode = dWheel < 0 ? SigilOfHolding.next(mode) : SigilOfHolding.prev(mode);
SigilOfHolding.cycleSigil(stack, mode);
HoldingPacketHandler.INSTANCE.sendToServer(new HoldingPacketProcessor(player.inventory.currentItem, mode));
}
}

View file

@ -1,4 +1,4 @@
package WayofTime.alchemicalWizardry.common.items.sigil;
package WayofTime.alchemicalWizardry.common.items.sigil.holding;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
@ -23,9 +24,9 @@ import java.util.List;
public class SigilOfHolding extends EnergyItems
{
private int invSize = 4;
private static int invSize = 4;
public static List<ItemStack> allowedSigils = new ArrayList();
private static final String NBT_CURRENT_SIGIL = "CurrentSigil";
public SigilOfHolding()
{
@ -53,7 +54,7 @@ public class SigilOfHolding extends EnergyItems
return this.itemIcon;
}
ItemStack item = inv[stack.getTagCompound().getInteger("selectedSlot")];
ItemStack item = getCurrentSigil(stack);
if (item != null)
{
@ -79,18 +80,19 @@ public class SigilOfHolding extends EnergyItems
return;
}
ItemStack item = inv[par1ItemStack.getTagCompound().getInteger("selectedSlot")];
int currentSlot = getCurrentItem(par1ItemStack);
ItemStack item = inv[currentSlot];
if (item != null)
{
par3List.add(StatCollector.translateToLocal("tooltip.item.currentitem") + " " + item.getDisplayName());
}
for (int i = 0; i < invSize; i++)
for (int i = 0; i <= invSize; i++)
{
if (inv[i] != null)
{
par3List.add(StatCollector.translateToLocal("tooltip.item.iteminslot") + " " + i + ": " + inv[i].getDisplayName());
par3List.add(StatCollector.translateToLocal("tooltip.item.iteminslot") + " " + (i + 1) + ": " + inv[i].getDisplayName());
}
}
}
@ -101,7 +103,7 @@ public class SigilOfHolding extends EnergyItems
{
if (checkAndSetItemOwner(par1ItemStack, par2EntityPlayer))
{
int currentSlot = this.getSelectedSlot(par1ItemStack);
int currentSlot = getCurrentItem(par1ItemStack);
ItemStack[] inv = getInternalInventory(par1ItemStack);
if (inv == null)
@ -118,11 +120,11 @@ public class SigilOfHolding extends EnergyItems
boolean bool = itemUsed.getItem().onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
saveInternalInventory(par1ItemStack, inv);
saveInventory(par1ItemStack, inv);
return bool;
}
return false;
}
@ -133,16 +135,12 @@ public class SigilOfHolding extends EnergyItems
{
if (par3EntityPlayer.isSneaking())
{
if (this.addSigilToInventory(par1ItemStack, par3EntityPlayer))
{
return par1ItemStack;
}
selectNextSlot(par1ItemStack);
InventoryHolding.setUUID(par1ItemStack);
par3EntityPlayer.openGui(AlchemicalWizardry.instance, 3, par3EntityPlayer.worldObj, (int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ);
return par1ItemStack;
}
int currentSlot = this.getSelectedSlot(par1ItemStack);
int currentSlot = getCurrentItem(par1ItemStack);
ItemStack[] inv = getInternalInventory(par1ItemStack);
if (inv == null)
@ -158,32 +156,84 @@ public class SigilOfHolding extends EnergyItems
}
itemUsed.getItem().onItemRightClick(itemUsed, par2World, par3EntityPlayer);
saveInternalInventory(par1ItemStack, inv);
saveInventory(par1ItemStack, inv);
}
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
public static int next(int mode)
{
if (!(par1ItemStack.getTagCompound() == null))
int index = mode + 1;
if (index >= invSize + 1)
{
this.tickInternalInventory(par1ItemStack, par2World, par3Entity, par4, par5);
index = 0;
}
return index;
}
public static int prev(int mode)
{
int index = mode - 1;
if (index < 0)
{
index = invSize;
}
return index;
}
private static void initModeTag(ItemStack itemStack)
{
if (itemStack.stackTagCompound == null)
{
itemStack.stackTagCompound = new NBTTagCompound();
itemStack.stackTagCompound.setInteger(NBT_CURRENT_SIGIL, invSize);
}
}
public ItemStack[] getInternalInventory(ItemStack itemStack)
public static ItemStack getCurrentSigil(ItemStack itemStack)
{
NBTTagCompound itemTag = itemStack.getTagCompound();
if (itemTag == null)
if (itemStack != null && itemStack.getItem() instanceof SigilOfHolding)
{
ItemStack[] itemStacks = getInternalInventory(itemStack);
int currentSlot = getCurrentItem(itemStack);
if (itemStacks != null)
{
return itemStacks[currentSlot];
}
}
return null;
}
public static int getCurrentItem(ItemStack itemStack)
{
if (itemStack != null && itemStack.getItem() instanceof SigilOfHolding)
{
initModeTag(itemStack);
int currentSigil = itemStack.stackTagCompound.getInteger(NBT_CURRENT_SIGIL);
currentSigil = MathHelper.clamp_int(currentSigil, 0, invSize);
return currentSigil;
}
return 4;
}
public static ItemStack[] getInternalInventory(ItemStack itemStack)
{
initModeTag(itemStack);
NBTTagCompound tagCompound = itemStack.getTagCompound();
if (tagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
return null;
}
ItemStack[] inv = new ItemStack[9];
NBTTagList tagList = itemTag.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
NBTTagList tagList = tagCompound.getTagList(InventoryHolding.NBT_ITEMS, 10);
if (tagList == null)
{
@ -192,10 +242,10 @@ public class SigilOfHolding extends EnergyItems
for (int i = 0; i < tagList.tagCount(); i++)
{
NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
NBTTagCompound tag = tagList.getCompoundTagAt(i);
int slot = tag.getByte("Slot");
if (slot >= 0 && slot < invSize)
if (slot >= 0 && slot <= invSize)
{
inv[slot] = ItemStack.loadItemStackFromNBT(tag);
}
@ -204,7 +254,7 @@ public class SigilOfHolding extends EnergyItems
return inv;
}
public void saveInternalInventory(ItemStack itemStack, ItemStack[] inventory)
public void saveInventory(ItemStack itemStack, ItemStack[] inventory)
{
NBTTagCompound itemTag = itemStack.getTagCompound();
@ -215,10 +265,8 @@ public class SigilOfHolding extends EnergyItems
NBTTagList itemList = new NBTTagList();
for (int i = 0; i < invSize; i++)
for (int i = 0; i <= invSize; i++)
{
ItemStack stack = inventory[i];
if (inventory[i] != null)
{
NBTTagCompound tag = new NBTTagCompound();
@ -228,7 +276,25 @@ public class SigilOfHolding extends EnergyItems
}
}
itemTag.setTag("Inventory", itemList);
itemTag.setTag(InventoryHolding.NBT_ITEMS, itemList);
}
public static void cycleSigil(ItemStack itemStack, int mode)
{
if (itemStack != null && itemStack.getItem() instanceof SigilOfHolding)
{
initModeTag(itemStack);
itemStack.stackTagCompound.setInteger(NBT_CURRENT_SIGIL, mode);
}
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (!(par1ItemStack.getTagCompound() == null))
{
this.tickInternalInventory(par1ItemStack, par2World, par3Entity, par4, par5);
}
}
public void tickInternalInventory(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
@ -250,148 +316,4 @@ public class SigilOfHolding extends EnergyItems
inv[i].getItem().onUpdate(inv[i], par2World, par3Entity, par4, par5);
}
}
public int getSelectedSlot(ItemStack itemStack)
{
NBTTagCompound itemTag = itemStack.getTagCompound();
if (itemTag == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
return itemTag.getInteger("selectedSlot");
}
public void selectNextSlot(ItemStack itemStack)
{
ItemStack[] inv = getInternalInventory(itemStack);
int filledSlots = 0;
for (int i = 0; i < invSize; i++)
{
if (inv[i] != null)
{
filledSlots++;
} else
{
break;
}
}
NBTTagCompound itemTag = itemStack.getTagCompound();
if (itemTag == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
if (getSelectedSlot(itemStack) + 1 < filledSlots)
{
itemTag.setInteger("selectedSlot", itemTag.getInteger("selectedSlot") + 1);
} else
{
itemTag.setInteger("selectedSlot", 0);
}
}
public boolean hasAddedToInventory(ItemStack sigilItemStack, ItemStack addedItemStack)
{
ItemStack[] inv = getInternalInventory(sigilItemStack);
if (inv == null)
{
return false;
}
if (addedItemStack == null)
{
return false;
}
Item item = addedItemStack.getItem();
int candidateSlot = -1;
for (int i = invSize - 1; i >= 0; i--)
{
ItemStack nextItem = inv[i];
if (nextItem == null)
{
candidateSlot = i;
continue;
}
if (item == nextItem.getItem())
{
return false;
}
}
if (candidateSlot == -1)
{
return false;
}
if (addedItemStack.getItem() instanceof IHolding)
{
inv[candidateSlot] = addedItemStack;
saveInternalInventory(sigilItemStack, inv);
return true;
}
for (ItemStack i : allowedSigils)
{
if (i != null && i.getItem() == item)
{
inv[candidateSlot] = addedItemStack;
saveInternalInventory(sigilItemStack, inv);
return true;
}
}
return false;
}
public boolean addSigilToInventory(ItemStack sigilItemStack, EntityPlayer player)
{
ItemStack[] playerInventory = player.inventory.mainInventory;
for (int i = 0; i < 36; i++)
{
if (this.hasAddedToInventory(sigilItemStack, playerInventory[i]))
{
player.inventory.consumeInventoryItem(playerInventory[i].getItem());
return true;
}
}
return false;
}
public static void initiateSigilOfHolding()
{
allowedSigils.add(new ItemStack(ModItems.waterSigil));
allowedSigils.add(new ItemStack(ModItems.lavaSigil));
allowedSigils.add(new ItemStack(ModItems.voidSigil));
allowedSigils.add(new ItemStack(ModItems.airSigil));
allowedSigils.add(new ItemStack(ModItems.sigilOfTheFastMiner));
allowedSigils.add(new ItemStack(ModItems.divinationSigil));
allowedSigils.add(new ItemStack(ModItems.sigilOfElementalAffinity));
allowedSigils.add(new ItemStack(ModItems.growthSigil));
allowedSigils.add(new ItemStack(ModItems.sigilOfHaste));
allowedSigils.add(new ItemStack(ModItems.sigilOfWind));
}
public ItemStack getCurrentItem(ItemStack sigilItemStack)
{
ItemStack[] items = this.getInternalInventory(sigilItemStack);
if (items == null)
{
return null;
}
return items[this.getSelectedSlot(sigilItemStack)];
}
}

View file

@ -11,12 +11,10 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
@ -92,9 +90,6 @@ public class RitualEffectUnbinding extends RitualEffect
} else if (itemStack.getItem() == ModItems.boundBoots)
{
ritualStone.setVar1(4);
} else if (itemStack.getItem() == ModItems.sigilOfHolding)
{
ritualStone.setVar1(-1);
}
else if (UnbindingRegistry.isRequiredItemValid(itemStack))
{
@ -125,29 +120,6 @@ public class RitualEffectUnbinding extends RitualEffect
ritualStone.setActive(false);
drain = true;
break;
} else if (ritualStone.getVar1() == -1)
{
item.setDead();
doLightning(world, x, y, z);
ItemStack[] inv = ((SigilOfHolding) itemStack.getItem()).getInternalInventory(itemStack);
if (inv != null)
{
for (ItemStack internalItem : inv)
{
if (internalItem != null)
{
EntityItem newItem = new EntityItem(world, x + 0.5, y + 1, z + 0.5, internalItem.copy());
world.spawnEntityInWorld(newItem);
}
}
}
EntityItem newItem = new EntityItem(world, x + 0.5, y + 1, z + 0.5, new ItemStack(ModItems.sigilOfHolding, 1, 0));
world.spawnEntityInWorld(newItem);
ritualStone.setActive(false);
drain = true;
break;
}
else if (ritualStone.getVar1() >= 9)
{

View file

@ -50,7 +50,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.items.sigil.DivinationSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilDivination;
import cpw.mods.fml.common.FMLCommonHandler;
public class SpellHelper
@ -131,7 +131,7 @@ public class SpellHelper
ItemStack heldStack = player.getHeldItem();
if (heldStack != null && heldStack.getItem() instanceof DivinationSigil)
if (heldStack != null && heldStack.getItem() instanceof SigilDivination)
{
return true;
}

View file

@ -5,6 +5,7 @@ import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@ -15,7 +16,7 @@ public class ContainerTeleposer extends Container
public ContainerTeleposer(InventoryPlayer inventoryPlayer, TETeleposer te)
{
tileEntity = te;
addSlotToContainer(new Slot(tileEntity, 0, 80, 15));
addSlotToContainer(new SlotTeleposer(te, 0, 80, 15));
bindPlayerInventory(inventoryPlayer);
}
@ -86,4 +87,18 @@ public class ContainerTeleposer extends Container
return stack;
}
private class SlotTeleposer extends Slot
{
public SlotTeleposer(IInventory inventory, int slotIndex, int x, int y)
{
super(inventory, slotIndex, x, y);
}
@Override
public boolean isItemValid(ItemStack itemStack)
{
return itemStack.getItem() instanceof TelepositionFocus;
}
}
}

View file

@ -1,5 +1,8 @@
package WayofTime.alchemicalWizardry.common.tileEntity.gui;
import WayofTime.alchemicalWizardry.common.items.sigil.holding.ContainerHolding;
import WayofTime.alchemicalWizardry.common.items.sigil.holding.GuiHolding;
import WayofTime.alchemicalWizardry.common.items.sigil.holding.InventoryHolding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@ -40,6 +43,9 @@ public class GuiHandler implements IGuiHandler
{
return new ContainerTeleposer(player.inventory, (TETeleposer) tileEntity);
}
case 3:
return new ContainerHolding(player, new InventoryHolding(player.getHeldItem()));
}
return null;
@ -99,6 +105,8 @@ public class GuiHandler implements IGuiHandler
}
return new GuiCategories(player);
case 3:
return new GuiHolding(player, new InventoryHolding(player.getHeldItem()));
}
return null;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB