Random stuffs

Updated commands
Added in a ritual hologram --Alex's code
Added a Total Stones tooltip to the ritual diviner
Gave the Alchemy Relay a null bounding box
Added localizations to the blocks that didn't have any
This commit is contained in:
Arcaratus 2015-04-18 19:49:09 -04:00
parent 003a65a51b
commit 31f552fe2d
87 changed files with 2513 additions and 682 deletions

View file

@ -139,6 +139,7 @@ import WayofTime.alchemicalWizardry.common.rituals.RitualEffectAnimalGrowth;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectAutoAlchemy;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectBiomeChanger;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectContainment;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectCrafting;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectCrushing;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectDemonPortal;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectEllipsoid;
@ -284,7 +285,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = "AWWayofTime", name = "AlchemicalWizardry", version = "v1.3.1", guiFactory = "WayofTime.alchemicalWizardry.client.gui.ConfigGuiFactory")
@Mod(modid = "AWWayofTime", name = "AlchemicalWizardry", version = "v1.3.2", guiFactory = "WayofTime.alchemicalWizardry.client.gui.ConfigGuiFactory")
public class AlchemicalWizardry
{
@ -643,6 +644,8 @@ public class AlchemicalWizardry
ItemStack simpleCatalystStack = new ItemStack(ModItems.simpleCatalyst);
ItemStack duskRitualDivinerStack = new ItemStack(ModItems.itemRitualDiviner);
((ItemRitualDiviner) duskRitualDivinerStack.getItem()).setMaxRuneDisplacement(duskRitualDivinerStack, 1);
ItemStack dawnRitualDivinerStack = new ItemStack(ModItems.itemRitualDiviner);
((ItemRitualDiviner) dawnRitualDivinerStack.getItem()).setMaxRuneDisplacement(dawnRitualDivinerStack, 2);
waterSigilStackCrafted.setItemDamage(waterSigilStackCrafted.getMaxDamage());
lavaSigilStackCrafted.setItemDamage(lavaSigilStackCrafted.getMaxDamage());
voidSigilStackCrafted.setItemDamage(voidSigilStackCrafted.getMaxDamage());
@ -731,6 +734,7 @@ public class AlchemicalWizardry
customPotionAmphibian = (new PotionAmphibian(customPotionAmphibianID, false, 0).setIconIndex(0, 0).setPotionName("Amphibian"));
ItemStack masterBloodOrbStack = new ItemStack(ModItems.masterBloodOrb);
ItemStack transcendentBloodOrbStack = new ItemStack(ModItems.transcendentBloodOrb);
// ModBlocks.blockLifeEssence.setUnlocalizedName("lifeEssenceBlock");
FluidContainerRegistry.registerFluidContainer(lifeEssenceFluid, new ItemStack(ModItems.bucketLife), FluidContainerRegistry.EMPTY_BUCKET);
@ -1071,6 +1075,11 @@ public class AlchemicalWizardry
GameRegistry.addRecipe(new ItemStack(ModItems.outputRoutingFocus, 1, 3), "sgs", "geg", "sgs", 'e', enderShardStack, 's', stickStack, 'g', obsidianStack);
GameRegistry.addRecipe(new ItemStack(ModItems.outputRoutingFocus, 1, 4), "sgs", "geg", "sgs", 'e', enderShardStack, 's', stickStack, 'g', stringStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockStabilityGlyph), "1s1", "grg", "bob", 'o', transcendentBloodOrbStack, 'r', bloodRuneStack, '1', crepitousStack, 'g', etherealSlateStack, 'b', praesidiumStack, 's', magicalesStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockEnchantmentGlyph, 1, 0), "1s1", "grg", "bob", 'o', transcendentBloodOrbStack, 'r', bloodRuneStack, 'g', etherealSlateStack, 'b', magicalesStack, '1', offensaStack, 's', lifeShardStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockEnchantmentGlyph, 1, 1), "1s1", "grg", "bob", 'o', transcendentBloodOrbStack, 'r', bloodRuneStack, 'g', etherealSlateStack, 'b', magicalesStack, '1', virtusStack, 's', soulShardStack);
GameRegistry.addRecipe(dawnRitualDivinerStack, " d ", "srs", " d ", 'd', new ItemStack(ModItems.dawnScribeTool), 's', etherealSlateStack, 'r', duskRitualDivinerStack);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.flint, 2, 0), 1, new ItemStack[]{new ItemStack(Blocks.gravel), new ItemStack(Items.flint)}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.grass), 2, new ItemStack[]{new ItemStack(Blocks.dirt), new ItemStack(Items.dye, 1, 15), new ItemStack(Items.wheat_seeds), new ItemStack(Items.wheat_seeds)}, 1);
@ -1086,6 +1095,12 @@ public class AlchemicalWizardry
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.soul_sand, 3, 0), 3, new ItemStack[]{new ItemStack(Blocks.sand), new ItemStack(Blocks.sand), new ItemStack(Blocks.sand), waterBucketStack, weakBloodShardStack}, 3);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.mycelium, 1, 0), 5, new ItemStack[]{new ItemStack(Blocks.grass), new ItemStack(Blocks.brown_mushroom), new ItemStack(Blocks.red_mushroom)}, 2);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.ice), 2, new ItemStack[]{waterBucketStack, new ItemStack(Items.snowball)}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.potionitem, 1, 0), 1, new ItemStack[]{new ItemStack(Items.glass_bottle), new ItemStack(Blocks.cactus)}, 1);
AlchemyRecipeRegistry.registerRecipe(waterBucketStack, 1, new ItemStack[]{emptyBucketStack, new ItemStack(Blocks.cactus)}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.glass_bottle, 3), 1, new ItemStack[]{glassStack, glassStack, glassStack}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.ghast_tear, 2), 100, new ItemStack[]{ghastTearStack, concentratedCatalystStack, weakBloodShardStack, new ItemStack(Blocks.soul_sand), new ItemStack(Blocks.soul_sand)}, 5);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.coal, 5), 1, new ItemStack[]{new ItemStack(Items.coal, 1, 1), new ItemStack(Items.coal, 1, 1), new ItemStack(Items.coal, 1, 1), new ItemStack(Items.coal, 1, 1), new ItemStack(Items.coal, 1, 1)}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.clay_ball, 4), 5, new ItemStack[]{new ItemStack(Blocks.sand), waterBucketStack}, 2);
}
@EventHandler
@ -1115,7 +1130,7 @@ public class AlchemicalWizardry
Item itemThaumBoots = GameRegistry.findItem("Thaumcraft", "ItemBootsThaumium");
AspectList aspectList = new AspectList();
aspectList.add(Aspect.ARMOR, 5).add(Aspect.MAGIC, 5);
// aspectList.add(Aspect.ARMOR, 5).add(Aspect.MAGIC, 5);
ThaumcraftApi.registerObjectTag(new ItemStack(ModItems.sanguineHelmet), aspectList);
ThaumcraftApi.registerObjectTag(new ItemStack(ModItems.sanguineRobe), aspectList);
@ -1336,6 +1351,7 @@ public class AlchemicalWizardry
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.alchemyFlask), new ItemStack(Items.glass_bottle), 2, 2000, 5, 5, false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.reinforcedSlate), new ItemStack(ModItems.blankSlate), 2, 2000, 5, 5, false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.bucketLife), new ItemStack(Items.bucket), 1, 1000, 5, 0, false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.dawnScribeTool), new ItemStack(Blocks.glowstone), 6, 20000, 50, 35, false);
}
public static void initRituals()
@ -1371,9 +1387,11 @@ public class AlchemicalWizardry
Rituals.registerRitual("AW029VeilOfEvil", 1, 150000, new RitualEffectVeilOfEvil(), "Veil of Evil", new AlchemyCircleRenderer(new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 1.5, false));
Rituals.registerRitual("AW030FullStomach", 1, 100000, new RitualEffectFullStomach(), "Requiem of the Satiated Stomach", new AlchemyCircleRenderer(new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 1.5, false));
Rituals.registerRitual("AW031Convocation",isDemonRitualCreativeOnly ? 10 : 2, 15000000, new RitualEffectDemonPortal(), "Convocation of the Damned", new AlchemyCircleRenderer(new ResourceLocation("alchemicalwizardry:textures/models/TransCircleDemon.png"), 220, 22, 22, 255, 0, 0.501, 0.501, 0, 5, false));
Rituals.registerRitual("AW032", 1, 100, new RitualEffectOmegaTest(), "Symmetry of the Omega");
Rituals.registerRitual("AW033", 2, 100, new RitualEffectOmegaStalling(), "Omega Stalling");
// Rituals.registerRitual("AW034", 2, 100, new RitualEffectAlphaPact(), "Alpha Pact");
Rituals.registerRitual("AW032Symmetry", 2, 15000000, new RitualEffectOmegaTest(), "Symmetry of the Omega");
Rituals.registerRitual("AW033Stalling", 2, 15000000, new RitualEffectOmegaStalling(), "Duet of the Fused Souls");
Rituals.registerRitual("AW034Crafting", 1, 15000, new RitualEffectCrafting(), "Rhythm of the Beating Anvil");
Rituals.registerRitual("AW035", 1, 10000, new RitualEffectItemRouting(), "Orchestra of the Phantom Hands");
//Rituals.registerRitual(1,100,new RitualEffectApiaryOverclock(),"Apiary Overclock"));
}

View file

@ -22,6 +22,7 @@ import WayofTime.alchemicalWizardry.common.block.BlockSpellEffect;
import WayofTime.alchemicalWizardry.common.block.BlockSpellEnhancement;
import WayofTime.alchemicalWizardry.common.block.BlockSpellModifier;
import WayofTime.alchemicalWizardry.common.block.BlockSpellParadigm;
import WayofTime.alchemicalWizardry.common.block.BlockStabilityGlyph;
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
import WayofTime.alchemicalWizardry.common.block.BlockWritingTable;
import WayofTime.alchemicalWizardry.common.block.BloodRune;
@ -41,10 +42,12 @@ import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.BlockDemonChe
import WayofTime.alchemicalWizardry.common.items.ItemBlockCrystalBelljar;
import WayofTime.alchemicalWizardry.common.items.ItemBloodRuneBlock;
import WayofTime.alchemicalWizardry.common.items.ItemCrystalBlock;
import WayofTime.alchemicalWizardry.common.items.ItemEnchantmentGlyphBlock;
import WayofTime.alchemicalWizardry.common.items.ItemSpellEffectBlock;
import WayofTime.alchemicalWizardry.common.items.ItemSpellEnhancementBlock;
import WayofTime.alchemicalWizardry.common.items.ItemSpellModifierBlock;
import WayofTime.alchemicalWizardry.common.items.ItemSpellParadigmBlock;
import WayofTime.alchemicalWizardry.common.items.ItemStabilityGlyphBlock;
import cpw.mods.fml.common.registry.GameRegistry;
/**
@ -94,6 +97,7 @@ public class ModBlocks
public static Block blockCrystal;
public static Block blockMimic;
public static Block blockEnchantmentGlyph;
public static Block blockStabilityGlyph;
public static void init()
@ -136,6 +140,7 @@ public class ModBlocks
blockLifeEssence = new LifeEssenceBlock();
blockEnchantmentGlyph = new BlockEnchantmentGlyph();
blockStabilityGlyph = new BlockStabilityGlyph();
}
public static void registerBlocksInPre()
@ -179,7 +184,8 @@ public class ModBlocks
GameRegistry.registerBlock(ModBlocks.blockDemonChest, "blockDemonChest");
GameRegistry.registerBlock(ModBlocks.blockCrystal, ItemCrystalBlock.class, "blockCrystal");
GameRegistry.registerBlock(ModBlocks.blockMimic, "blockMimic");
GameRegistry.registerBlock(ModBlocks.blockEnchantmentGlyph, "blockEnchantmentGlyph");
GameRegistry.registerBlock(ModBlocks.blockEnchantmentGlyph, ItemEnchantmentGlyphBlock.class, "blockEnchantmentGlyph");
GameRegistry.registerBlock(ModBlocks.blockStabilityGlyph, ItemStabilityGlyphBlock.class, "blockStabilityGlyph");
}
public static void registerBlocksInInit()

View file

@ -417,7 +417,7 @@ public class SoulNetworkHandler
public static String getUsername(EntityPlayer player)
{
return player.getDisplayName();
return player.getCommandSenderName();
}
public static EntityPlayer getPlayerForUsername(String str)

View file

@ -164,6 +164,23 @@ public class APISpellHelper
data.setFloat("BM:MaxAddedHP", maxHP);
}
public static int getPlayerReagentRegenCooldownTag(EntityPlayer player)
{
NBTTagCompound data = APISpellHelper.getPersistentDataTag(player);
if(data.hasKey("BM:ReagentRegenCooldown"))
{
return data.getInteger("BM:ReagentRegenCooldown");
}
return 0;
}
public static void setPlayerReagentRegenCooldownTag(EntityPlayer player, int amount)
{
NBTTagCompound data = APISpellHelper.getPersistentDataTag(player);
data.setInteger("BM:ReagentRegenCooldown", amount);
}
public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range)
{
float f = 1.0F;

View file

@ -7,8 +7,6 @@ import net.minecraftforge.client.event.sound.SoundEvent;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.client.renderer.RenderHelper;
import WayofTime.alchemicalWizardry.common.ClientToServerPacketHandler;
import WayofTime.alchemicalWizardry.common.MessageKeyPressed;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@ -23,12 +21,12 @@ public class ClientEventHandler
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event)
{
if(KeyBindings.omegaTest.isPressed())
{
System.out.println("ping");
// NewPacketHandler.INSTANCE.sendToServer(NewPacketHandler.getKeyboardPressPacket((byte)2));
ClientToServerPacketHandler.INSTANCE.sendToServer(new MessageKeyPressed(MessageKeyPressed.Key.OMEGA_ACTIVE));
}
// if(KeyBindings.omegaTest.isPressed())
// {
// System.out.println("ping");
//// NewPacketHandler.INSTANCE.sendToServer(NewPacketHandler.getKeyboardPressPacket((byte)2));
// ClientToServerPacketHandler.INSTANCE.sendToServer(new MessageKeyPressed(MessageKeyPressed.Key.OMEGA_ACTIVE));
// }
}
@SubscribeEvent

View file

@ -1,5 +1,6 @@
package WayofTime.alchemicalWizardry.client;
import WayofTime.alchemicalWizardry.client.renderer.RitualDivinerRender;
import net.minecraft.item.ItemBlock;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
@ -110,7 +111,7 @@ public class ClientProxy extends CommonProxy
public void registerPostSideObjects()
{
BUEntries entries = new BUEntries();
entries.postInit();
// entries.postInit();
}
@Override
@ -146,6 +147,7 @@ public class ClientProxy extends CommonProxy
RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntGuardianEarth.class, new RenderMinorDemonGruntGuardian(new ModelMinorDemonGruntGuardian(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntGuardianWind.class, new RenderMinorDemonGruntGuardian(new ModelMinorDemonGruntGuardian(), 0.5F));
MinecraftForge.EVENT_BUS.register(new RitualDivinerRender());
ClientRegistry.bindTileEntitySpecialRenderer(TEAltar.class, new TEAltarRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TEPedestal.class, new RenderPedestal());

View file

@ -2,18 +2,14 @@ package WayofTime.alchemicalWizardry.client;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.client.registry.ClientRegistry;
public class KeyBindings
{
public static KeyBinding omegaTest;
public static void init()
{
omegaTest = new KeyBinding("key.ping", Keyboard.KEY_O, "key.categories.alchemicalwizardry");
ClientRegistry.registerKeyBinding(omegaTest);
// omegaTest = new KeyBinding("key.ping", Keyboard.KEY_O, "key.categories.alchemicalwizardry");
//
// ClientRegistry.registerKeyBinding(omegaTest);
}
}

View file

@ -20,8 +20,7 @@ public class NEIBindingRitualHandler extends TemplateRecipeHandler
{
public class CachedBindingRecipe extends CachedRecipe
{
PositionedStack input;
PositionedStack output;
PositionedStack input, output;
public CachedBindingRecipe(BindingRecipe recipe)
{
@ -45,7 +44,7 @@ public class NEIBindingRitualHandler extends TemplateRecipeHandler
@Override
public void loadCraftingRecipes(String outputId, Object... results)
{
if (outputId.equals("alchemicalwizardry.binding") && getClass() == NEIBindingRitualHandler.class)
if (outputId.equals("alchemicalwizardry.bindingritual") && getClass() == NEIBindingRitualHandler.class)
{
for (BindingRecipe recipe : BindingRegistry.bindingRecipes)
{
@ -94,13 +93,13 @@ public class NEIBindingRitualHandler extends TemplateRecipeHandler
@Override
public String getOverlayIdentifier()
{
return "bindingritual";
return "alchemicalwizardry.bindingritual";
}
@Override
public void loadTransferRects()
{
transferRects.add(new RecipeTransferRect(new Rectangle(90, 32, 22, 16), "alchemicalwizardry.bindingritual"));
transferRects.add(new RecipeTransferRect(new Rectangle(68, 20, 22, 16), "alchemicalwizardry.bindingritual"));
}
@Override

View file

@ -0,0 +1,17 @@
package WayofTime.alchemicalWizardry.client.renderer;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
public class Helper
{
public static RitualEffect getEffectFromString(String name)
{
Rituals ritual = Rituals.ritualMap.get(name);
if (ritual == null)
return null;
return ritual.effect;
}
}

View file

@ -0,0 +1,70 @@
package WayofTime.alchemicalWizardry.client.renderer
import net.minecraft.block.Block
import net.minecraft.client.renderer.Tessellator
import net.minecraft.world.World
object Render {
def drawFakeBlock(v:Vector3, b:Block, meta:Int, min:(Double, Double, Double), w: World): Unit = {
val (minX, minY, minZ) = min
val (maxX, maxY, maxZ) = (minX + 1, minY + 1, minZ + 1)
val tessellator = Tessellator.instance
tessellator.startDrawingQuads()
// tessellator.setBrightness(b.getMixedBrightnessForBlock(w, v.x, v.y, v.z))
tessellator.setColorRGBA(255, 255, 255, 26)
var tex: (Float, Float, Float, Float) = null
def textureMinU = tex._1
def textureMaxU = tex._2
def textureMinV = tex._3
def textureMaxV = tex._4
tex = g(b, meta, 0)
tessellator.addVertexWithUV(minX, minY, minZ, textureMinU, textureMinV)
tessellator.addVertexWithUV(maxX, minY, minZ, textureMaxU, textureMinV)
tessellator.addVertexWithUV(maxX, minY, maxZ, textureMaxU, textureMaxV)
tessellator.addVertexWithUV(minX, minY, maxZ, textureMinU, textureMaxV)
tex = g(b, meta, 1)
tessellator.addVertexWithUV(minX, maxY, maxZ, textureMinU, textureMaxV)
tessellator.addVertexWithUV(maxX, maxY, maxZ, textureMaxU, textureMaxV)
tessellator.addVertexWithUV(maxX, maxY, minZ, textureMaxU, textureMinV)
tessellator.addVertexWithUV(minX, maxY, minZ, textureMinU, textureMinV)
tex = g(b, meta, 2)
tessellator.addVertexWithUV(maxX, minY, minZ, textureMinU, textureMaxV)
tessellator.addVertexWithUV(minX, minY, minZ, textureMaxU, textureMaxV)
tessellator.addVertexWithUV(minX, maxY, minZ, textureMaxU, textureMinV)
tessellator.addVertexWithUV(maxX, maxY, minZ, textureMinU, textureMinV)
tex = g(b, meta, 3)
tessellator.addVertexWithUV(minX, minY, maxZ, textureMinU, textureMaxV)
tessellator.addVertexWithUV(maxX, minY, maxZ, textureMaxU, textureMaxV)
tessellator.addVertexWithUV(maxX, maxY, maxZ, textureMaxU, textureMinV)
tessellator.addVertexWithUV(minX, maxY, maxZ, textureMinU, textureMinV)
tex = g(b, meta, 4)
tessellator.addVertexWithUV(minX, minY, minZ, textureMinU, textureMaxV)
tessellator.addVertexWithUV(minX, minY, maxZ, textureMaxU, textureMaxV)
tessellator.addVertexWithUV(minX, maxY, maxZ, textureMaxU, textureMinV)
tessellator.addVertexWithUV(minX, maxY, minZ, textureMinU, textureMinV)
tex = g(b, meta, 5)
tessellator.addVertexWithUV(maxX, minY, maxZ, textureMinU, textureMaxV)
tessellator.addVertexWithUV(maxX, minY, minZ, textureMaxU, textureMaxV)
tessellator.addVertexWithUV(maxX, maxY, minZ, textureMaxU, textureMinV)
tessellator.addVertexWithUV(maxX, maxY, maxZ, textureMinU, textureMinV)
tessellator.draw
}
def g(b: Block, m: Int, s: Int): (Float, Float, Float, Float) = {
val i = b.getIcon(s, m)
(i.getMinU, i.getMaxU, i.getMinV, i.getMaxV)
}
}

View file

@ -0,0 +1,54 @@
package WayofTime.alchemicalWizardry.client.renderer
import WayofTime.alchemicalWizardry.ModBlocks
import WayofTime.alchemicalWizardry.api.rituals.{RitualComponent, IMasterRitualStone}
import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner
import cpw.mods.fml.common.eventhandler.SubscribeEvent
import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityClientPlayerMP
import net.minecraft.tileentity.TileEntity
import net.minecraft.util.MovingObjectPosition
import net.minecraft.world.World
import net.minecraftforge.client.event.RenderWorldLastEvent
import scala.collection.JavaConversions
class RitualDivinerRender {
@SubscribeEvent
def render(e: RenderWorldLastEvent)
{
val mc: Minecraft = Minecraft.getMinecraft
val p: EntityClientPlayerMP = mc.thePlayer
val w: World = p.worldObj
if (mc.objectMouseOver == null || mc.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK)
return
val te: TileEntity = w.getTileEntity(mc.objectMouseOver.blockX, mc.objectMouseOver.blockY, mc.objectMouseOver.blockZ)
if (!te.isInstanceOf[IMasterRitualStone])
return
val v3 = new Vector3(mc.objectMouseOver.blockX, mc.objectMouseOver.blockY, mc.objectMouseOver.blockZ)
val (px, py, pz) = (p.lastTickPosX + (p.posX - p.lastTickPosX) * e.partialTicks, p.lastTickPosY + (p.posY - p.lastTickPosY) * e.partialTicks, p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * e.partialTicks)
if (p.inventory.getCurrentItem != null && p.inventory.getCurrentItem.getItem.isInstanceOf[ItemRitualDiviner]) {
val d = p.inventory.getCurrentItem.getItem.asInstanceOf[ItemRitualDiviner]
val dir = d.getDirection(p.inventory.getCurrentItem)
val r = Helper.getEffectFromString(d.getCurrentRitual(p.inventory.getCurrentItem))
if (r == null)
return
for (x <- JavaConversions.asScalaBuffer[RitualComponent](r.getRitualComponentList))
{
val v: Vector3 = v3 + (x.getX(dir), x.getY, x.getZ(dir))
val min = (v.x - px, v.y - py, v.z - pz)
if (!w.getBlock(v.x, v.y, v.z).isOpaqueCube)
Render.drawFakeBlock(v, ModBlocks.ritualStone, x.getStoneType, min, w)
}
}
}
}

View file

@ -0,0 +1,24 @@
package WayofTime.alchemicalWizardry.client.renderer
class Vector3 (val x: Int, val y: Int, val z: Int) {
def +(w: (Int,Int,Int)): Vector3 = new Vector3(x + w._1, y+ w._2, z + w._3)
override def toString = s"V3(${x}},${y}},${z}})"
def canEqual(other: Any): Boolean = other.isInstanceOf[Vector3]
override def equals(other: Any): Boolean = other match {
case that: Vector3 =>
(that canEqual this) &&
x == that.x &&
y == that.y &&
z == that.z
case _ => false
}
override def hashCode(): Int = {
val state = Seq(x, y, z)
state.map(_.hashCode()).foldLeft(0)((a, b) => 31 * a + b)
}
}

View file

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
@ -67,6 +68,8 @@ public class AlchemicalWizardryEventHooks
public static Map<Integer, List<CoordAndRange>> respawnMap = new HashMap();
public static Map<Integer, List<CoordAndRange>> forceSpawnMap = new HashMap();
public static Random rand = new Random();
@SubscribeEvent
public void onEntityInteractEvent(EntityInteractEvent event)
@ -106,12 +109,20 @@ public class AlchemicalWizardryEventHooks
{
EntityPlayer player = (EntityPlayer)event.entityLiving;
if(APISpellHelper.getCurrentAdditionalMaxHP(player) > 0)
{
APISpellHelper.setPlayerReagentRegenCooldownTag(player, 20 * 20);
}
float prevHp = APISpellHelper.getCurrentAdditionalHP((EntityPlayer)event.entityLiving);
if(prevHp > 0)
{
double originalDamage = event.ammount;
double initialReagentHp = prevHp;
float recalculatedAmount = ArmorProperties.ApplyArmor(player, player.inventory.armorInventory, event.source, event.ammount);
if (recalculatedAmount <= 0) return;
recalculatedAmount = SpellHelper.applyPotionDamageCalculations(player, event.source, recalculatedAmount);
recalculatedAmount = SpellHelper.applyPotionDamageCalculations(player, event.source, recalculatedAmount); //Recalculated damage
float ratio = recalculatedAmount / event.ammount;
@ -121,37 +132,43 @@ public class AlchemicalWizardryEventHooks
if(prevHp > recalculatedAmount)
{
float hp = (prevHp - recalculatedAmount);
if(hp > 0)
{
event.ammount = 0;
}else
{
event.ammount -= hp / ratio;
Reagent reagent = APISpellHelper.getPlayerReagentType(player);
OmegaParadigm paradigm = OmegaRegistry.getParadigmForReagent(reagent);
if(paradigm != null)
{
ItemStack chestStack = player.inventory.armorInventory[2];
float hp = (prevHp - recalculatedAmount); //New HP - this is obviously > 0...
if(chestStack != null && chestStack.getItem() instanceof OmegaArmour)
// event.setCanceled(true);
event.ammount = 0;
Reagent reagent = APISpellHelper.getPlayerReagentType(player);
OmegaParadigm paradigm = OmegaRegistry.getParadigmForReagent(reagent);
if(paradigm != null)
{
ItemStack chestStack = player.inventory.armorInventory[2];
if(chestStack != null && chestStack.getItem() instanceof OmegaArmour)
{
if(((OmegaArmour)chestStack.getItem()).paradigm == paradigm)
{
if(((OmegaArmour)chestStack.getItem()).paradigm == paradigm)
{
paradigm.onHPBarDepleted(player, chestStack);
}
paradigm.onHPBarDepleted(player, chestStack);
}
}
}
APISpellHelper.setCurrentAdditionalHP((EntityPlayer)event.entityLiving, Math.max(0, hp));
System.out.println("HP: " + hp);
APISpellHelper.setCurrentAdditionalHP(player, Math.max(0, hp));
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(Math.max(0, hp), APISpellHelper.getCurrentAdditionalMaxHP(player)), (EntityPlayerMP)player);
APISpellHelper.setCurrentAdditionalHP(player, hp);
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(hp, APISpellHelper.getCurrentAdditionalMaxHP(player)), (EntityPlayerMP)player);
}
// if(event.ammount <= 0.3)
// {
// event.ammount++;
// }
}else
{
APISpellHelper.setCurrentAdditionalHP(player, 0);
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(0, APISpellHelper.getCurrentAdditionalMaxHP(player)), (EntityPlayerMP)player);
event.ammount -= prevHp / ratio;
if(event.ammount < 0)
{
event.ammount = 0;
}
}
}
}
}
@ -169,44 +186,85 @@ public class AlchemicalWizardryEventHooks
if(reagentAmount > 0 && OmegaRegistry.hasParadigm(reagent))
{
int cooldown = APISpellHelper.getPlayerReagentRegenCooldownTag(player);
boolean canHealHPBar = true;
if(cooldown > 0)
{
float extra = 0;
if(player.isPotionActive(AlchemicalWizardry.customPotionSoulHarden))
{
extra += 0.25f * (1 + player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulHarden).getAmplifier());
}
if(player.isPotionActive(AlchemicalWizardry.customPotionSoulFray))
{
extra -= 0.25f * (1 + player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulFray).getAmplifier());
}
int deduction = - 1 - (extra >= 0 ? (rand.nextFloat() < extra ? 1 : 0) : (rand.nextFloat() < -extra/2 ? -1 : 0));
APISpellHelper.setPlayerReagentRegenCooldownTag(player, Math.max(cooldown + deduction, 0));
canHealHPBar = false;
}
OmegaParadigm parad = OmegaRegistry.getParadigmForReagent(reagent);
ReagentRegenConfiguration config = parad.getRegenConfig(player);
if(parad.isPlayerWearingFullSet(player))
{
if(event.entityLiving.worldObj.getWorldTime() % config.tickRate == 0)
if(canHealHPBar)
{
boolean hasHealthChanged = false;
int maxHealth = parad.getMaxAdditionalHealth();
int tickRate = config.tickRate;
float health = APISpellHelper.getCurrentAdditionalHP(player);
if(health > maxHealth)
if(player.isPotionActive(Potion.regeneration))
{
health = maxHealth;
hasHealthChanged = true;
}else if(health < maxHealth)
{
float addedAmount = Math.min(Math.min((reagentAmount / config.costPerPoint), config.healPerTick), maxHealth - health);
float drain = addedAmount * config.costPerPoint;
reagentAmount -= drain;
hasReagentChanged = true;
health += addedAmount;
hasHealthChanged = true;
int i = player.getActivePotionEffect(Potion.regeneration).getAmplifier();
double factor = Math.pow(1.5, i+1);
tickRate = Math.max((int)(tickRate / factor), 1);
}
if(player instanceof EntityPlayerMP)
if(event.entityLiving.worldObj.getWorldTime() % tickRate == 0)
{
if(hasHealthChanged)
boolean hasHealthChanged = false;
int maxHealth = parad.getMaxAdditionalHealth();
float health = APISpellHelper.getCurrentAdditionalHP(player);
if(health > maxHealth)
{
APISpellHelper.setCurrentAdditionalHP(player, health);
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(health, maxHealth), (EntityPlayerMP)player);
health = maxHealth;
hasHealthChanged = true;
}else if(health < maxHealth)
{
float addedAmount = Math.min(Math.min((reagentAmount / config.costPerPoint), config.healPerTick), maxHealth - health);
float drain = addedAmount * config.costPerPoint;
reagentAmount -= drain;
hasReagentChanged = true;
health += addedAmount;
hasHealthChanged = true;
}
if(player instanceof EntityPlayerMP)
{
if(hasHealthChanged)
{
APISpellHelper.setCurrentAdditionalHP(player, health);
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(health, maxHealth), (EntityPlayerMP)player);
}
}
}
}
}else
{
reagentAmount = 0;
APISpellHelper.setPlayerMaxReagentAmount(player, 0);
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getReagentBarPacket(null, 0, 0), (EntityPlayerMP)player);
APISpellHelper.setCurrentAdditionalHP(player, 0);
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(0, 0), (EntityPlayerMP)player);
}
//Consumes the amount
float costPerTick = parad.getCostPerTickOfUse(player);
@ -229,14 +287,22 @@ public class AlchemicalWizardryEventHooks
if(reagentAmount <= 0)
{
boolean hasRevertedArmour = false;
ItemStack[] armourInventory = player.inventory.armorInventory;
for(ItemStack stack : armourInventory)
{
if(stack != null && stack.getItem() instanceof OmegaArmour)
{
((OmegaArmour)stack.getItem()).revertArmour(player, stack);
hasRevertedArmour = true;
}
}
if(hasRevertedArmour)
{
APISpellHelper.setCurrentAdditionalHP(player, 0);
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(0, 0), (EntityPlayerMP)player);
}
}
if(player instanceof EntityPlayerMP)

View file

@ -0,0 +1,87 @@
package WayofTime.alchemicalWizardry.common;
import java.util.Objects;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
/**
* Represents an item together with metadata and NBT tag.
*
* @author ljfa-ag
*/
public class ItemType
{
public final Item item;
public final int meta;
public final NBTTagCompound nbtTag;
public ItemType(Item item, int meta, NBTTagCompound nbtTag)
{
this.item = Objects.requireNonNull(item);
this.meta = meta;
this.nbtTag = nbtTag;
}
public ItemType(Item item, int meta)
{
this(item, meta, null);
}
public ItemType(Item item)
{
this(item, 0, null);
}
public ItemType(Block block, int meta, NBTTagCompound nbtTag)
{
this(Item.getItemFromBlock(block), meta, nbtTag);
}
public ItemType(Block block, int meta)
{
this(block, meta, null);
}
public ItemType(Block block)
{
this(block, 0, null);
}
public ItemStack createStack(int count)
{
ItemStack result = new ItemStack(item, count, meta);
result.stackTagCompound = nbtTag;
return result;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
ItemType other = (ItemType) obj;
return item == other.item && meta == other.meta && Objects.equals(nbtTag, other.nbtTag);
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + item.hashCode();
result = prime * result + meta;
result = prime * result + ((nbtTag == null) ? 0 : nbtTag.hashCode());
return result;
}
public static ItemType fromStack(ItemStack stack)
{
return new ItemType(stack.getItem(), stack.getItemDamage(), stack.stackTagCompound);
}
}

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.achievements;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
@ -12,6 +13,11 @@ public class AchievementTrigger
{
ItemStack stack = event.pickedUp.getEntityItem();
for (Item item : AchievementsRegistry.list)
{
}
if (stack != null && stack.getItem() instanceof IPickupAchievement)
{
Achievement achievement = ((IPickupAchievement) stack.getItem()).getAchievementOnPickup(stack, event.player, event.pickedUp);

View file

@ -0,0 +1,17 @@
package WayofTime.alchemicalWizardry.common.achievements;
import WayofTime.alchemicalWizardry.ModItems;
import net.minecraft.item.Item;
import java.util.ArrayList;
import java.util.List;
public class AchievementsRegistry
{
public static List<Item> list = new ArrayList();
public void addItemsToList()
{
list.add(ModItems.sacrificialDagger);
}
}

View file

@ -7,5 +7,5 @@ import net.minecraft.stats.Achievement;
public interface ICraftAchievement
{
public Achievement getAchievementOnCraft(ItemStack stack, EntityPlayer player, IInventory matrix);
Achievement getAchievementOnCraft(ItemStack stack, EntityPlayer player, IInventory matrix);
}

View file

@ -7,5 +7,5 @@ import net.minecraft.stats.Achievement;
public interface IPickupAchievement
{
public Achievement getAchievementOnPickup(ItemStack stack, EntityPlayer player, EntityItem item);
Achievement getAchievementOnPickup(ItemStack stack, EntityPlayer player, EntityItem item);
}

View file

@ -1,8 +1,14 @@
package WayofTime.alchemicalWizardry.common.block;
import java.util.List;
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 net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.omega.IEnchantmentGlyph;
@ -11,13 +17,16 @@ import cpw.mods.fml.relauncher.SideOnly;
public class BlockEnchantmentGlyph extends Block implements IEnchantmentGlyph
{
public IIcon enchantability;
public IIcon enchantmentLevel;
public BlockEnchantmentGlyph()
{
super(Material.iron);
setHardness(2.0F);
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("enchantmentGlypg");
this.setBlockName("enchantmentGlyph");
}
@Override
@ -25,17 +34,75 @@ public class BlockEnchantmentGlyph extends Block implements IEnchantmentGlyph
public void registerBlockIcons(IIconRegister iconRegister)
{
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:LargeBloodStoneBrick");
this.enchantability = iconRegister.registerIcon("AlchemicalWizardry:GlyphEnchantability");
this.enchantmentLevel = iconRegister.registerIcon("AlchemicalWizardry:GlyphEnchantmentLevel");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
switch (meta)
{
case 0:
return enchantability;
case 1:
return enchantmentLevel;
default:
return this.blockIcon;
}
}
@Override
public int getSubtractedStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount)
public int getAdditionalStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount)
{
return faceCount * 20;
switch(meta)
{
case 0:
return -faceCount * 10;
case 1:
return -faceCount * 20;
default:
return -faceCount * 20;
}
}
@Override
public int getEnchantability(World world, int x, int y, int z, int meta)
{
return 1;
switch(meta)
{
case 0:
return 1;
default:
return 0;
}
}
@Override
public int getEnchantmentLevel(World world, int x, int y, int z, int meta)
{
switch(meta)
{
case 1:
return 1;
default:
return 0;
}
}
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
for(int i=0; i<2; i++)
{
par3List.add(new ItemStack(par1, 1, i));
}
}
@Override
public int damageDropped(int metadata)
{
return metadata;
}
}

View file

@ -83,123 +83,9 @@ public class BlockOrientable extends BlockContainer
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;
}
}

View file

@ -9,6 +9,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
public class BlockReagentConduit extends BlockContainer
@ -64,4 +65,10 @@ public class BlockReagentConduit extends BlockContainer
{
return -1;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
{
return null;
}
}

View file

@ -0,0 +1,73 @@
package WayofTime.alchemicalWizardry.common.block;
import java.util.List;
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 net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.omega.IStabilityGlyph;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockStabilityGlyph extends Block implements IStabilityGlyph
{
public IIcon stability1;
public BlockStabilityGlyph()
{
super(Material.iron);
setHardness(2.0F);
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("stabilityGlyph");
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister)
{
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:LargeBloodStoneBrick");
this.stability1 = iconRegister.registerIcon("AlchemicalWizardry:GlyphStability1");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
switch (meta)
{
case 0:
return stability1;
default:
return this.blockIcon;
}
}
@Override
public int getAdditionalStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount)
{
switch(meta)
{
case 0:
return faceCount * 2;
default:
return faceCount;
}
}
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
for(int i=0; i<1; i++)
{
par3List.add(new ItemStack(par1, 1, i));
}
}
}

View file

@ -303,7 +303,7 @@ public class UpgradedAltars
fifthTierAltar.addAll(fourthTierAltar);
fifthTierAltar.add(new AltarComponent(-8, -3, 8, Blocks.beacon, 0, false, false));
fifthTierAltar.add(new AltarComponent(-8, -3, -8, Blocks.beacon, 0, false, false));
fifthTierAltar.add(new AltarComponent(8, -3, 8, Blocks.beacon, 0, false, false));
fifthTierAltar.add(new AltarComponent(8, -3, -8, Blocks.beacon, 0, false, false));
fifthTierAltar.add(new AltarComponent(8, -3, 8, Blocks.beacon, 0, false, false));
for (int i = -6; i <= 6; i++)

View file

@ -1,16 +1,15 @@
package WayofTime.alchemicalWizardry.common.commands;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import java.util.List;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
public class CommandBind extends CommandBase
{
@ -39,7 +38,7 @@ public class CommandBind extends CommandBase
if (targetPlayer == null)
{
throw new CommandException("commands.bind.failed.noPlayer", new Object[0]);
throw new CommandException("commands.bind.failed.noPlayer");
}
if (item != null && item.getItem() instanceof IBindable)
@ -47,16 +46,16 @@ public class CommandBind extends CommandBase
if (EnergyItems.getOwnerName(item).isEmpty())
{
EnergyItems.checkAndSetItemOwner(item, targetPlayer);
func_152373_a(iCommandSender, this, "commands.bind.success", new Object[0]);
func_152373_a(iCommandSender, this, "commands.bind.success");
}
else
{
throw new CommandException("commands.bind.failed.alreadyBound", new Object[0]);
throw new CommandException("commands.bind.failed.alreadyBound");
}
}
else if (!(item.getItem() instanceof IBindable))
{
throw new CommandException("commands.bind.failed.notBindable", new Object[0]);
throw new CommandException("commands.bind.failed.notBindable");
}
}

View file

@ -1,11 +1,13 @@
package WayofTime.alchemicalWizardry.common.commands;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import java.util.List;
@ -40,7 +42,7 @@ public class CommandSN extends CommandBase
int amount = parseIntBounded(icommandsender, astring[2], Integer.MIN_VALUE, Integer.MAX_VALUE);
SoulNetworkHandler.addCurrentEssenceToMaximum(owner, amount, Integer.MAX_VALUE);
func_152373_a(icommandsender, this, "commands.soulnetwork.add.success", new Object[] {amount, owner});
func_152373_a(icommandsender, this, "commands.soulnetwork.add.success", amount, owner);
}
else if ("subtract".equalsIgnoreCase(astring[1]))
{
@ -50,42 +52,42 @@ public class CommandSN extends CommandBase
{
int lp = SoulNetworkHandler.getCurrentEssence(owner);
SoulNetworkHandler.syphonFromNetwork(owner, lp);
func_152373_a(icommandsender, this, "commands.soulnetwork.subtract.success", new Object[] {SoulNetworkHandler.getCurrentEssence(owner), owner});
func_152373_a(icommandsender, this, "commands.soulnetwork.subtract.success", SoulNetworkHandler.getCurrentEssence(owner), owner);
}
else
{
SoulNetworkHandler.syphonFromNetwork(owner, amount);
func_152373_a(icommandsender, this, "commands.soulnetwork.subtract.success", new Object[] {amount, owner});
func_152373_a(icommandsender, this, "commands.soulnetwork.subtract.success", amount, owner);
}
}
else if ("fill".equalsIgnoreCase(astring[1]))
{
int amount = Integer.MAX_VALUE - SoulNetworkHandler.getCurrentEssence(owner);
SoulNetworkHandler.addCurrentEssenceToMaximum(owner, amount, Integer.MAX_VALUE);
func_152373_a(icommandsender, this, "commands.soulnetwork.fill.success", new Object[] {owner});
func_152373_a(icommandsender, this, "commands.soulnetwork.fill.success", owner);
}
else if ("empty".equalsIgnoreCase(astring[1]))
{
SoulNetworkHandler.syphonFromNetwork(owner, SoulNetworkHandler.getCurrentEssence(owner));
func_152373_a(icommandsender, this, "commands.soulnetwork.empty.success", new Object[] {owner});
func_152373_a(icommandsender, this, "commands.soulnetwork.empty.success", owner);
}
else if ("get".equalsIgnoreCase(astring[1]))
{
int amount = SoulNetworkHandler.getCurrentEssence(owner);
func_152373_a(icommandsender, this, "commands.soulnetwork.get.success", new Object[] {amount, owner});
func_152373_a(icommandsender, this, "commands.soulnetwork.get.success", amount, owner);
}
else
{
throw new CommandException("commands.soulnetwork.notACommand", new Object[0]);
throw new CommandException("commands.soulnetwork.notACommand");
}
}
else if (astring.length == 0)
{
throw new CommandException("commands.soulnetwork.noPlayer", new Object[0]);
throw new CommandException("commands.soulnetwork.noPlayer");
}
else if (astring.length == 1)
{
throw new CommandException("commands.soulnetwork.noCommand", new Object[0]);
throw new CommandException("commands.soulnetwork.noCommand");
}
}
@ -97,7 +99,7 @@ public class CommandSN extends CommandBase
}
else if (astring.length == 2)
{
return getListOfStringsMatchingLastWord(astring, new String[] {"add", "subtract", "fill", "empty"});
return getListOfStringsMatchingLastWord(astring, "add", "subtract", "fill", "empty");
}
return null;

View file

@ -36,17 +36,17 @@ public class CommandUnbind extends CommandBase
{
if (!EnergyItems.getOwnerName(item).isEmpty())
{
item.getTagCompound().setString("ownerName", "");
func_152373_a(iCommandSender, this, "commands.unbind.success", new Object[0]);
item.getTagCompound().removeTag("ownerName");
func_152373_a(iCommandSender, this, "commands.unbind.success");
}
else
{
throw new CommandException("commands.unbind.failed.notBindable", new Object[0]);
throw new CommandException("commands.unbind.failed.notBindable");
}
}
else if (!(item.getItem() instanceof IBindable))
{
throw new CommandException("commands.unbind.failed.notBindable", new Object[0]);
throw new CommandException("commands.unbind.failed.notBindable");
}
}
}

View file

@ -1,17 +1,14 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeavesBase;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
@ -21,9 +18,15 @@ import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.ItemType;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.HashMultiset;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BoundAxe extends ItemAxe implements IBindable
{
@ -112,6 +115,11 @@ public class BoundAxe extends ItemAxe implements IBindable
par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
return par1ItemStack;
}
if (par2World.isRemote)
{
return par1ItemStack;
}
if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer))
{
@ -135,6 +143,8 @@ public class BoundAxe extends ItemAxe implements IBindable
boolean silkTouch = EnchantmentHelper.getSilkTouchModifier(par3EntityPlayer);
int fortuneLvl = EnchantmentHelper.getFortuneModifier(par3EntityPlayer);
HashMultiset<ItemType> dropMultiset = HashMultiset.create();
for (int i = -5; i <= 5; i++)
{
for (int j = 0; j <= 10; j++)
@ -152,27 +162,18 @@ public class BoundAxe extends ItemAxe implements IBindable
{
if (silkTouch && block.canSilkHarvest(par2World, par3EntityPlayer, posX + i, posY + j, posZ + k, meta))
{
ItemStack droppedItem = new ItemStack(block, 1, meta);
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityItem(par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ, droppedItem));
}
dropMultiset.add(new ItemType(block, meta));
} else
{
ArrayList<ItemStack> itemDropList = block.getDrops(par2World, posX + i, posY + j, posZ + k, meta, fortuneLvl);
if (itemDropList != null)
{
for (ItemStack item : itemDropList)
{
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityItem(par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ, item));
}
}
for (ItemStack stack : itemDropList)
dropMultiset.add(ItemType.fromStack(stack), stack.stackSize);
}
}
par2World.setBlockToAir(posX + i, posY + j, posZ + k);
}
}
@ -180,7 +181,8 @@ public class BoundAxe extends ItemAxe implements IBindable
}
}
BoundPickaxe.dropMultisetStacks(dropMultiset, par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ);
return par1ItemStack;
}

View file

@ -1,10 +1,8 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.EnchantmentHelper;
@ -20,9 +18,16 @@ import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.ItemType;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.Multiset;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BoundPickaxe extends ItemPickaxe implements IBindable
{
@ -114,6 +119,11 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable
par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
return par1ItemStack;
}
if (par2World.isRemote)
{
return par1ItemStack;
}
if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer))
{
@ -124,11 +134,6 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable
{
return par1ItemStack;
}
if (par2World.isRemote)
{
return par1ItemStack;
}
if(!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000))
{
@ -142,6 +147,8 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable
boolean silkTouch = EnchantmentHelper.getSilkTouchModifier(par3EntityPlayer);
int fortuneLvl = EnchantmentHelper.getFortuneModifier(par3EntityPlayer);
HashMultiset<ItemType> dropMultiset = HashMultiset.create();
for (int i = -5; i <= 5; i++)
{
for (int j = -5; j <= 5; j++)
@ -159,25 +166,15 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable
{
if (silkTouch && block.canSilkHarvest(par2World, par3EntityPlayer, posX + i, posY + j, posZ + k, meta))
{
ItemStack droppedItem = new ItemStack(block, 1, meta);
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityItem(par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ, droppedItem));
}
dropMultiset.add(new ItemType(block, meta));
} else
{
ArrayList<ItemStack> itemDropList = block.getDrops(par2World, posX + i, posY + j, posZ + k, meta, fortuneLvl);
if (itemDropList != null)
{
for (ItemStack item : itemDropList)
{
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityItem(par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ, item));
}
}
for (ItemStack stack : itemDropList)
dropMultiset.add(ItemType.fromStack(stack), stack.stackSize);
}
}
@ -187,9 +184,31 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable
}
}
}
dropMultisetStacks(dropMultiset, par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ);
return par1ItemStack;
}
public static void dropMultisetStacks(Multiset<ItemType> dropMultiset, World world, double x, double y, double z)
{
for (Multiset.Entry<ItemType> entry : dropMultiset.entrySet())
{
int count = entry.getCount();
ItemType type = entry.getElement();
int maxStackSize = type.item.getItemStackLimit(type.createStack(1));
//Drop in groups of maximum size
while (count >= maxStackSize)
{
world.spawnEntityInWorld(new EntityItem(world, x, y, z, type.createStack(maxStackSize)));
count -= maxStackSize;
}
//Drop remainder
if (count > 0)
world.spawnEntityInWorld(new EntityItem(world, x, y, z, type.createStack(count)));
}
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)

View file

@ -1,13 +1,8 @@
package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.Multimap;
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.enchantment.EnchantmentHelper;
@ -15,7 +10,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
@ -25,9 +19,16 @@ import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.ItemType;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.Multimap;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BoundShovel extends ItemSpade implements IBindable
{
@ -118,6 +119,11 @@ public class BoundShovel extends ItemSpade implements IBindable
par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
return par1ItemStack;
}
if (par2World.isRemote)
{
return par1ItemStack;
}
if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer))
{
@ -141,6 +147,8 @@ public class BoundShovel extends ItemSpade implements IBindable
boolean silkTouch = EnchantmentHelper.getSilkTouchModifier(par3EntityPlayer);
int fortuneLvl = EnchantmentHelper.getFortuneModifier(par3EntityPlayer);
HashMultiset<ItemType> dropMultiset = HashMultiset.create();
for (int i = -5; i <= 5; i++)
{
for (int j = 0; j <= 10; j++)
@ -158,25 +166,15 @@ public class BoundShovel extends ItemSpade implements IBindable
{
if (silkTouch && block.canSilkHarvest(par2World, par3EntityPlayer, posX + i, posY + j, posZ + k, meta))
{
ItemStack droppedItem = new ItemStack(block, 1, meta);
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityItem(par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ, droppedItem));
}
dropMultiset.add(new ItemType(block, meta));
} else
{
ArrayList<ItemStack> itemDropList = block.getDrops(par2World, posX + i, posY + j, posZ + k, meta, fortuneLvl);
if (itemDropList != null)
{
for (ItemStack item : itemDropList)
{
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityItem(par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ, item));
}
}
for (ItemStack stack : itemDropList)
dropMultiset.add(ItemType.fromStack(stack), stack.stackSize);
}
}
@ -186,6 +184,8 @@ public class BoundShovel extends ItemSpade implements IBindable
}
}
}
BoundPickaxe.dropMultisetStacks(dropMultiset, par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ);
return par1ItemStack;
}

View file

@ -8,8 +8,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntitySlime;

View file

@ -0,0 +1,42 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemEnchantmentGlyphBlock extends ItemBlock
{
public ItemEnchantmentGlyphBlock(Block block)
{
super(block);
setHasSubtypes(true);
}
@Override
public String getUnlocalizedName(ItemStack itemstack)
{
String name = "";
switch (itemstack.getItemDamage())
{
case 0:
name = "enchantability";
break;
case 1:
name = "enchantmentLevel";
break;
default:
name = "broken";
}
return getUnlocalizedName() + "." + name;
}
@Override
public int getMetadata(int par1)
{
return par1;
}
}

View file

@ -21,7 +21,6 @@ import org.lwjgl.input.Keyboard;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.items.interfaces.IRitualDiviner;
import WayofTime.alchemicalWizardry.api.rituals.IRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
@ -59,7 +58,11 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
if (this.getMaxRuneDisplacement(par1ItemStack) == 1)
{
par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.canplace"));
} else
}else if (this.getMaxRuneDisplacement(par1ItemStack) >= 2)
{
par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.canplacedawn"));
}else
{
par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.cannotplace"));
}
@ -124,13 +127,16 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
}
}
par3List.add(StatCollector.translateToLocal("tooltip.ritualdiviner.blankstones") + " " + blankStones);
int totalStones = blankStones + airStones + waterStones + fireStones + earthStones + duskStones + dawnStones;
par3List.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("tooltip.ritualdiviner.blankstones") + " " + blankStones);
par3List.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("tooltip.ritualdiviner.airstones") + " " + airStones);
par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("tooltip.ritualdiviner.waterstones") + " " + waterStones);
par3List.add(EnumChatFormatting.RED + StatCollector.translateToLocal("tooltip.ritualdiviner.firestones") + " " + fireStones);
par3List.add(EnumChatFormatting.DARK_GREEN + StatCollector.translateToLocal("tooltip.ritualdiviner.earthstones") + " " + earthStones);
par3List.add(EnumChatFormatting.BOLD + StatCollector.translateToLocal("tooltip.ritualdiviner.duskstones") + " " + duskStones);
par3List.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tooltip.ritualdiviner.duskstones") + " " + duskStones);
par3List.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("tooltip.ritualdiviner.dawnstones") + " " + dawnStones);
par3List.add(EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal("tooltip.ritualdiviner.totalStones") + " " + totalStones);
}
}else
{
@ -358,10 +364,15 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
@SideOnly(Side.CLIENT)
public void getSubItems(Item id, CreativeTabs creativeTab, List list)
{
list.add(new ItemStack(ModItems.itemRitualDiviner));
ItemStack duskRitualDivinerStack = new ItemStack(ModItems.itemRitualDiviner);
((ItemRitualDiviner) duskRitualDivinerStack.getItem()).setMaxRuneDisplacement(duskRitualDivinerStack, 1);
list.add(new ItemStack(id));
ItemStack duskRitualDivinerStack = new ItemStack(id);
this.setMaxRuneDisplacement(duskRitualDivinerStack, 1);
list.add(duskRitualDivinerStack);
ItemStack dawnRitualDivinerStack = new ItemStack(id);
this.setMaxRuneDisplacement(dawnRitualDivinerStack, 2);
list.add(dawnRitualDivinerStack);
}
@Override

View file

@ -0,0 +1,38 @@
package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemStabilityGlyphBlock extends ItemBlock
{
public ItemStabilityGlyphBlock(Block block)
{
super(block);
setHasSubtypes(true);
}
@Override
public String getUnlocalizedName(ItemStack itemstack)
{
String name = "";
switch (itemstack.getItemDamage())
{
case 0:
name = "stability1";
break;
default:
name = "broken";
}
return getUnlocalizedName() + "." + name;
}
@Override
public int getMetadata(int par1)
{
return par1;
}
}

View file

@ -168,6 +168,21 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA
return false;
}
public boolean isAffectedBySoulHarden()
{
return true;
}
public double getBaseArmourReduction()
{
return 0.9;
}
public double getArmourPenetrationReduction()
{
return 0.9;
}
@Override
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot)
{
@ -188,7 +203,7 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA
h = player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulHarden).getAmplifier() + 1;
}
armourReduction = 1 - 0.1 * Math.pow(1.0/3.0, Math.max(0, h - f)) - 0.1 * Math.max(0, f-h);
armourReduction = isAffectedBySoulHarden() ? 1 - (1 - this.getBaseArmourReduction()) * Math.pow(1.0/3.0, Math.max(0, h - f)) - 0.1 * Math.max(0, f-h) : getBaseArmourReduction();
damageAmount *= (armourReduction);
@ -224,7 +239,7 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA
{
if (source.isUnblockable())
{
return new ArmorProperties(-1, damageAmount * 0.9d, maxAbsorption);
return new ArmorProperties(-1, damageAmount * getArmourPenetrationReduction(), maxAbsorption);
}
return new ArmorProperties(-1, damageAmount, maxAbsorption);
@ -373,7 +388,14 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA
this.setIsInvisible(itemStack, player.isPotionActive(Potion.invisibility.id));
if (itemStack.getItemDamage() > 0)
this.repairArmour(world, player, itemStack);
return;
}
public void repairArmour(World world, EntityPlayer player, ItemStack itemStack)
{
if (itemStack.getItemDamage() > 0)
{
EnergyItems.checkAndSetItemOwner(itemStack, player);
@ -385,8 +407,6 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA
}
}
}
return;
}
public void tickInternalInventory(ItemStack par1ItemStack, World par2World, EntityPlayer par3Entity, int par4, boolean par5)

View file

@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.items.armour;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -23,6 +24,8 @@ import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -36,6 +39,10 @@ public abstract class OmegaArmour extends BoundArmour
protected boolean storeYLevel = false;
protected boolean storeSeesSky = false;
protected List<Enchantment> illegalEnchantmentList = new LinkedList();
public float reagentDrainPerDamage = 0.1f;
public OmegaArmour(int armorType)
{
super(armorType);
@ -56,31 +63,52 @@ public abstract class OmegaArmour extends BoundArmour
this.reagent = reagent;
}
@Override
public boolean isAffectedBySoulHarden()
{
return false;
}
@Override
public double getBaseArmourReduction()
{
return 0.9;
}
@Override
public double getArmourPenetrationReduction()
{
return 0.5;
}
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
{
super.onArmorTick(world, player, itemStack);
if(this.storeBiomeID())
if(world.getWorldTime() % 50 == 0)
{
int xCoord = (int) Math.floor(player.posX);
int zCoord = (int) Math.floor(player.posZ);
BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord);
if(biome != null)
if(this.storeBiomeID())
{
this.setBiomeIDStored(itemStack, biome.biomeID);
int xCoord = (int) Math.floor(player.posX);
int zCoord = (int) Math.floor(player.posZ);
BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord);
if(biome != null)
{
this.setBiomeIDStored(itemStack, biome.biomeID);
}
}
if(this.storeDimensionID())
{
this.setDimensionIDStored(itemStack, world.provider.dimensionId);
}
if(this.storeYLevel())
{
this.setYLevelStored(itemStack, (int) Math.floor(player.posY));
}
}
if(this.storeDimensionID())
{
this.setDimensionIDStored(itemStack, world.provider.dimensionId);
}
if(this.storeYLevel())
{
this.setYLevelStored(itemStack, (int) Math.floor(player.posY));
}
if(this.armorType == 1)
@ -94,13 +122,34 @@ public abstract class OmegaArmour extends BoundArmour
}
}
@Override
public void repairArmour(World world, EntityPlayer player, ItemStack itemStack)
{
if (itemStack.getItemDamage() > 0)
{
if (!player.capabilities.isCreativeMode)
{
if(EnergyItems.syphonBatteries(itemStack, player, itemStack.getItemDamage() * 75))
{
Reagent reagent = APISpellHelper.getPlayerReagentType(player);
float reagentAmount = APISpellHelper.getPlayerCurrentReagentAmount(player);
reagentAmount -= itemStack.getItemDamage() * reagentDrainPerDamage;
APISpellHelper.setPlayerCurrentReagentAmount(player, Math.max(0, reagentAmount));
itemStack.setItemDamage(0);
}
}
}
}
public void revertArmour(EntityPlayer player, ItemStack itemStack)
{
ItemStack stack = this.getContainedArmourStack(itemStack);
player.inventory.armorInventory[3-this.armorType] = stack;
}
public ItemStack getSubstituteStack(ItemStack boundStack, int stability, int affinity, int enchantability, Random rand)
public ItemStack getSubstituteStack(ItemStack boundStack, int stability, int affinity, int enchantability, int enchantmentLevel, Random rand)
{
ItemStack omegaStack = new ItemStack(this);
if(boundStack != null && boundStack.hasTagCompound())
@ -110,13 +159,18 @@ public abstract class OmegaArmour extends BoundArmour
}
this.setContainedArmourStack(omegaStack, boundStack);
SoulNetworkHandler.checkAndSetItemOwner(omegaStack, SoulNetworkHandler.getOwnerName(boundStack));
this.setItemEnchantability(omegaStack, 70);
this.setItemEnchantability(omegaStack, Math.min(enchantability, 70));
EnchantmentHelper.setEnchantments(new HashMap(), omegaStack);
List enchantList = new ArrayList();
for(int i=0; i<100; i++)
int adjustedEnchantLevel = Math.min(enchantmentLevel, 30);
int additionalPasses = enchantmentLevel - adjustedEnchantLevel;
for(int i=0; i<1+additionalPasses; i++)
{
List lst = EnchantmentHelper.buildEnchantmentList(rand, omegaStack, 30);
List lst = EnchantmentHelper.buildEnchantmentList(rand, omegaStack, adjustedEnchantLevel);
if(lst != null)
{
enchantList.addAll(lst);
@ -144,9 +198,17 @@ public abstract class OmegaArmour extends BoundArmour
}
}
for(Enchantment ench : this.illegalEnchantmentList)
{
if(map.containsKey(ench))
{
map.remove(ench);
}
}
List newEnchantList = new ArrayList();
for(Entry<Enchantment, Map<Integer, Integer>> entry : map.entrySet()) //Assume enchant # 0 is level 1 enchant
for(Entry<Enchantment, Map<Integer, Integer>> entry : map.entrySet())
{
Enchantment ench = entry.getKey();
Map<Integer, Integer> numMap = entry.getValue();

View file

@ -28,6 +28,7 @@ public class OmegaArmourEarth extends OmegaArmour
public OmegaArmourEarth(int armorType)
{
super(armorType);
this.storeYLevel = true;
}
@Override
@ -89,10 +90,14 @@ public class OmegaArmourEarth extends OmegaArmour
}
@Override
public Multimap getItemAttributeModifiers()
public Multimap getAttributeModifiers(ItemStack stack)
{
Multimap map = HashMultimap.create();
map.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(179618 /** Random number **/, armorType), "Armor modifier" + armorType, getKnockbackResist(), 0));
int yLevel = this.getYLevelStored(stack);
map.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(179618 /** Random number **/, armorType), "Knockback modifier" + armorType, getKnockbackResist(), 0));
map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(80532 /** Random number **/, armorType), "Health modifier" + armorType, getDefaultArmourBoost()*getHealthBoostModifierForLevel(yLevel), 1));
map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85112 /** Random number **/, armorType), "Damage modifier" + armorType, getDefaultArmourBoost()*getDamageModifierForLevel(yLevel), 2));
return map;
}
@ -100,4 +105,30 @@ public class OmegaArmourEarth extends OmegaArmour
{
return 0.25f;
}
public float getDefaultArmourBoost()
{
switch(this.armorType)
{
case 0:
return 2.5f;
case 1:
return 4;
case 2:
return 3.5f;
case 3:
return 2;
}
return 0.25f;
}
public float getHealthBoostModifierForLevel(int yLevel)
{
return 0.05f * (yLevel <= 50 ? 1.5f : yLevel >= 100 ? -0.5f : 0.5f);
}
public float getDamageModifierForLevel(int yLevel)
{
return 0.03f * (yLevel <= 50 ? 1.5f : yLevel >= 100 ? -0.5f : 0.5f);
}
}

View file

@ -1,10 +1,19 @@
package WayofTime.alchemicalWizardry.common.items.armour;
import java.util.UUID;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.biome.BiomeGenBase;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaFire;
import cpw.mods.fml.relauncher.Side;
@ -20,7 +29,8 @@ public class OmegaArmourFire extends OmegaArmour
public OmegaArmourFire(int armorType)
{
super(armorType);
// this.storeYLevel = true;
this.storeBiomeID = true;
this.illegalEnchantmentList.add(Enchantment.fireProtection);
}
@Override
@ -81,17 +91,21 @@ public class OmegaArmourFire extends OmegaArmour
return this.itemIcon;
}
// @Override
// public Multimap getAttributeModifiers(ItemStack stack)
// {
// Multimap map = HashMultimap.create();
//
//// map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85212 /** Random number **/, armorType), "Armor modifier" + armorType, getDefaultHealthBoost()*getHealthBoostModifierForLevel(yLevel), 0));
//
// return map;
// }
@Override
public Multimap getAttributeModifiers(ItemStack stack)
{
Multimap map = HashMultimap.create();
int biomeID = this.getBiomeIDStored(stack);
BiomeGenBase biome = BiomeGenBase.getBiome(biomeID);
if(biome != null)
{
map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(895132 /** Random number **/, armorType), "Health modifier" + armorType, getDefaultArmourBoost()*getHealthBoostModifierForBiome(biome), 1));
map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(196312 /** Random number **/, armorType), "Damage modifier" + armorType, getDefaultArmourBoost()*getDamageModifierForBiome(biome), 1));
}
return map;
}
public float getDefaultHealthBoost()
public float getDefaultArmourBoost()
{
switch(this.armorType)
{
@ -107,8 +121,47 @@ public class OmegaArmourFire extends OmegaArmour
return 0.25f;
}
// public float getHealthBoostModifierForLevel(int yLevel)
// {
// return (float)Math.sqrt(((float)yLevel)/64f) * 1.5f - 1;
// }
public float getHealthBoostModifierForBiome(BiomeGenBase biome)
{
float modifier = 0.05f;
if(biome.isEqualTo(BiomeGenBase.hell))
{
return modifier * 2.0f;
}
if(biome.isEqualTo(BiomeGenBase.ocean))
{
return modifier * -0.5f;
}
if(biome.temperature >= 1)
{
return modifier * 1.5f;
}
return modifier * 0.5f;
}
public float getDamageModifierForBiome(BiomeGenBase biome)
{
float modifier = 0.03f;
if(biome.isEqualTo(BiomeGenBase.hell))
{
return modifier * 2.0f;
}
if(biome.isEqualTo(BiomeGenBase.ocean))
{
return modifier * -0.5f;
}
if(biome.temperature >= 1)
{
return modifier * 1.5f;
}
return modifier * 0.5f;
}
}

View file

@ -97,12 +97,13 @@ public class OmegaArmourWater extends OmegaArmour
BiomeGenBase biome = BiomeGenBase.getBiome(biomeID);
if(biome != null)
{
map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85312 /** Random number **/, armorType), "Armor modifier" + armorType, getDefaultHealthBoost()*getHealthBoostModifierForBiome(biome), 0));
map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85312 /** Random number **/, armorType), "Health modifier" + armorType, getDefaultArmourBoost()*getHealthBoostModifierForBiome(biome), 2));
map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85432 /** Random number **/, armorType), "Damage modifier" + armorType, getDefaultArmourBoost()*getDamageModifierForBiome(biome), 2));
}
return map;
}
public float getDefaultHealthBoost()
public float getDefaultArmourBoost()
{
switch(this.armorType)
{
@ -120,21 +121,44 @@ public class OmegaArmourWater extends OmegaArmour
public float getHealthBoostModifierForBiome(BiomeGenBase biome)
{
float modifier = 0.05f;
if(biome.isEqualTo(BiomeGenBase.hell))
{
return -0.5f;
return modifier * -0.5f;
}
if(biome.isEqualTo(BiomeGenBase.ocean))
if(biome.isEqualTo(BiomeGenBase.ocean) || biome.isEqualTo(BiomeGenBase.river))
{
return 2.0f;
return modifier * 2.0f;
}
if(biome.isHighHumidity())
{
return 1.5f;
return modifier * 1.5f;
}
return 0.5f;
return modifier * 0.5f;
}
public float getDamageModifierForBiome(BiomeGenBase biome)
{
float modifier = 0.03f;
if(biome.isEqualTo(BiomeGenBase.hell))
{
return modifier * -0.5f;
}
if(biome.isEqualTo(BiomeGenBase.ocean) || biome.isEqualTo(BiomeGenBase.river))
{
return modifier * 2.0f;
}
if(biome.isHighHumidity())
{
return modifier * 1.5f;
}
return modifier * 0.5f;
}
}

View file

@ -94,13 +94,13 @@ public class OmegaArmourWind extends OmegaArmour
{
Multimap map = HashMultimap.create();
int yLevel = this.getYLevelStored(stack);
map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85212 /** Random number **/, armorType), "Armor modifier" + armorType, getDefaultHealthBoost()*getHealthBoostModifierForLevel(yLevel), 0));
map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85212 /** Random number **/, armorType), "Health modifier" + armorType, getDefaultArmourBoost()*getHealthBoostModifierForLevel(yLevel), 1));
map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(86212 /** Random number **/, armorType), "Damage modifier" + armorType, getDefaultArmourBoost()*getDamageModifierForLevel(yLevel), 2));
return map;
}
public float getDefaultHealthBoost()
public float getDefaultArmourBoost()
{
switch(this.armorType)
{
@ -118,6 +118,11 @@ public class OmegaArmourWind extends OmegaArmour
public float getHealthBoostModifierForLevel(int yLevel)
{
return (float)Math.sqrt(((float)yLevel)/64f) * 1.5f - 1;
return 0.05f * ((((float)yLevel)/64f) * 1.5f - 1);
}
public float getDamageModifierForLevel(int yLevel)
{
return 0.02f * ((((float)yLevel)/64f) * 1.5f - 1);
}
}

View file

@ -213,7 +213,7 @@ public class ItemTankSegmenter extends Item implements IReagentManipulator
numberAssigned = 0;
}
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.tanksegmenter.nowhas") + " " + numberAssigned + " " + "message.tanksegmenter.tankssetto" + " " + reagent.name));
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.tanksegmenter.nowhas") + " " + numberAssigned + " " + StatCollector.translateToLocal("message.tanksegmenter.tankssetto") + " " + reagent.name));
reagentHandler.setTanksTunedToReagent(reagent, numberAssigned);
}

View file

@ -49,7 +49,6 @@ public class ItemBloodLightSigil extends EnergyItems implements IHolding
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
System.out.println("Being called");
if(!EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer) || !EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed()))
{
return true;
@ -96,7 +95,7 @@ public class ItemBloodLightSigil extends EnergyItems implements IHolding
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking())
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}

View file

@ -56,7 +56,7 @@ public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SigilOfTheFastMiner");
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:MiningSigil_deactivated");
this.activeIcon = iconRegister.registerIcon("AlchemicalWizardry:MiningSigil_activated");
this.passiveIcon = iconRegister.registerIcon("AlchemicalWizardry:MiningSigil_deactivated");
}

View file

@ -2,8 +2,8 @@ package WayofTime.alchemicalWizardry.common.omega;
import net.minecraft.world.World;
public interface IEnchantmentGlyph
public interface IEnchantmentGlyph extends IStabilityGlyph
{
public int getSubtractedStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount);
public int getEnchantability(World world, int x, int y, int z, int meta);
public int getEnchantmentLevel(World world, int x, int y, int z, int meta);
}

View file

@ -0,0 +1,8 @@
package WayofTime.alchemicalWizardry.common.omega;
import net.minecraft.world.World;
public interface IStabilityGlyph
{
public int getAdditionalStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount);
}

View file

@ -35,10 +35,10 @@ public class OmegaParadigm
this.leggings.setReagent(reagent);
this.boots.setReagent(reagent);
this.config = new ReagentRegenConfiguration(20, 10, 1);
this.config = new ReagentRegenConfiguration(100, 1, 10);
}
public boolean convertPlayerArmour(EntityPlayer player, int x, int y, int z, int stability, int affinity, int enchantability)
public boolean convertPlayerArmour(EntityPlayer player, int x, int y, int z, int stability, int affinity, int enchantability, int enchantmentLevel)
{
ItemStack[] armours = player.inventory.armorInventory;
@ -48,13 +48,13 @@ public class OmegaParadigm
ItemStack bootsStack = armours[0];
if(helmetStack != null && helmetStack.getItem() == ModItems.boundHelmet && chestStack != null && chestStack.getItem() == ModItems.boundPlate && leggingsStack != null && leggingsStack.getItem() == ModItems.boundLeggings && bootsStack != null && bootsStack.getItem() == ModItems.boundBoots)
{
{
long worldSeed = player.worldObj.getSeed();
Random rand = new Random(worldSeed + stability * (affinity + 7) * 94 + 84321*x - 17423*y + 76*z - 1623451*enchantability);
ItemStack omegaHelmetStack = helmet.getSubstituteStack(helmetStack, stability, affinity, enchantability, rand);
ItemStack omegaChestStack = chestPiece.getSubstituteStack(chestStack, stability, affinity, enchantability, rand);
ItemStack omegaLeggingsStack = leggings.getSubstituteStack(leggingsStack, stability, affinity, enchantability, rand);
ItemStack omegaBootsStack = boots.getSubstituteStack(bootsStack, stability, affinity, enchantability, rand);
Random rand = new Random(worldSeed + stability * (affinity + 7) * 94 + 84321*x - 17423*y + 76*z - 1623451*enchantability + 2 * enchantmentLevel);
ItemStack omegaHelmetStack = helmet.getSubstituteStack(helmetStack, stability, affinity, enchantability, enchantmentLevel, rand);
ItemStack omegaChestStack = chestPiece.getSubstituteStack(chestStack, stability, affinity, enchantability, enchantmentLevel, rand);
ItemStack omegaLeggingsStack = leggings.getSubstituteStack(leggingsStack, stability, affinity, enchantability, enchantmentLevel, rand);
ItemStack omegaBootsStack = boots.getSubstituteStack(bootsStack, stability, affinity, enchantability, enchantmentLevel, rand);
armours[3] = omegaHelmetStack;
armours[2] = omegaChestStack;
@ -74,7 +74,7 @@ public class OmegaParadigm
public int getMaxAdditionalHealth()
{
return 50;
return 20;
}
public boolean setOmegaStalling(EntityPlayer player, int duration)

View file

@ -1,5 +1,13 @@
package WayofTime.alchemicalWizardry.common.omega;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour;
@ -7,18 +15,45 @@ public class OmegaParadigmEarth extends OmegaParadigm
{
public OmegaParadigmEarth(OmegaArmour helmet, OmegaArmour chestPiece, OmegaArmour leggings, OmegaArmour boots)
{
super(ReagentRegistry.terraeReagent, helmet, chestPiece, leggings, boots, new ReagentRegenConfiguration(50, 10, 100));
super(ReagentRegistry.terraeReagent, helmet, chestPiece, leggings, boots, new ReagentRegenConfiguration(50, 1, 10));
}
// @Override
// public float getCostPerTickOfUse(EntityPlayer player)
// {
// if(player.isInWater())
@Override
public float getCostPerTickOfUse(EntityPlayer player)
{
// if(player.isBurning())
// {
// return 0.5f;
// }else
// {
// return 1;
// }
// }
return 1;
}
@Override
public void onUpdate(World world, EntityPlayer player, ItemStack stack)
{
if(world.getWorldTime() % 100 == 0 && !world.isRemote)
{
if(player.posY < 50 && player.getHealth() < player.getMaxHealth())
{
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0, true));
}
}
if(player.posY > 100)
{
player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionHeavyHeart.id, 200, 0, true));
}
}
@Override
public boolean getBlockEffectWhileInside(Entity entity, int x, int y, int z)
{
return true;
}
@Override
public void onOmegaKeyPressed(EntityPlayer player, ItemStack stack)
{
}
}

View file

@ -1,8 +1,11 @@
package WayofTime.alchemicalWizardry.common.omega;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour;
@ -11,19 +14,47 @@ public class OmegaParadigmFire extends OmegaParadigm
{
public OmegaParadigmFire(OmegaArmour helmet, OmegaArmour chestPiece, OmegaArmour leggings, OmegaArmour boots)
{
super(ReagentRegistry.incendiumReagent, helmet, chestPiece, leggings, boots, new ReagentRegenConfiguration(50, 10, 100));
super(ReagentRegistry.incendiumReagent, helmet, chestPiece, leggings, boots, new ReagentRegenConfiguration(50, 1, 10));
}
@Override
public float getCostPerTickOfUse(EntityPlayer player)
{
if(player.isBurning())
{
return 0.5f;
}
return 1;
}
@Override
public void onUpdate(World world, EntityPlayer player, ItemStack stack)
{
if(world.getWorldTime() % 100 == 0 && !world.isRemote)
{
boolean isInLava = player.isInsideOfMaterial(Material.lava);
if(player.isBurning() && player.getHealth() < player.getMaxHealth())
{
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, isInLava ? 1 : 0, true));
}
if(player.isBurning())
{
player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, isInLava ? 400 : 200, isInLava ? 1 : 0, true));
}
if(player.isInWater())
{
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 200, 2, true));
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 2, true));
player.addPotionEffect(new PotionEffect(Potion.weakness.id, 200, 1, true));
}
}
if(player.isBurning())
{
player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 200, 0, true));
}
}
@Override

View file

@ -17,7 +17,7 @@ public class OmegaParadigmWater extends OmegaParadigm
{
public OmegaParadigmWater(OmegaArmour helmet, OmegaArmour chestPiece, OmegaArmour leggings, OmegaArmour boots)
{
super(ReagentRegistry.aquasalusReagent, helmet, chestPiece, leggings, boots, new ReagentRegenConfiguration(50, 10, 100));
super(ReagentRegistry.aquasalusReagent, helmet, chestPiece, leggings, boots, new ReagentRegenConfiguration(50, 1, 10));
}
@Override
@ -37,6 +37,14 @@ public class OmegaParadigmWater extends OmegaParadigm
{
player.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 3, 0, true));
player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionAmphibian.id, 3, 0, true));
if(world.getWorldTime() % 100 == 0 && !world.isRemote)
{
if(player.isInWater() && player.getHealth() < player.getMaxHealth())
{
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0, true));
}
}
}
@Override

View file

@ -3,6 +3,8 @@ package WayofTime.alchemicalWizardry.common.omega;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour;
@ -11,7 +13,7 @@ public class OmegaParadigmWind extends OmegaParadigm
{
public OmegaParadigmWind(OmegaArmour helmet, OmegaArmour chestPiece, OmegaArmour leggings, OmegaArmour boots)
{
super(ReagentRegistry.aetherReagent, helmet, chestPiece, leggings, boots, new ReagentRegenConfiguration(50, 10, 100));
super(ReagentRegistry.aetherReagent, helmet, chestPiece, leggings, boots, new ReagentRegenConfiguration(50, 1, 10));
}
@Override
@ -29,7 +31,12 @@ public class OmegaParadigmWind extends OmegaParadigm
@Override
public void onUpdate(World world, EntityPlayer player, ItemStack stack)
{
if(world.getWorldTime() % 100 == 0 && !world.isRemote && player.posY > 128 && player.getHealth() < player.getMaxHealth())
{
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, player.posY > 128 + 64 ? 1 : 0, true));
}
player.fallDistance = 0;
}
@Override

View file

@ -7,7 +7,7 @@ import WayofTime.alchemicalWizardry.api.Int3;
public class OmegaStructureHandler
{
public static final OmegaStructureParameters emptyParam = new OmegaStructureParameters(0, 0);
public static final OmegaStructureParameters emptyParam = new OmegaStructureParameters(0, 0, 0);
public static boolean isStructureIntact(World world, int x, int y, int z)
{
@ -155,6 +155,7 @@ public class OmegaStructureHandler
int tally = 0;
int enchantability = 0;
int enchantmentLevel = 0;
for (int i = 0; i < 2 * range + 1; i++)
{
@ -198,23 +199,27 @@ public class OmegaStructureHandler
{
indTally++;
}
Block block = world.getBlock(x - range + i, y - range + j, z - range + k);
int meta = 0;
int meta = world.getBlockMetadata(x - range + i, y - range + j, z - range + k);
if(block instanceof IEnchantmentGlyph)
{
tally -= ((IEnchantmentGlyph)block).getSubtractedStabilityForFaceCount(world, x-range+i, y-range+j, z-range+k, meta, indTally);
tally += ((IEnchantmentGlyph)block).getAdditionalStabilityForFaceCount(world, x-range+i, y-range+j, z-range+k, meta, indTally);
enchantability += ((IEnchantmentGlyph)block).getEnchantability(world, x-range+i, y-range+j, z-range+k, meta);
enchantmentLevel += ((IEnchantmentGlyph)block).getEnchantmentLevel(world, x-range+i, y-range+j, z-range+k, meta);
}else if(block instanceof IStabilityGlyph)
{
tally += ((IStabilityGlyph)block).getAdditionalStabilityForFaceCount(world, x-range+i, y-range+j, z-range+k, meta, indTally);
}else
{
tally += indTally;
}
}
}
}
}
return new OmegaStructureParameters(tally, enchantability);
return new OmegaStructureParameters(tally, enchantability, enchantmentLevel);
}
public static OmegaStructureParameters getStructureStabilityFactor(World world, int x, int y, int z, int expLim)

View file

@ -4,10 +4,12 @@ public class OmegaStructureParameters
{
public final int stability;
public final int enchantability;
public final int enchantmentLevel;
public OmegaStructureParameters(int stability, int enchantability)
public OmegaStructureParameters(int stability, int enchantability, int enchantmentLevel)
{
this.stability = stability;
this.enchantability = enchantability;
this.enchantmentLevel = enchantmentLevel;
}
}

View file

@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.renderer.block;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelWritingTable;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
@ -13,6 +14,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
public class RenderWritingTable extends TileEntitySpecialRenderer
@ -57,7 +59,7 @@ public class RenderWritingTable extends TileEntitySpecialRenderer
if (tileAltar.getStackInSlot(i) != null)
{
float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(i));
float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
float rotationAngle = Minecraft.getMinecraft().gameSettings.fancyGraphics ? (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) : 0;
EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
ghostEntityItem.hoverStart = 0.0F;
ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(i));

View file

@ -1,7 +1,6 @@
package WayofTime.alchemicalWizardry.common.renderer.block;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelBloodAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
@ -10,8 +9,12 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelBloodAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
public class TEAltarRenderer extends TileEntitySpecialRenderer
{
private ModelBloodAltar modelBloodAltar = new ModelBloodAltar();
@ -44,7 +47,7 @@ public class TEAltarRenderer extends TileEntitySpecialRenderer
if (tileAltar.getStackInSlot(0) != null)
{
float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(0));
float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
float rotationAngle = Minecraft.getMinecraft().gameSettings.fancyGraphics ? (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) : 0;
EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
ghostEntityItem.hoverStart = 0.0F;
ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(0));

View file

@ -44,13 +44,13 @@ public class RitualEffectAutoAlchemy extends RitualEffect
int flag = 0;
TileEntity topEntity = world.getTileEntity(x, y + 1, z);
if (!(topEntity instanceof IBloodAltar))
if (!(topEntity instanceof IBloodAltar) || !(topEntity instanceof IBloodAltar))
{
return;
}
IBloodAltar altar = (IBloodAltar) topEntity;
ItemStack targetStack = altar.getStackInSlot(0);
ItemStack targetStack = ((IInventory)altar).getStackInSlot(0);
if (targetStack == null)
{
return;

View file

@ -0,0 +1,448 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectCrafting extends RitualEffect
{
public static final boolean isTesting = false;
public static final boolean limitToSingleStack = true;
public static final int potentiaDrain = 2;
public static final int virtusDrain = 2;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
// long startTime = System.nanoTime();
String owner = ritualStone.getOwner();
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
if(world.getWorldTime() % (hasPotentia ? 1 : 4) != 0)
{
return;
}
if (currentEssence < this.getCostPerRefresh())
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
NBTTagCompound tag = ritualStone.getCustomRitualTag();
if(tag == null)
{
ritualStone.setCustomRitualTag(new NBTTagCompound());
tag = ritualStone.getCustomRitualTag();
}
boolean lastFailed = tag.getBoolean("didLastCraftFail");
int slotDesignation = tag.getInteger("slotDesignation");
if(lastFailed)
{
slotDesignation++;
tag.setInteger("slotDesignation", slotDesignation);
tag.setBoolean("didLastCraftFail", false);
}
int direction = ritualStone.getDirection();
boolean canContinue = false;
ItemStack[] recipe = new ItemStack[9];
InventoryCrafting inventory = new InventoryCrafting(new Container()
{
public boolean canInteractWith(EntityPlayer player)
{
return false;
}
}, 3, 3);
for(int i=-1; i<=1; i++)
{
for(int j=-1; j<=1; j++)
{
int gridSpace = (i+1)*3 + (j+1);
Int3 pos = this.getSlotPositionForDirection(gridSpace, direction);
TileEntity inv = world.getTileEntity(x + pos.xCoord, y + pos.yCoord, z + pos.zCoord);
if(inv instanceof IInventory)
{
if(((IInventory) inv).getSizeInventory() <= slotDesignation || !((IInventory) inv).isItemValidForSlot(slotDesignation, ((IInventory) inv).getStackInSlot(slotDesignation)))
{
continue;
}else
{
ItemStack invStack = ((IInventory) inv).getStackInSlot(slotDesignation);
if(invStack != null)
{
inventory.setInventorySlotContents(gridSpace, invStack);
recipe[gridSpace] = invStack;
canContinue = true;
}
}
}
}
}
if(!canContinue)
{
tag.setInteger("slotDesignation", 0);
return;
}
ItemStack returnStack = CraftingManager.getInstance().findMatchingRecipe(inventory, world);
if (returnStack == null)
{
tag.setBoolean("didLastCraftFail", true);
return;
}else
{
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
boolean addOutputToInputs = hasVirtus;
IInventory outputInv = null;
List<IInventory> invList = new ArrayList();
TileEntity northEntity = world.getTileEntity(x, y-1, z - 2);
TileEntity southEntity = world.getTileEntity(x, y-1, z + 2);
TileEntity eastEntity = world.getTileEntity(x + 2, y-1, z);
TileEntity westEntity = world.getTileEntity(x - 2, y-1, z);
switch(direction)
{
case 1:
if(southEntity instanceof IInventory)
{
outputInv = (IInventory)southEntity;
}else
{
return;
}
if(northEntity instanceof IInventory)
{
invList.add((IInventory)northEntity);
}
if(eastEntity instanceof IInventory)
{
invList.add((IInventory)eastEntity);
}
if(westEntity instanceof IInventory)
{
invList.add((IInventory)westEntity);
}
break;
case 2:
if(westEntity instanceof IInventory)
{
outputInv = (IInventory)westEntity;
}else
{
return;
}
if(northEntity instanceof IInventory)
{
invList.add((IInventory)northEntity);
}
if(eastEntity instanceof IInventory)
{
invList.add((IInventory)eastEntity);
}
if(southEntity instanceof IInventory)
{
invList.add((IInventory)southEntity);
}
break;
case 3:
if(northEntity instanceof IInventory)
{
outputInv = (IInventory)northEntity;
}else
{
return;
}
if(eastEntity instanceof IInventory)
{
invList.add((IInventory)eastEntity);
}
if(southEntity instanceof IInventory)
{
invList.add((IInventory)southEntity);
}
if(westEntity instanceof IInventory)
{
invList.add((IInventory)westEntity);
}
break;
case 4:
if(eastEntity instanceof IInventory)
{
outputInv = (IInventory)eastEntity;
}else
{
return;
}
if(northEntity instanceof IInventory)
{
invList.add((IInventory)northEntity);
}
if(southEntity instanceof IInventory)
{
invList.add((IInventory)southEntity);
}
if(westEntity instanceof IInventory)
{
invList.add((IInventory)westEntity);
}
break;
}
if (outputInv != null)
{
if(!(!limitToSingleStack ? SpellHelper.canInsertStackFullyIntoInventory(returnStack, outputInv, ForgeDirection.DOWN) : SpellHelper.canInsertStackFullyIntoInventory(returnStack, outputInv, ForgeDirection.DOWN, true, returnStack.getMaxStackSize())))
{
tag.setBoolean("didLastCraftFail", true);
return;
}
if(addOutputToInputs)
{
invList.add(outputInv);
}
Map<Integer, Map<Integer, Integer>> syphonMap = new HashMap(); //Inventory, Slot, how much claimed
for(int n = 0; n < recipe.length; n++) //Look for the correct items
{
ItemStack recipeStack = recipe[n];
if(recipeStack == null)
{
continue;
}
boolean isItemTaken = false;
for(int i = 0; i < invList.size(); i++)
{
if(isItemTaken)
{
break;
}
IInventory inputInv = invList.get(i);
if(inputInv == null)
{
continue;
}
for(int j = 0; j < inputInv.getSizeInventory(); j++)
{
if(!inputInv.isItemValidForSlot(j, recipeStack))
{
continue;
}
ItemStack invItem = inputInv.getStackInSlot(j);
if(invItem == null)
{
continue;
}
if(this.areItemsEqualForCrafting(recipeStack, invItem))
{
//TODO
inventory.setInventorySlotContents(n, invItem);
// ItemStack returnedStack = CraftingManager.getInstance().findMatchingRecipe(inventory, world);
// if(returnedStack == null || returnedStack.getItem() == null || returnedStack.getItem() != returnStack.getItem())
// {
// continue;
// }
Map<Integer, Integer> slotMap = syphonMap.get(i);
if(slotMap == null)
{
slotMap = new HashMap();
syphonMap.put(i, slotMap);
}
if(slotMap.containsKey(j))
{
int syphoned = slotMap.get(j);
if(invItem.stackSize - syphoned > 0)
{
slotMap.put(j, syphoned + 1);
isItemTaken = true;
break;
}
}else
{
slotMap.put(j, 1);
isItemTaken = true;
break;
}
}
}
}
if(!isItemTaken)
{
tag.setBoolean("didLastCraftFail", true);
return;
}
}
/* The recipe is valid and the items have been found */
SpellHelper.insertStackIntoInventory(CraftingManager.getInstance().findMatchingRecipe(inventory, world), outputInv, ForgeDirection.DOWN);
for(Entry<Integer, Map<Integer, Integer>> entry1 : syphonMap.entrySet())
{
IInventory inputInv = invList.get(entry1.getKey());
for(Entry<Integer, Integer> entry2 : entry1.getValue().entrySet())
{
ItemStack drainedStack = inputInv.getStackInSlot(entry2.getKey());
Item item = drainedStack.getItem();
if(item.hasContainerItem(drainedStack))
{
inputInv.setInventorySlotContents(entry2.getKey(), item.getContainerItem(drainedStack));
}else
{
drainedStack.stackSize -= entry2.getValue();
if(drainedStack.stackSize <= 0)
{
inputInv.setInventorySlotContents(entry2.getKey(), null);
}
}
}
}
if(addOutputToInputs && syphonMap.containsKey(invList.size()))
{
this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true);
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
if(hasPotentia)
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
world.markBlockForUpdate(x, y-1, z + 2);
world.markBlockForUpdate(x, y-1, z - 2);
world.markBlockForUpdate(x + 2, y-1, z);
world.markBlockForUpdate(x - 2, y-1, z);
// long endTime = System.nanoTime();
//
// long duration = (endTime - startTime); //divide by 1000000 to get milliseconds.
// System.out.println("(Total) method time in ms: " + (float)(duration)/1000000.0);
}
}
}
}
@Override
public int getCostPerRefresh()
{
return 10;
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> autoCraftingRitual = new ArrayList();
this.addCornerRunes(autoCraftingRitual, 1, 1, RitualComponent.EARTH);
this.addParallelRunes(autoCraftingRitual, 1, 1, RitualComponent.EARTH);
autoCraftingRitual.add(new RitualComponent(0, 1, 0, RitualComponent.AIR));
this.addOffsetRunes(autoCraftingRitual, 1, 2, -1, RitualComponent.FIRE);
this.addCornerRunes(autoCraftingRitual, 1, -1, RitualComponent.FIRE);
autoCraftingRitual.add(new RitualComponent(-1, -1, 0, RitualComponent.EARTH));
autoCraftingRitual.add(new RitualComponent(1, -1, 0, RitualComponent.EARTH));
autoCraftingRitual.add(new RitualComponent(0, -1, -1, RitualComponent.EARTH));
autoCraftingRitual.add(new RitualComponent(0, -1, 0, RitualComponent.FIRE));
autoCraftingRitual.add(new RitualComponent(0, -1, 1, RitualComponent.WATER));
return autoCraftingRitual;
}
public boolean areItemsEqualForCrafting(ItemStack stack1, ItemStack stack2)
{
if (stack1 == null || stack2 == null)
{
return false;
}
//
// if (stack1.isItemStackDamageable() ^ stack2.isItemStackDamageable())
// {
// return false;
// }
return stack1.getItem() == stack2.getItem() && (stack1.getItem().getHasSubtypes() ? stack1.getItemDamage() == stack2.getItemDamage() : true);
}
public boolean areItemStacksEqualWithWildcard(ItemStack recipeStack, ItemStack comparedStack)
{
return recipeStack.isItemEqual(comparedStack) || (recipeStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && recipeStack.getItem() == comparedStack.getItem());
}
public Int3 getSlotPositionForDirection(int slot, int direction)
{
int x = slot % 3 - 1;
int z = slot / 3 - 1;
switch(direction)
{
case 1: //NORTH-facing
return new Int3(x, 2, z);
case 2: //EAST-facing
return new Int3(z, 2, -x);
case 3: //SOUTH-facing
return new Int3(-x, 2, -z);
case 4: //WEST-facing
return new Int3(-z, 2, x);
}
return new Int3(0,0,0);
}
}

View file

@ -1,19 +1,20 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectLifeConduit extends RitualEffect
{
@ -50,6 +51,12 @@ public class RitualEffectLifeConduit extends RitualEffect
{
return;
}
if(!(tileAltar instanceof IFluidHandler))
{
return;
}
int d0 = 15;
int vertRange = 20;
@ -69,10 +76,10 @@ public class RitualEffectLifeConduit extends RitualEffect
return;
}
int fillAmount = Math.min(currentEssence / 2, tileAltar.fill(ForgeDirection.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 10000), false));
int fillAmount = Math.min(currentEssence / 2, ((IFluidHandler)tileAltar).fill(ForgeDirection.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 10000), false));
{
tileAltar.fill(ForgeDirection.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid, fillAmount), true);
((IFluidHandler)tileAltar).fill(ForgeDirection.UP, new FluidStack(AlchemicalWizardry.lifeEssenceFluid, fillAmount), true);
if (entityOwner.getHealth() > 2.0f && fillAmount != 0)
{
entityOwner.setHealth(2.0f);

View file

@ -54,8 +54,9 @@ public class RitualEffectOmegaStalling extends RitualEffect
OmegaParadigm parad = OmegaRegistry.getParadigmForReagent(reagent);
if(parad != null)
{
float costOffset = parad.getCostPerTickOfUse(player);
parad.setOmegaStalling(player, 100);
SoulNetworkHandler.syphonFromNetwork(owner, getCostPerRefresh());
SoulNetworkHandler.syphonFromNetwork(owner, (int)(getCostPerRefresh() * Math.min(costOffset, 1)));
}
}
}
@ -86,7 +87,7 @@ public class RitualEffectOmegaStalling extends RitualEffect
this.addParallelRunes(omegaRitual, 4, 4, RitualComponent.WATER);
this.addParallelRunes(omegaRitual, 3, 5, RitualComponent.BLANK);
this.addParallelRunes(omegaRitual, 2, 5, RitualComponent.FIRE);
this.addParallelRunes(omegaRitual, 1, 5, RitualComponent.DUSK);
this.addParallelRunes(omegaRitual, 1, 5, RitualComponent.DAWN);
this.addOffsetRunes(omegaRitual, 5, 3, 1, RitualComponent.WATER);
this.addOffsetRunes(omegaRitual, 6, 3, 1, RitualComponent.DUSK);
this.addOffsetRunes(omegaRitual, 6, 4, 1, RitualComponent.FIRE);

View file

@ -1,14 +1,22 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
@ -23,7 +31,9 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectOmegaTest extends RitualEffect
{
public static final int tickDuration = 1 * 60 * 20;
public static final boolean isTesting = false;
public static final int drainTotal = 32 * 1000;
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
@ -43,27 +53,112 @@ public class RitualEffectOmegaTest extends RitualEffect
OmegaStructureParameters param = OmegaStructureHandler.getStructureStabilityFactor(world, x, y, z, 5, new Int3(0,1,0));
int stab = param.stability;
int enchantability = param.enchantability;
int enchantmentLevel = param.enchantmentLevel;
System.out.println("Stability: " + stab);
if(stab <= 0)
{
return;
}
// System.out.println("Stability: " + stab + ", Enchantability: " + enchantability + ", Enchantment Level: " + enchantmentLevel);
double range = 0.5;
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 1.5, z + 0.5, range, range);
Reagent reagent = null;
Map<Reagent, Integer> reagentMap = new HashMap();
for(int i=0; i<4; i++)
{
Int3 jarLoc = this.getJarLocation(i);
TileEntity tile = world.getTileEntity(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord);
if(tile instanceof IReagentHandler)
{
IReagentHandler container = (IReagentHandler)tile;
ReagentContainerInfo[] containerInfoArray = container.getContainerInfo(ForgeDirection.UP);
if(containerInfoArray == null)
{
continue;
}
for(ReagentContainerInfo containerInfo : containerInfoArray)
{
ReagentStack containedReagent = containerInfo.reagent;
if(containedReagent == null)
{
continue;
}
Reagent rea = containedReagent.reagent;
int amt = containedReagent.amount;
if(reagentMap.containsKey(rea))
{
reagentMap.put(rea, reagentMap.get(rea) + amt);
}else
{
reagentMap.put(rea, amt);
}
}
}
}
for(Entry<Reagent, Integer> entry : reagentMap.entrySet())
{
if(entry.getValue() >= drainTotal)
{
reagent = entry.getKey();
break;
}
}
if(reagent == null)
{
return;
}
int tickDuration = isTesting ? 20 * 30 : 15 * 20 * 60 + (int)((15 * 20 * 60) * Math.sqrt(stab / 700));
int affinity = 0;
for(EntityPlayer player : playerList)
{
Reagent reagent = ReagentRegistry.aetherReagent;
int affinity = 0;
OmegaParadigm waterParadigm = OmegaRegistry.getParadigmForReagent(reagent);
if(waterParadigm != null && waterParadigm.convertPlayerArmour(player, x, y, z, stab, affinity, enchantability))
if(waterParadigm != null && waterParadigm.convertPlayerArmour(player, x, y, z, stab, affinity, enchantability, enchantmentLevel))
{
APISpellHelper.setPlayerCurrentReagentAmount(player, tickDuration);
APISpellHelper.setPlayerMaxReagentAmount(player, tickDuration);
APISpellHelper.setPlayerReagentType(player, reagent);
APISpellHelper.setCurrentAdditionalMaxHP(player, waterParadigm.getMaxAdditionalHealth());
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getReagentBarPacket(reagent, APISpellHelper.getPlayerCurrentReagentAmount(player), APISpellHelper.getPlayerMaxReagentAmount(player)), (EntityPlayerMP)player);
if(!isTesting)
{
int drainLeft = this.drainTotal;
for(int i = 0; i < 4; i++)
{
if(drainLeft <= 0)
{
break;
}
Int3 jarLoc = this.getJarLocation(i);
TileEntity tile = world.getTileEntity(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord);
if(tile instanceof IReagentHandler)
{
IReagentHandler container = (IReagentHandler)tile;
ReagentStack drained = container.drain(ForgeDirection.UP, new ReagentStack(reagent, drainLeft), true);
if(drained != null)
{
drainLeft -= drained.amount;
world.markBlockForUpdate(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord);
world.addWeatherEffect(new EntityLightningBolt(world, x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord));
}
}
}
ritualStone.setActive(false);
}
break;
}
}
}
@ -77,24 +172,70 @@ public class RitualEffectOmegaTest extends RitualEffect
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> animalGrowthRitual = new ArrayList();
animalGrowthRitual.add(new RitualComponent(0, 0, 2, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(2, 0, 0, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(0, 0, -2, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(-2, 0, 0, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(0, 0, 1, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(1, 0, 0, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(0, 0, -1, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(1, 0, 2, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(-1, 0, 2, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(1, 0, -2, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(-1, 0, -2, RitualComponent.WATER));
animalGrowthRitual.add(new RitualComponent(2, 0, 1, RitualComponent.AIR));
animalGrowthRitual.add(new RitualComponent(2, 0, -1, RitualComponent.AIR));
animalGrowthRitual.add(new RitualComponent(-2, 0, 1, RitualComponent.AIR));
animalGrowthRitual.add(new RitualComponent(-2, 0, -1, RitualComponent.AIR));
return animalGrowthRitual;
ArrayList<RitualComponent> omegaRitual = new ArrayList();
this.addCornerRunes(omegaRitual, 1, 0, RitualComponent.DUSK);
this.addCornerRunes(omegaRitual, 2, 0, RitualComponent.DUSK);
this.addCornerRunes(omegaRitual, 3, 0, RitualComponent.BLANK);
this.addCornerRunes(omegaRitual, 4, 0, RitualComponent.DUSK);
this.addCornerRunes(omegaRitual, 5, 0, RitualComponent.BLANK);
this.addParallelRunes(omegaRitual, 1, 0, RitualComponent.DAWN);
this.addParallelRunes(omegaRitual, 2, 0, RitualComponent.BLANK);
this.addParallelRunes(omegaRitual, 4, 0, RitualComponent.BLANK);
this.addParallelRunes(omegaRitual, 5, 0, RitualComponent.DAWN);
this.addOffsetRunes(omegaRitual, 1, 3, 0, RitualComponent.DUSK);
this.addOffsetRunes(omegaRitual, 1, 5, 0, RitualComponent.DUSK);
for(int i=2; i<=4; i++)
{
omegaRitual.add(new RitualComponent(-5, 0, i, RitualComponent.WATER));
omegaRitual.add(new RitualComponent(-5, 0, -i, RitualComponent.WATER));
omegaRitual.add(new RitualComponent(5, 0, i, RitualComponent.FIRE));
omegaRitual.add(new RitualComponent(5, 0, -i, RitualComponent.FIRE));
omegaRitual.add(new RitualComponent(i, 0, -5, RitualComponent.EARTH));
omegaRitual.add(new RitualComponent(-i, 0, -5, RitualComponent.EARTH));
omegaRitual.add(new RitualComponent(i, 0, 5, RitualComponent.AIR));
omegaRitual.add(new RitualComponent(-i, 0, 5, RitualComponent.AIR));
}
for(int i=2; i<=3; i++)
{
omegaRitual.add(new RitualComponent(4, 0, i, RitualComponent.WATER));
omegaRitual.add(new RitualComponent(4, 0, -i, RitualComponent.WATER));
omegaRitual.add(new RitualComponent(-4, 0, i, RitualComponent.FIRE));
omegaRitual.add(new RitualComponent(-4, 0, -i, RitualComponent.FIRE));
omegaRitual.add(new RitualComponent(i, 0, 4, RitualComponent.EARTH));
omegaRitual.add(new RitualComponent(-i, 0, 4, RitualComponent.EARTH));
omegaRitual.add(new RitualComponent(i, 0, -4, RitualComponent.AIR));
omegaRitual.add(new RitualComponent(-i, 0, -4, RitualComponent.AIR));
}
omegaRitual.add(new RitualComponent(-2, 0, 1, RitualComponent.AIR));
omegaRitual.add(new RitualComponent(-2, 0, -1, RitualComponent.AIR));
omegaRitual.add(new RitualComponent(-4, 0, 1, RitualComponent.AIR));
omegaRitual.add(new RitualComponent(-4, 0, -1, RitualComponent.AIR));
omegaRitual.add(new RitualComponent(2, 0, 1, RitualComponent.EARTH));
omegaRitual.add(new RitualComponent(2, 0, -1, RitualComponent.EARTH));
omegaRitual.add(new RitualComponent(4, 0, 1, RitualComponent.EARTH));
omegaRitual.add(new RitualComponent(4, 0, -1, RitualComponent.EARTH));
omegaRitual.add(new RitualComponent(1, 0, 2, RitualComponent.FIRE));
omegaRitual.add(new RitualComponent(-1, 0, 2, RitualComponent.FIRE));
omegaRitual.add(new RitualComponent(1, 0, 4, RitualComponent.FIRE));
omegaRitual.add(new RitualComponent(-1, 0, 4, RitualComponent.FIRE));
omegaRitual.add(new RitualComponent(1, 0, -2, RitualComponent.WATER));
omegaRitual.add(new RitualComponent(-1, 0, -2, RitualComponent.WATER));
omegaRitual.add(new RitualComponent(1, 0, -4, RitualComponent.WATER));
omegaRitual.add(new RitualComponent(-1, 0, -4, RitualComponent.WATER));
omegaRitual.add(new RitualComponent(-3, 0, 2, RitualComponent.FIRE));
omegaRitual.add(new RitualComponent(-3, 0, -2, RitualComponent.FIRE));
omegaRitual.add(new RitualComponent(3, 0, 2, RitualComponent.WATER));
omegaRitual.add(new RitualComponent(3, 0, -2, RitualComponent.WATER));
omegaRitual.add(new RitualComponent(-2, 0, -3, RitualComponent.AIR));
omegaRitual.add(new RitualComponent(2, 0, -3, RitualComponent.AIR));
omegaRitual.add(new RitualComponent(-2, 0, 3, RitualComponent.EARTH));
omegaRitual.add(new RitualComponent(2, 0, 3, RitualComponent.EARTH));
return omegaRitual;
}
public Int3 getJarLocation(int i)
@ -102,13 +243,13 @@ public class RitualEffectOmegaTest extends RitualEffect
switch(i)
{
case 0:
return new Int3(-3,1,0);
return new Int3(-3,0,0);
case 1:
return new Int3(3,1,0);
return new Int3(3,0,0);
case 2:
return new Int3(0,1,-3);
return new Int3(0,0,-3);
case 3:
return new Int3(0,1,3);
return new Int3(0,0,3);
default:
return new Int3(0,0,0);
}

View file

@ -66,9 +66,13 @@ public class RitualEffectSoulBound extends RitualEffect
if (BindingRegistry.isRequiredItemValid(itemStack))
{
ritualStone.setVar1(BindingRegistry.getIndexForItem(itemStack) + 1);
itemStack.stackSize--;
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 1, z));
ritualStone.setCooldown(ritualStone.getCooldown() - 1);
item.setDead();
if(itemStack.stackSize <= 0)
{
item.setDead();
}
break;
}

View file

@ -1,6 +1,7 @@
package WayofTime.alchemicalWizardry.common.rituals;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
@ -19,6 +20,10 @@ public class RitualEffectWellOfSuffering extends RitualEffect
{
public static final int timeDelay = 25;
public static final int amount = 10;
private static final int tennebraeDrain = 5;
private static final int potentiaDrain = 10;
private static final int offensaDrain = 3;
@Override
public void performEffect(IMasterRitualStone ritualStone)
@ -58,13 +63,17 @@ public class RitualEffectWellOfSuffering extends RitualEffect
{
return;
}
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
int d0 = 10;
int vertRange = 10;
int vertRange = hasPotentia ? 20 : 10;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, vertRange, d0);
List<EntityLivingBase> list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
int entityCount = 0;
boolean hasTennebrae = this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, false);
boolean hasOffensa = this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false);
if (currentEssence < this.getCostPerRefresh() * list.size())
{
@ -78,14 +87,24 @@ public class RitualEffectWellOfSuffering extends RitualEffect
continue;
}
if (livingEntity.attackEntityFrom(DamageSource.outOfWorld, 1))
hasOffensa = hasOffensa && this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true);
if (livingEntity.attackEntityFrom(DamageSource.outOfWorld, hasOffensa ? 2 : 1))
{
hasTennebrae = hasTennebrae && this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, true);
entityCount++;
tileAltar.sacrificialDaggerCall(this.amount, true);
tileAltar.sacrificialDaggerCall(this.amount * (hasTennebrae ? 2 : 1) * (hasOffensa ? 2 : 1), true);
}
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount);
if(hasPotentia)
{
this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
}
}
}

View file

@ -466,9 +466,7 @@ public class SpellHelper
return false;
}
boolean tagsEqual = ItemStack.areItemStackTagsEqual(stack1, stack2);
return stack1.getItem() == stack2.getItem() && tagsEqual && stack1.getItemDamage() == stack2.getItemDamage();
return stack1.getItem() == stack2.getItem() && stack1.getItemDamage() == stack2.getItemDamage() && ItemStack.areItemStackTagsEqual(stack1, stack2);
}
/**
@ -547,13 +545,13 @@ public class SpellHelper
int[] array = ((ISidedInventory)inventory).getAccessibleSlotsFromSide(dir.ordinal());
for(int in : array)
{
canBeInserted[in] = ((ISidedInventory)inventory).canInsertItem(in, stack, dir.ordinal());
canBeInserted[in] = inventory.isItemValidForSlot(in, stack) && ((ISidedInventory)inventory).canInsertItem(in, stack, dir.ordinal());
}
}else
{
for(int i=0; i<canBeInserted.length; i++)
{
canBeInserted[i] = true;
canBeInserted[i] = inventory.isItemValidForSlot(i, stack);
}
}
@ -577,6 +575,92 @@ public class SpellHelper
return stack;
}
public static boolean canInsertStackFullyIntoInventory(ItemStack stack, IInventory inventory, ForgeDirection dir)
{
return canInsertStackFullyIntoInventory(stack, inventory, dir, false, 0);
}
public static boolean canInsertStackFullyIntoInventory(ItemStack stack, IInventory inventory, ForgeDirection dir, boolean fillToLimit, int limit)
{
if (stack == null)
{
return true;
}
int itemsLeft = stack.stackSize;
boolean[] canBeInserted = new boolean[inventory.getSizeInventory()];
if(inventory instanceof ISidedInventory)
{
int[] array = ((ISidedInventory)inventory).getAccessibleSlotsFromSide(dir.ordinal());
for(int in : array)
{
canBeInserted[in] = inventory.isItemValidForSlot(in, stack) && ((ISidedInventory)inventory).canInsertItem(in, stack, dir.ordinal());
}
}else
{
for(int i=0; i<canBeInserted.length; i++)
{
canBeInserted[i] = inventory.isItemValidForSlot(i, stack);
}
}
int numberMatching = 0;
if(fillToLimit)
{
for (int i = 0; i < inventory.getSizeInventory(); i++)
{
if(!canBeInserted[i])
{
continue;
}
ItemStack invStack = inventory.getStackInSlot(i);
if(invStack != null && canCombine(stack, invStack))
{
numberMatching += invStack.stackSize;
}
}
}
if(fillToLimit && limit < stack.stackSize + numberMatching)
{
return false;
}
for (int i = 0; i < inventory.getSizeInventory(); i++)
{
if(!canBeInserted[i])
{
continue;
}
ItemStack invStack = inventory.getStackInSlot(i);
boolean canCombine = canCombine(stack, invStack);
if(canCombine)
{
if(invStack == null)
{
itemsLeft = 0;
}else
{
itemsLeft -= (invStack.getMaxStackSize() - invStack.stackSize);
}
}
if(itemsLeft <= 0)
{
return true;
}
}
return false;
}
public static ItemStack insertStackIntoInventory(ItemStack stack, IInventory inventory, ForgeDirection dir, int limit)
{
if (stack == null)

View file

@ -4,18 +4,15 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
@ -352,7 +349,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
return 0;
}
if (resource.fluidID != (new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 1)).fluidID)
if (resource.getFluidID() != (new FluidStack(AlchemicalWizardry.lifeEssenceFluid, 1)).getFluidID())
{
return 0;
}
@ -917,7 +914,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
sortList[1] = 0;
} else
{
sortList[0] = this.fluid.fluidID;
sortList[0] = this.fluid.getFluidID();
sortList[1] = this.fluid.amount;
}
@ -927,7 +924,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
sortList[3] = 0;
} else
{
sortList[2] = this.fluidInput.fluidID;
sortList[2] = this.fluidInput.getFluidID();
sortList[3] = this.fluidInput.amount;
}
@ -937,7 +934,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
sortList[5] = 0;
} else
{
sortList[4] = this.fluidOutput.fluidID;
sortList[4] = this.fluidOutput.getFluidID();
sortList[5] = this.fluidOutput.amount;
}

View file

@ -10,144 +10,146 @@ import net.minecraftforge.common.util.Constants;
/**
* Base class for tile entities with inventory
*
* @author ljfa-ag
*/
public abstract class TEInventory extends TileEntity implements IInventory
{
protected ItemStack[] inv;
public TEInventory(int size)
{
inv = new ItemStack[size];
}
protected ItemStack[] inv;
@Override
public int getSizeInventory()
{
return inv.length;
}
public TEInventory(int size)
{
inv = new ItemStack[size];
}
public ItemStack[] getSlots()
{
return inv;
}
@Override
public int getSizeInventory()
{
return inv.length;
}
@Override
public ItemStack getStackInSlot(int slot)
{
return inv[slot];
}
public ItemStack[] getSlots()
{
return inv;
}
@Override
public ItemStack decrStackSize(int slot, int amt)
{
ItemStack stack = getStackInSlot(slot);
if (stack != null)
{
if (stack.stackSize <= amt)
setInventorySlotContents(slot, null);
else
{
stack = stack.splitStack(amt);
if (stack.stackSize == 0)
setInventorySlotContents(slot, null);
}
}
return stack;
}
@Override
public ItemStack getStackInSlot(int slot)
{
return inv[slot];
}
@Override
public ItemStack getStackInSlotOnClosing(int slot)
{
ItemStack stack = getStackInSlot(slot);
if (stack != null)
setInventorySlotContents(slot, null);
return stack;
}
@Override
public ItemStack decrStackSize(int slot, int amt)
{
ItemStack stack = getStackInSlot(slot);
if (stack != null)
{
if (stack.stackSize <= amt)
setInventorySlotContents(slot, null);
else
{
stack = stack.splitStack(amt);
if (stack.stackSize == 0)
setInventorySlotContents(slot, null);
}
}
return stack;
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack)
{
inv[slot] = stack;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
if (stack != null && stack.stackSize > getInventoryStackLimit())
stack.stackSize = getInventoryStackLimit();
}
@Override
public ItemStack getStackInSlotOnClosing(int slot)
{
ItemStack stack = getStackInSlot(slot);
if (stack != null)
setInventorySlotContents(slot, null);
return stack;
}
@Override
public abstract String getInventoryName();
@Override
public void setInventorySlotContents(int slot, ItemStack stack)
{
inv[slot] = stack;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
if (stack != null && stack.stackSize > getInventoryStackLimit())
stack.stackSize = getInventoryStackLimit();
}
@Override
public boolean hasCustomInventoryName()
{
return false;
}
@Override
public abstract String getInventoryName();
@Override
public int getInventoryStackLimit()
{
return 64;
}
@Override
public boolean hasCustomInventoryName()
{
return false;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player)
{
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this
&& player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
}
@Override
public int getInventoryStackLimit()
{
return 64;
}
@Override
public void openInventory()
{
}
@Override
public boolean isUseableByPlayer(EntityPlayer player)
{
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this
&& player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
}
@Override
public void closeInventory()
{
}
@Override
public void openInventory()
{
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack)
{
return true;
}
@Override
public void closeInventory()
{
}
@Override
public void writeToNBT(NBTTagCompound tag)
{
super.writeToNBT(tag);
NBTTagList invList = new NBTTagList();
for (int i = 0; i < inv.length; i++)
{
if (inv[i] != null)
{
NBTTagCompound stackTag = new NBTTagCompound();
stackTag.setByte("Slot", (byte) i);
inv[i].writeToNBT(stackTag);
invList.appendTag(stackTag);
}
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack)
{
return true;
}
tag.setTag("Inventory", invList);
}
@Override
public void readFromNBT(NBTTagCompound tag)
{
super.readFromNBT(tag);
NBTTagList invList = tag.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
for(int i = 0; i < invList.tagCount(); i++)
@Override
public void writeToNBT(NBTTagCompound tag)
{
super.writeToNBT(tag);
NBTTagList invList = new NBTTagList();
for (int i = 0; i < inv.length; i++)
{
if (inv[i] != null)
{
NBTTagCompound stackTag = new NBTTagCompound();
stackTag.setByte("Slot", (byte) i);
inv[i].writeToNBT(stackTag);
invList.appendTag(stackTag);
}
}
tag.setTag("Inventory", invList);
}
@Override
public void readFromNBT(NBTTagCompound tag)
{
super.readFromNBT(tag);
NBTTagList invList = tag.getTagList("Inventory",
Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < invList.tagCount(); i++)
{
NBTTagCompound stackTag = invList.getCompoundTagAt(i);
int slot = stackTag.getByte("Slot");
if(slot >= 0 && slot < inv.length)
if (slot >= 0 && slot < inv.length)
inv[slot] = ItemStack.loadItemStackFromNBT(stackTag);
}
}
public void clear()
{
}
public void clear()
{
inv = new ItemStack[inv.length];
}
}

View file

@ -1,17 +1,12 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.Constants;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class TEPedestal extends TEInventory
{

View file

@ -1,14 +1,9 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistryComponent;
import WayofTime.alchemicalWizardry.common.IDemon;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.PlinthComponent;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -18,9 +13,12 @@ import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistryComponent;
import WayofTime.alchemicalWizardry.common.IDemon;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.PlinthComponent;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
public class TEPlinth extends TEInventory
{

View file

@ -1,16 +1,11 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.Constants;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
public class TESocket extends TEInventory
{

View file

@ -1,24 +1,19 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import java.util.Iterator;
import java.util.List;
public class TETeleposer extends TEInventory
{

View file

@ -1,15 +1,10 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
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 net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.ModItems;