mirror of
https://github.com/GTNewHorizons/BloodArsenal.git
synced 2026-11-28 23:58:42 +00:00
1.1-8 Update
This commit is contained in:
1 parent
b7feb8de01
commit
4958dd9187
26 files changed
+1247
-101
No files matched your search
@@ -4,6 +4,9 @@ import com.arc.bloodarsenal.entity.ModEntities;
|
||||
import com.arc.bloodarsenal.entity.ModLivingDropsEvent;
|
||||
import com.arc.bloodarsenal.gui.GuiHandler;
|
||||
import com.arc.bloodarsenal.items.ModItems;
|
||||
import com.arc.bloodarsenal.items.sigil.SigilUtils;
|
||||
import com.arc.bloodarsenal.items.sigil.holding.AHPacketHandler;
|
||||
import com.arc.bloodarsenal.items.tinkers.BloodArsenalModifiers;
|
||||
import com.arc.bloodarsenal.items.tinkers.BloodArsenalTinkers;
|
||||
import com.arc.bloodarsenal.items.tinkers.RecipeHelper;
|
||||
import com.arc.bloodarsenal.misc.CommandDownloadMod;
|
||||
@@ -67,6 +70,7 @@ public class BloodArsenal
|
||||
}
|
||||
};
|
||||
|
||||
public static final AHPacketHandler packetPipeline = new AHPacketHandler();
|
||||
public static DamageSource deathFromBlood = (new DamageSource("deathFromBlood")).setDamageBypassesArmor();
|
||||
|
||||
public static boolean isHalloween()
|
||||
@@ -121,6 +125,7 @@ public class BloodArsenal
|
||||
MinecraftForge.EVENT_BUS.register(eventHook);
|
||||
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
|
||||
AHPacketHandler.init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
@@ -157,8 +162,8 @@ public class BloodArsenal
|
||||
{
|
||||
logger.info("Loaded Tinker's Construct integration");
|
||||
|
||||
BloodArsenalTinkers.addMaterials();
|
||||
BloodArsenalTinkers.addParts();
|
||||
BloodArsenalTinkers.init();
|
||||
BloodArsenalModifiers.init();
|
||||
RecipeHelper.addRecipes();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +91,8 @@ public class BloodArsenalRecipes
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_ender), "aba", "cdc", "efe", 'a', Blocks.obsidian, 'b', Items.ender_eye, 'c', Items.ender_pearl, 'd', imbuedSlate, 'e', Blocks.ender_chest, 'f', magicianOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_divinity), "aba", "cde", "fgf", 'a', ModBlocks.blood_infused_glowstone, 'b', new ItemStack(Items.golden_apple, 1, 1), 'c', Items.nether_star, 'd', WayofTime.alchemicalWizardry.ModItems.sigilOfElementalAffinity, 'e', ModItems.blood_infused_diamond_bound, 'f', ModItems.amorphic_catalyst, 'g', transcendentOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.blood_burned_string, 4), "aaa", "aba", "aaa", 'a', Items.string, 'b', weakOrb);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_augmented_holding), "aba", "cde", "fgf", 'a', demonicSlate, 'b', masterOrb, 'c', Items.blaze_rod, 'd', WayofTime.alchemicalWizardry.ModItems.sigilOfHolding, 'e', Items.ghast_tear, 'f', ModItems.blood_infused_iron, 'g', Blocks.chest);
|
||||
addOreDictBloodOrbRecipe(new ItemStack(ModItems.sigil_of_lightning), "aba", "cdc", "efg", 'a', new ItemStack(ModBlocks.blood_stone, 1, 3), 'b', Blocks.iron_block, 'c', ModBlocks.blood_infused_iron_block, 'd', etherealSlate, 'e', Items.nether_star, 'f', archmageOrb, 'g', ModItems.blood_infused_diamond_bound);
|
||||
|
||||
addOreDictRecipe(new ItemStack(ModBlocks.blood_stone), "aaa", "aaa", "aaa", 'a', blankSlate);
|
||||
addOreDictRecipe(new ItemStack(ModBlocks.blood_stone, 1, 1), "aaa", "aaa", "aaa", 'a', reinforcedSlate);
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.arc.bloodarsenal.entity.mob.EntityBloodHound;
|
||||
import com.arc.bloodarsenal.entity.projectile.EntityBloodBall;
|
||||
import com.arc.bloodarsenal.entity.projectile.EntityGatlingProjectile;
|
||||
import com.arc.bloodarsenal.items.ModItems;
|
||||
import com.arc.bloodarsenal.items.sigil.SigilUtils;
|
||||
import com.arc.bloodarsenal.misc.VersionChecker;
|
||||
import com.arc.bloodarsenal.renderer.block.*;
|
||||
import com.arc.bloodarsenal.renderer.entity.RenderEntityBloodHound;
|
||||
@@ -25,6 +26,7 @@ import net.minecraft.client.renderer.entity.RenderTNTPrimed;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
@@ -63,6 +65,8 @@ public class ClientProxy extends CommonProxy
|
||||
{
|
||||
new VersionChecker().init();
|
||||
}
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new SigilUtils());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.arc.bloodarsenal.gui;
|
||||
|
||||
import com.arc.bloodarsenal.BloodArsenal;
|
||||
import com.arc.bloodarsenal.items.sigil.holding.ContainerAugmentedHolding;
|
||||
import com.arc.bloodarsenal.items.sigil.holding.GuiAugmentedHolding;
|
||||
import com.arc.bloodarsenal.items.sigil.holding.InventoryAugmentedHolding;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
@@ -10,17 +12,24 @@ public class GuiHandler implements IGuiHandler
|
||||
@Override
|
||||
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
return new ContainerAugmentedHolding(player, new InventoryAugmentedHolding(player.getHeldItem()));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
if (id == 0)
|
||||
switch (id)
|
||||
{
|
||||
BloodArsenal.logger.info("Open Gui");
|
||||
// return new ItemGuiBaseBook();
|
||||
case 0:
|
||||
return new GuiAugmentedHolding(player, new InventoryAugmentedHolding(player.getHeldItem()));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,8 @@ import com.arc.bloodarsenal.BloodArsenal;
|
||||
import com.arc.bloodarsenal.block.ModBlocks;
|
||||
import com.arc.bloodarsenal.items.armor.VampireCostume;
|
||||
import com.arc.bloodarsenal.items.bauble.*;
|
||||
import com.arc.bloodarsenal.items.sigil.SigilDivinity;
|
||||
import com.arc.bloodarsenal.items.sigil.SigilEnder;
|
||||
import com.arc.bloodarsenal.items.sigil.SigilSwimming;
|
||||
import com.arc.bloodarsenal.items.sigil.*;
|
||||
import com.arc.bloodarsenal.items.sigil.holding.SigilAugmentedHolding;
|
||||
import com.arc.bloodarsenal.items.tool.*;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -65,6 +64,8 @@ public class ModItems
|
||||
public static Item glass_shard;
|
||||
public static Item empowered_sacrifice_amulet;
|
||||
public static Item empowered_self_sacrifice_amulet;
|
||||
public static Item sigil_of_augmented_holding;
|
||||
public static Item sigil_of_lightning;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
@@ -113,6 +114,8 @@ public class ModItems
|
||||
blood_money = registerItem(new ItemBloodMoney(), "blood_money");
|
||||
blood_burned_string = registerItem(new ItemReed(ModBlocks.block_burned_string), "blood_burned_string");
|
||||
glass_shard = registerItem(new ItemBloodArsenal(), "glass_shard");
|
||||
sigil_of_augmented_holding = registerItem(new SigilAugmentedHolding(), "sigil_of_augmented_holding");
|
||||
sigil_of_lightning = registerItem(new SigilLightning(), "sigil_of_lightning");
|
||||
|
||||
vampire_ring = new VampireRing();
|
||||
self_sacrifice_amulet = new SelfSacrificeAmulet();
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.arc.bloodarsenal.items.sigil;
|
||||
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EnderSigilUtils
|
||||
{
|
||||
public static MovingObjectPosition getTargetBlock(World world, double x, double y, double z, float yaw, float pitch, boolean par3, double range)
|
||||
{
|
||||
Vec3 var13 = Vec3.createVectorHelper(x, y, z);
|
||||
float var14 = MathHelper.cos(-yaw * 0.01745329F - 3.141593F);
|
||||
float var15 = MathHelper.sin(-yaw * 0.01745329F - 3.141593F);
|
||||
float var16 = -MathHelper.cos(-pitch * 0.01745329F);
|
||||
float var17 = MathHelper.sin(-pitch * 0.01745329F);
|
||||
float var18 = var15 * var16;
|
||||
float var20 = var14 * var16;
|
||||
Vec3 var23 = var13.addVector(var18 * range, var17 * range, var20 * range);
|
||||
|
||||
return world.func_147447_a(var13, var23, par3, !par3, false);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.arc.bloodarsenal.items.sigil;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import com.arc.bloodarsenal.BloodArsenal;
|
||||
import com.arc.bloodarsenal.BloodArsenalConfig;
|
||||
@@ -20,7 +21,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SigilDivinity extends EnergyItems implements ArmourUpgrade, IBindable
|
||||
public class SigilDivinity extends EnergyItems implements ArmourUpgrade, IBindable, ISigil
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon activeIcon;
|
||||
@@ -31,8 +32,6 @@ public class SigilDivinity extends EnergyItems implements ArmourUpgrade, IBindab
|
||||
{
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("sigil_of_divinity");
|
||||
setCreativeTab(BloodArsenal.BA_TAB);
|
||||
setEnergyUsed(50000);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.arc.bloodarsenal.items.sigil;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import com.arc.bloodarsenal.BloodArsenal;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.util.Vec3;
|
||||
@@ -14,15 +13,12 @@ import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SigilEnder extends EnergyItems implements IBindable
|
||||
public class SigilEnder extends EnergyItems implements IBindable, ISigil
|
||||
{
|
||||
public SigilEnder()
|
||||
{
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("sigil_of_ender");
|
||||
setTextureName("BloodArsenal:sigil_of_ender");
|
||||
setCreativeTab(BloodArsenal.BA_TAB);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,7 +47,7 @@ public class SigilEnder extends EnergyItems implements IBindable
|
||||
|
||||
if (player.isSneaking() && !player.isSwingInProgress)
|
||||
{
|
||||
MovingObjectPosition mop = EnderSigilUtils.getTargetBlock(world, (player.prevPosX + (player.posX - player.prevPosX)),
|
||||
MovingObjectPosition mop = SigilUtils.getTargetBlock(world, (player.prevPosX + (player.posX - player.prevPosX)),
|
||||
(player.prevPosY + (player.posY - player.prevPosY) + 1.62 - player.yOffset),
|
||||
(player.prevPosZ + (player.posZ - player.prevPosZ)),
|
||||
(player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw)),
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
package com.arc.bloodarsenal.items.sigil;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SigilLightning extends EnergyItems implements IBindable, ISigil
|
||||
{
|
||||
public SigilLightning()
|
||||
{
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
int mode = par1ItemStack.getItemDamage();
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.sigil.lightning"));
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.sigil.lightning2") + (mode + 1));
|
||||
|
||||
if (!(par1ItemStack.stackTagCompound == null))
|
||||
{
|
||||
par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
|
||||
{
|
||||
EnergyItems.checkAndSetItemOwner(itemStack, player);
|
||||
|
||||
if (itemStack.stackTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if (player.isSneaking())
|
||||
{
|
||||
if (!player.isSwingInProgress)
|
||||
{
|
||||
changeMode(itemStack, true);
|
||||
}
|
||||
|
||||
if (world.isRemote)
|
||||
{
|
||||
int mode = itemStack.getItemDamage();
|
||||
IChatComponent chatComponent = new ChatComponentText(StatCollector.translateToLocal("tooltip.sigil.lightning2") + (mode + 1));
|
||||
player.addChatComponentMessage(chatComponent);
|
||||
}
|
||||
|
||||
player.swingItem();
|
||||
}
|
||||
else
|
||||
{
|
||||
int mode = itemStack.getItemDamage();
|
||||
MovingObjectPosition mop = SigilUtils.getTargetBlock(world, (player.prevPosX + (player.posX - player.prevPosX)),
|
||||
(player.prevPosY + (player.posY - player.prevPosY) + 1.62 - player.yOffset),
|
||||
(player.prevPosZ + (player.posZ - player.prevPosZ)),
|
||||
(player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw)),
|
||||
(player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch)), false, 128.0);
|
||||
|
||||
if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && mop.sideHit != -1)
|
||||
{
|
||||
double ex = mop.hitVec.xCoord;
|
||||
double wy = mop.hitVec.yCoord;
|
||||
double zee = mop.hitVec.zCoord;
|
||||
|
||||
switch (mop.sideHit)
|
||||
{
|
||||
case 0:
|
||||
wy -= 2.0;
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
zee -= 0.5;
|
||||
break;
|
||||
case 3:
|
||||
zee += 0.5;
|
||||
break;
|
||||
case 4:
|
||||
ex -= 0.5;
|
||||
break;
|
||||
case 5:
|
||||
ex += 0.5;
|
||||
break;
|
||||
}
|
||||
|
||||
int cost = 0;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
cost = 8000;
|
||||
break;
|
||||
case 1:
|
||||
cost = 32000;
|
||||
break;
|
||||
case 2:
|
||||
cost = 54000;
|
||||
break;
|
||||
case 3:
|
||||
cost = 104000;
|
||||
break;
|
||||
case 4:
|
||||
cost = 168000;
|
||||
break;
|
||||
}
|
||||
|
||||
if (EnergyItems.getCurrentEssence(itemStack.getTagCompound().getString("ownerName")) >= cost || player.capabilities.isCreativeMode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex, wy, zee));
|
||||
break;
|
||||
case 1:
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex, wy, zee));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 1, wy, zee));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex, wy, zee + 1));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 1, wy, zee + 1));
|
||||
break;
|
||||
case 2:
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex, wy, zee));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 2, wy, zee));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 2, wy, zee));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 1, wy, zee + 2));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 1, wy, zee + 2));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 1, wy, zee - 2));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 1, wy, zee - 2));
|
||||
break;
|
||||
case 3:
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex, wy, zee));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 3, wy, zee));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 3, wy, zee));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 2, wy, zee + 2));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 2, wy, zee - 2));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 2, wy, zee + 2));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 2, wy, zee - 2));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex, wy, zee + 3));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex, wy, zee - 3));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 1, wy, zee + 1));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 1, wy, zee - 1));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 1, wy, zee + 1));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 1, wy, zee - 1));
|
||||
break;
|
||||
case 4:
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex, wy, zee));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 3, wy, zee));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 3, wy, zee));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 2, wy, zee + 2));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 2, wy, zee - 2));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 2, wy, zee + 2));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 2, wy, zee - 2));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex, wy, zee + 3));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex, wy, zee - 3));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 1, wy, zee + 1));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 1, wy, zee - 1));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 1, wy, zee + 1));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 1, wy, zee - 1));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 7, wy, zee));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 5, wy, zee + 5));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex, wy, zee + 7));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex + 5, wy, zee - 5));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 7, wy, zee));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 5, wy, zee - 5));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex, wy, zee - 7));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, ex - 5, wy, zee + 5));
|
||||
break;
|
||||
}
|
||||
|
||||
player.swingItem();
|
||||
EnergyItems.syphonBatteries(itemStack, player, cost);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
private void changeMode(ItemStack itemStack, boolean next)
|
||||
{
|
||||
int mode = itemStack.getItemDamage();
|
||||
if (next)
|
||||
{
|
||||
if (mode < 4)
|
||||
{
|
||||
mode++;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
itemStack.setItemDamage(mode);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.arc.bloodarsenal.items.sigil;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import com.arc.bloodarsenal.BloodArsenal;
|
||||
import com.arc.bloodarsenal.BloodArsenalConfig;
|
||||
@@ -19,7 +20,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SigilSwimming extends EnergyItems implements ArmourUpgrade, IBindable
|
||||
public class SigilSwimming extends EnergyItems implements ArmourUpgrade, IBindable, ISigil
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon activeIcon;
|
||||
@@ -30,8 +31,6 @@ public class SigilSwimming extends EnergyItems implements ArmourUpgrade, IBindab
|
||||
{
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("sigil_of_swimming");
|
||||
setCreativeTab(BloodArsenal.BA_TAB);
|
||||
setEnergyUsed(100);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.arc.bloodarsenal.items.sigil;
|
||||
|
||||
import com.arc.bloodarsenal.items.sigil.holding.AHPacketHandler;
|
||||
import com.arc.bloodarsenal.items.sigil.holding.AHPacketProcessor;
|
||||
import com.arc.bloodarsenal.items.sigil.holding.SigilAugmentedHolding;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.MouseEvent;
|
||||
|
||||
public class SigilUtils
|
||||
{
|
||||
public static MovingObjectPosition getTargetBlock(World world, double x, double y, double z, float yaw, float pitch, boolean par3, double range)
|
||||
{
|
||||
Vec3 var13 = Vec3.createVectorHelper(x, y, z);
|
||||
float var14 = MathHelper.cos(-yaw * 0.01745329F - 3.141593F);
|
||||
float var15 = MathHelper.sin(-yaw * 0.01745329F - 3.141593F);
|
||||
float var16 = -MathHelper.cos(-pitch * 0.01745329F);
|
||||
float var17 = MathHelper.sin(-pitch * 0.01745329F);
|
||||
float var18 = var15 * var16;
|
||||
float var20 = var14 * var16;
|
||||
Vec3 var23 = var13.addVector(var18 * range, var17 * range, var20 * range);
|
||||
|
||||
return world.func_147447_a(var13, var23, par3, !par3, false);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onMouseEvent(MouseEvent event)
|
||||
{
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if (event.dwheel != 0 && player != null && player.isSneaking())
|
||||
{
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
if (stack != null)
|
||||
{
|
||||
Item item = stack.getItem();
|
||||
|
||||
if (item instanceof SigilAugmentedHolding)
|
||||
{
|
||||
cycleSigil(stack, player, event.dwheel);
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void cycleSigil(ItemStack stack, EntityPlayer player, int dWheel)
|
||||
{
|
||||
int mode = SigilAugmentedHolding.getCurrentItem(stack);
|
||||
mode = dWheel < 0 ? SigilAugmentedHolding.next(mode) : SigilAugmentedHolding.prev(mode);
|
||||
SigilAugmentedHolding.cycleSigil(stack, mode);
|
||||
AHPacketHandler.INSTANCE.sendToServer(new AHPacketProcessor(player.inventory.currentItem, mode));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.bloodarsenal.items.sigil.holding;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class AHPacketHandler
|
||||
{
|
||||
public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel("AugmentedHolding");
|
||||
|
||||
public static void init()
|
||||
{
|
||||
INSTANCE.registerMessage(AHPacketProcessor.class, AHPacketProcessor.class, 0, Side.SERVER);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.arc.bloodarsenal.items.sigil.holding;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AHPacketProcessor implements IMessage, IMessageHandler<AHPacketProcessor, IMessage>
|
||||
{
|
||||
private int slot;
|
||||
private int mode;
|
||||
|
||||
public AHPacketProcessor() {}
|
||||
|
||||
public AHPacketProcessor(int slot, int mode)
|
||||
{
|
||||
this.slot = slot;
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buffer)
|
||||
{
|
||||
buffer.writeInt(slot);
|
||||
buffer.writeInt(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buffer)
|
||||
{
|
||||
slot = buffer.readInt();
|
||||
mode = buffer.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(AHPacketProcessor message, MessageContext ctx)
|
||||
{
|
||||
ItemStack itemStack = null;
|
||||
|
||||
if (message.slot > -1 && message.slot < 9)
|
||||
{
|
||||
itemStack = ctx.getServerHandler().playerEntity.inventory.getStackInSlot(message.slot);
|
||||
}
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
SigilAugmentedHolding.cycleSigil(itemStack, message.mode);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
package com.arc.bloodarsenal.items.sigil.holding;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerAugmentedHolding extends Container
|
||||
{
|
||||
protected final int PLAYER_INVENTORY_ROWS = 3;
|
||||
protected final int PLAYER_INVENTORY_COLUMNS = 9;
|
||||
|
||||
private int inventoryColumns = 9;
|
||||
|
||||
private final EntityPlayer player;
|
||||
public final InventoryAugmentedHolding inventoryHolding;
|
||||
|
||||
public ContainerAugmentedHolding(EntityPlayer player, InventoryAugmentedHolding inventoryHolding)
|
||||
{
|
||||
this.player = player;
|
||||
this.inventoryHolding = inventoryHolding;
|
||||
int currentSlotHeldIn = player.inventory.currentItem;
|
||||
|
||||
for (int columnIndex = 0; columnIndex < inventoryColumns; ++columnIndex)
|
||||
{
|
||||
this.addSlotToContainer(new SlotHolding(this, inventoryHolding, player, columnIndex, 8 + columnIndex * 18, 15));
|
||||
}
|
||||
|
||||
for (int rowIndex = 0; rowIndex < PLAYER_INVENTORY_ROWS; ++rowIndex)
|
||||
{
|
||||
for (int columnIndex = 0; columnIndex < PLAYER_INVENTORY_COLUMNS; ++columnIndex)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, columnIndex + rowIndex * 9 + 9, 8 + columnIndex * 18, 39 + rowIndex * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int actionBarIndex = 0; actionBarIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarIndex)
|
||||
{
|
||||
if (actionBarIndex == currentSlotHeldIn)
|
||||
{
|
||||
this.addSlotToContainer(new SlotDisabled(player.inventory, actionBarIndex, 8 + actionBarIndex * 18, 97));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, actionBarIndex, 8 + actionBarIndex * 18, 97));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityPlayer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer entityPlayer)
|
||||
{
|
||||
super.onContainerClosed(entityPlayer);
|
||||
|
||||
if (!entityPlayer.worldObj.isRemote)
|
||||
{
|
||||
saveInventory(entityPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
|
||||
if (!player.worldObj.isRemote)
|
||||
{
|
||||
saveInventory(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
Slot slotObject = (Slot) inventorySlots.get(slotIndex);
|
||||
int slots = inventorySlots.size();
|
||||
|
||||
if (slotObject != null && slotObject.getHasStack())
|
||||
{
|
||||
ItemStack stackInSlot = slotObject.getStack();
|
||||
stack = stackInSlot.copy();
|
||||
|
||||
if (stack.getItem() instanceof ISigil)
|
||||
{
|
||||
if (slotIndex < inventoryColumns)
|
||||
{
|
||||
if (!this.mergeItemStack(stackInSlot, inventoryColumns, slots, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(stackInSlot, 0, inventoryColumns, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (stack.getItem() instanceof SigilAugmentedHolding)
|
||||
{
|
||||
if (slotIndex < inventoryColumns + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS))
|
||||
{
|
||||
if (!this.mergeItemStack(stackInSlot, inventoryColumns + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS), inventorySlots.size(), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(stackInSlot, inventoryColumns, inventoryColumns + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (stackInSlot.stackSize == 0)
|
||||
{
|
||||
slotObject.putStack(null);
|
||||
} else
|
||||
{
|
||||
slotObject.onSlotChanged();
|
||||
}
|
||||
|
||||
if (stackInSlot.stackSize == stack.stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slotObject.onPickupFromSlot(player, stackInSlot);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void saveInventory(EntityPlayer entityPlayer)
|
||||
{
|
||||
inventoryHolding.onGuiSaved(entityPlayer);
|
||||
}
|
||||
|
||||
private class SlotHolding extends Slot
|
||||
{
|
||||
private final EntityPlayer player;
|
||||
private ContainerAugmentedHolding containerHolding;
|
||||
|
||||
public SlotHolding(ContainerAugmentedHolding containerHolding, IInventory inventory, EntityPlayer player, int slotIndex, int x, int y)
|
||||
{
|
||||
super(inventory, slotIndex, x, y);
|
||||
this.player = player;
|
||||
this.containerHolding = containerHolding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotChanged()
|
||||
{
|
||||
super.onSlotChanged();
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer())
|
||||
{
|
||||
containerHolding.saveInventory(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack)
|
||||
{
|
||||
return itemStack.getItem() instanceof ISigil;
|
||||
}
|
||||
}
|
||||
|
||||
private class SlotDisabled extends Slot
|
||||
{
|
||||
public SlotDisabled(IInventory inventory, int slotIndex, int x, int y)
|
||||
{
|
||||
super(inventory, slotIndex, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.arc.bloodarsenal.items.sigil.holding;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiAugmentedHolding extends GuiContainer
|
||||
{
|
||||
public GuiAugmentedHolding(EntityPlayer player, InventoryAugmentedHolding inventoryHolding)
|
||||
{
|
||||
super(new ContainerAugmentedHolding(player, inventoryHolding));
|
||||
xSize = 176;
|
||||
ySize = 121;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int param1, int param2)
|
||||
{
|
||||
//the parameters for drawString are: string, x, y, color
|
||||
fontRendererObj.drawString("Sigil of Augmented Holding", 24, 4, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
|
||||
{
|
||||
//draw your Gui here, only thing you need to change is the path
|
||||
ResourceLocation test = new ResourceLocation("bloodarsenal", "textures/gui/SigilAugmentedHolding.png");
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(test);
|
||||
int x = (width - xSize) / 2;
|
||||
int y = (height - ySize) / 2;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
+261
@@ -0,0 +1,261 @@
|
||||
package com.arc.bloodarsenal.items.sigil.holding;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class InventoryAugmentedHolding implements IInventory
|
||||
{
|
||||
public ItemStack parentItemStack;
|
||||
protected ItemStack[] inventory;
|
||||
|
||||
protected static String NBT_MOST_SIG = "MostSig";
|
||||
protected static String NBT_LEAST_SIG = "LeastSig";
|
||||
protected static String NBT_ITEMS = "Items";
|
||||
|
||||
public InventoryAugmentedHolding(ItemStack itemStack)
|
||||
{
|
||||
parentItemStack = itemStack;
|
||||
|
||||
inventory = new ItemStack[9];
|
||||
|
||||
readFromNBT(itemStack.getTagCompound());
|
||||
}
|
||||
|
||||
public void onGuiSaved(EntityPlayer entityPlayer)
|
||||
{
|
||||
parentItemStack = findParentItemStack(entityPlayer);
|
||||
|
||||
if (parentItemStack != null)
|
||||
{
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack findParentItemStack(EntityPlayer entityPlayer)
|
||||
{
|
||||
if (hasUUID(parentItemStack))
|
||||
{
|
||||
UUID parentItemStackUUID = new UUID(parentItemStack.getTagCompound().getLong(NBT_MOST_SIG), parentItemStack.getTagCompound().getLong(NBT_LEAST_SIG));
|
||||
for (int i = 0; i < entityPlayer.inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack itemStack = entityPlayer.inventory.getStackInSlot(i);
|
||||
|
||||
if (hasUUID(itemStack))
|
||||
{
|
||||
if (itemStack.getTagCompound().getLong(NBT_MOST_SIG) == parentItemStackUUID.getMostSignificantBits() && itemStack.getTagCompound().getLong(NBT_LEAST_SIG) == parentItemStackUUID.getLeastSignificantBits())
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
NBTTagCompound nbtTagCompound = parentItemStack.getTagCompound();
|
||||
|
||||
if (nbtTagCompound == null)
|
||||
{
|
||||
nbtTagCompound = new NBTTagCompound();
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
nbtTagCompound.setLong(NBT_MOST_SIG, uuid.getMostSignificantBits());
|
||||
nbtTagCompound.setLong(NBT_LEAST_SIG, uuid.getLeastSignificantBits());
|
||||
}
|
||||
|
||||
writeToNBT(nbtTagCompound);
|
||||
parentItemStack.setTagCompound(nbtTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return inventory.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slotIndex)
|
||||
{
|
||||
return slotIndex >= 0 && slotIndex < this.inventory.length ? inventory[slotIndex] : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slotIndex, int decrementAmount)
|
||||
{
|
||||
ItemStack itemStack = getStackInSlot(slotIndex);
|
||||
if (itemStack != null)
|
||||
{
|
||||
if (itemStack.stackSize <= decrementAmount)
|
||||
{
|
||||
setInventorySlotContents(slotIndex, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemStack = itemStack.splitStack(decrementAmount);
|
||||
if (itemStack.stackSize == 0)
|
||||
{
|
||||
setInventorySlotContents(slotIndex, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slotIndex)
|
||||
{
|
||||
if (inventory[slotIndex] != null)
|
||||
{
|
||||
ItemStack itemStack = inventory[slotIndex];
|
||||
inventory[slotIndex] = null;
|
||||
return itemStack;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slotIndex, ItemStack itemStack)
|
||||
{
|
||||
if (slotIndex >= 0 && slotIndex < this.inventory.length)
|
||||
{
|
||||
this.inventory[slotIndex] = itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
{
|
||||
return "SigilOfAugmentedHolding";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityPlayer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack)
|
||||
{
|
||||
return itemStack.getItem() instanceof ISigil;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbtTagCompound)
|
||||
{
|
||||
if (nbtTagCompound != null && nbtTagCompound.hasKey(NBT_ITEMS))
|
||||
{
|
||||
// Read in the ItemStacks in the inventory from NBT
|
||||
if (nbtTagCompound.hasKey(NBT_ITEMS))
|
||||
{
|
||||
NBTTagList tagList = nbtTagCompound.getTagList(NBT_ITEMS, 10);
|
||||
inventory = new ItemStack[this.getSizeInventory()];
|
||||
for (int i = 0; i < tagList.tagCount(); ++i)
|
||||
{
|
||||
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
|
||||
byte slotIndex = tagCompound.getByte("Slot");
|
||||
if (slotIndex >= 0 && slotIndex < inventory.length)
|
||||
{
|
||||
inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbtTagCompound)
|
||||
{
|
||||
// Write the ItemStacks in the inventory to NBT
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex)
|
||||
{
|
||||
if (inventory[currentIndex] != null)
|
||||
{
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tagCompound.setByte("Slot", (byte) currentIndex);
|
||||
inventory[currentIndex].writeToNBT(tagCompound);
|
||||
tagList.appendTag(tagCompound);
|
||||
}
|
||||
}
|
||||
nbtTagCompound.setTag(NBT_ITEMS, tagList);
|
||||
}
|
||||
|
||||
public static boolean hasTag(ItemStack itemStack, String keyName)
|
||||
{
|
||||
return itemStack != null && itemStack.stackTagCompound != null && itemStack.stackTagCompound.hasKey(keyName);
|
||||
}
|
||||
|
||||
public static boolean hasUUID(ItemStack itemStack)
|
||||
{
|
||||
return hasTag(itemStack, NBT_MOST_SIG) && hasTag(itemStack, NBT_LEAST_SIG);
|
||||
}
|
||||
|
||||
public static void setUUID(ItemStack itemStack)
|
||||
{
|
||||
initNBTTagCompound(itemStack);
|
||||
|
||||
if (!hasTag(itemStack, NBT_MOST_SIG) && !hasTag(itemStack, NBT_LEAST_SIG))
|
||||
{
|
||||
UUID itemUUID = UUID.randomUUID();
|
||||
setLong(itemStack, NBT_MOST_SIG, itemUUID.getMostSignificantBits());
|
||||
setLong(itemStack, NBT_LEAST_SIG, itemUUID.getLeastSignificantBits());
|
||||
}
|
||||
}
|
||||
|
||||
private static void initNBTTagCompound(ItemStack itemStack)
|
||||
{
|
||||
if (itemStack.stackTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
}
|
||||
|
||||
public static void setLong(ItemStack itemStack, String keyName, long keyValue)
|
||||
{
|
||||
initNBTTagCompound(itemStack);
|
||||
|
||||
itemStack.stackTagCompound.setLong(keyName, keyValue);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
package com.arc.bloodarsenal.items.sigil.holding;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import com.arc.bloodarsenal.BloodArsenal;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SigilAugmentedHolding extends EnergyItems
|
||||
{
|
||||
private static int invSize = 8;
|
||||
|
||||
private static final String NBT_CURRENT_SIGIL = "CurrentSigil";
|
||||
|
||||
public SigilAugmentedHolding()
|
||||
{
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
|
||||
{
|
||||
if (!(stack.getTagCompound() == null))
|
||||
{
|
||||
ItemStack[] inv = getInternalInventory(stack);
|
||||
|
||||
if (inv == null)
|
||||
{
|
||||
return this.itemIcon;
|
||||
}
|
||||
|
||||
ItemStack item = getCurrentSigil(stack);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
return item.getIconIndex();
|
||||
}
|
||||
}
|
||||
|
||||
return this.itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.sigil.augmentedHolding"));
|
||||
|
||||
if (!(par1ItemStack.getTagCompound() == null))
|
||||
{
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + par1ItemStack.getTagCompound().getString("ownerName"));
|
||||
ItemStack[] inv = getInternalInventory(par1ItemStack);
|
||||
|
||||
if (inv == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int currentSlot = getCurrentItem(par1ItemStack);
|
||||
ItemStack item = inv[currentSlot];
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.item.currentitem") + " " + item.getDisplayName());
|
||||
}
|
||||
|
||||
for (int i = 0; i <= invSize; i++)
|
||||
{
|
||||
if (inv[i] != null)
|
||||
{
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.item.iteminslot") + " " + (i + 1) + ": " + inv[i].getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
if (checkAndSetItemOwner(par1ItemStack, par2EntityPlayer))
|
||||
{
|
||||
int currentSlot = getCurrentItem(par1ItemStack);
|
||||
ItemStack[] inv = getInternalInventory(par1ItemStack);
|
||||
|
||||
if (inv == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack itemUsed = inv[currentSlot];
|
||||
|
||||
if (itemUsed == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean bool = itemUsed.getItem().onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
|
||||
|
||||
saveInventory(par1ItemStack, inv);
|
||||
|
||||
return bool;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
if (checkAndSetItemOwner(par1ItemStack, par3EntityPlayer))
|
||||
{
|
||||
if (par3EntityPlayer.isSneaking())
|
||||
{
|
||||
InventoryAugmentedHolding.setUUID(par1ItemStack);
|
||||
par3EntityPlayer.openGui(BloodArsenal.instance, 0, par3EntityPlayer.worldObj, (int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ);
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
int currentSlot = getCurrentItem(par1ItemStack);
|
||||
ItemStack[] inv = getInternalInventory(par1ItemStack);
|
||||
|
||||
if (inv == null)
|
||||
{
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
ItemStack itemUsed = inv[currentSlot];
|
||||
|
||||
if (itemUsed == null)
|
||||
{
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
itemUsed.getItem().onItemRightClick(itemUsed, par2World, par3EntityPlayer);
|
||||
saveInventory(par1ItemStack, inv);
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
public static int next(int mode)
|
||||
{
|
||||
int index = mode + 1;
|
||||
|
||||
if (index >= invSize + 1)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
public static int prev(int mode)
|
||||
{
|
||||
int index = mode - 1;
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
index = invSize;
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
private static void initModeTag(ItemStack itemStack)
|
||||
{
|
||||
if (itemStack.stackTagCompound == null)
|
||||
{
|
||||
itemStack.stackTagCompound = new NBTTagCompound();
|
||||
itemStack.stackTagCompound.setInteger(NBT_CURRENT_SIGIL, invSize);
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getCurrentSigil(ItemStack itemStack)
|
||||
{
|
||||
if (itemStack != null && itemStack.getItem() instanceof SigilAugmentedHolding)
|
||||
{
|
||||
ItemStack[] itemStacks = getInternalInventory(itemStack);
|
||||
int currentSlot = getCurrentItem(itemStack);
|
||||
if (itemStacks != null)
|
||||
{
|
||||
return itemStacks[currentSlot];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getCurrentItem(ItemStack itemStack)
|
||||
{
|
||||
if (itemStack != null && itemStack.getItem() instanceof SigilAugmentedHolding)
|
||||
{
|
||||
initModeTag(itemStack);
|
||||
int currentSigil = itemStack.stackTagCompound.getInteger(NBT_CURRENT_SIGIL);
|
||||
currentSigil = MathHelper.clamp_int(currentSigil, 0, invSize);
|
||||
return currentSigil;
|
||||
}
|
||||
|
||||
return 8;
|
||||
}
|
||||
|
||||
public static ItemStack[] getInternalInventory(ItemStack itemStack)
|
||||
{
|
||||
initModeTag(itemStack);
|
||||
NBTTagCompound tagCompound = itemStack.getTagCompound();
|
||||
|
||||
if (tagCompound == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack[] inv = new ItemStack[9];
|
||||
NBTTagList tagList = tagCompound.getTagList(InventoryAugmentedHolding.NBT_ITEMS, 10);
|
||||
|
||||
if (tagList == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < tagList.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound tag = tagList.getCompoundTagAt(i);
|
||||
int slot = tag.getByte("Slot");
|
||||
|
||||
if (slot >= 0 && slot <= invSize)
|
||||
{
|
||||
inv[slot] = ItemStack.loadItemStackFromNBT(tag);
|
||||
}
|
||||
}
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
public void saveInventory(ItemStack itemStack, ItemStack[] inventory)
|
||||
{
|
||||
NBTTagCompound itemTag = itemStack.getTagCompound();
|
||||
|
||||
if (itemTag == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagList itemList = new NBTTagList();
|
||||
|
||||
for (int i = 0; i <= invSize; i++)
|
||||
{
|
||||
if (inventory[i] != null)
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setByte("Slot", (byte) i);
|
||||
inventory[i].writeToNBT(tag);
|
||||
itemList.appendTag(tag);
|
||||
}
|
||||
}
|
||||
|
||||
itemTag.setTag(InventoryAugmentedHolding.NBT_ITEMS, itemList);
|
||||
}
|
||||
|
||||
public static void cycleSigil(ItemStack itemStack, int mode)
|
||||
{
|
||||
if (itemStack != null && itemStack.getItem() instanceof SigilAugmentedHolding)
|
||||
{
|
||||
initModeTag(itemStack);
|
||||
itemStack.stackTagCompound.setInteger(NBT_CURRENT_SIGIL, mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
|
||||
{
|
||||
if (!(par1ItemStack.getTagCompound() == null))
|
||||
{
|
||||
this.tickInternalInventory(par1ItemStack, par2World, par3Entity, par4, par5);
|
||||
}
|
||||
}
|
||||
|
||||
public void tickInternalInventory(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
|
||||
{
|
||||
ItemStack[] inv = getInternalInventory(par1ItemStack);
|
||||
|
||||
if (inv == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < invSize; i++)
|
||||
{
|
||||
if (inv[i] == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
inv[i].getItem().onUpdate(inv[i], par2World, par3Entity, par4, par5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,12 @@ public class BloodArsenalModifiers
|
||||
{
|
||||
public static void init()
|
||||
{
|
||||
|
||||
initModifiers();
|
||||
}
|
||||
|
||||
public static void initModifiers()
|
||||
{
|
||||
int craftingConstant = OreDictionary.WILDCARD_VALUE;
|
||||
|
||||
ItemStack masterOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.masterBloodOrb, 1, craftingConstant);
|
||||
ModifyBuilder.registerModifier(new ModSoulbound());
|
||||
ItemStack masterOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.masterBloodOrb, 1, OreDictionary.WILDCARD_VALUE);
|
||||
ModifyBuilder.registerModifier(new ModSoulbound(new ItemStack[] {masterOrb}));
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,13 @@ public class BloodArsenalTinkers
|
||||
public static PartHelper TOUGHBIND;
|
||||
public static PartHelper TOUGHROD;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
addMaterials();
|
||||
|
||||
addParts();
|
||||
}
|
||||
|
||||
public static void addMaterials()
|
||||
{
|
||||
TConstructRegistry.addToolMaterial(250, "Blood Infused Iron", "blood_infused_iron", 3, 550, 1800, 3, 1.5F, 0, 0.0F, "Blood Infused Iron", 0xab0000);
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.arc.bloodarsenal.items.tinkers;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
@@ -13,12 +14,11 @@ import java.util.ArrayList;
|
||||
|
||||
public class ModSoulbound extends ModBoolean
|
||||
{
|
||||
public ArrayList<ItemStack> orbs = new ArrayList<ItemStack>();
|
||||
public int modifiersRequired = 1;
|
||||
|
||||
public ModSoulbound()
|
||||
public ModSoulbound(ItemStack[] items)
|
||||
{
|
||||
super(new ItemStack[0], 20, "Soulbound", "\u00a74", "Soulbound");
|
||||
super(items, 1, "Soulbound", "\u00a74", "Soulbound");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,15 +32,13 @@ public class ModSoulbound extends ModBoolean
|
||||
return false;
|
||||
|
||||
ItemStack foundOrb = null;
|
||||
ItemStack masterOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.masterBloodOrb, 1, OreDictionary.WILDCARD_VALUE);
|
||||
|
||||
for (ItemStack stack : input)
|
||||
for (ItemStack battery : orbs)
|
||||
{
|
||||
if (stack == null)
|
||||
continue;
|
||||
if (stack.getItem() != battery.getItem())
|
||||
continue;
|
||||
if (!(stack.getItem() instanceof IBloodOrb))
|
||||
if (stack.getItem() != masterOrb.getItem())
|
||||
continue;
|
||||
if (foundOrb != null)
|
||||
return false;
|
||||
@@ -77,14 +75,13 @@ public class ModSoulbound extends ModBoolean
|
||||
|
||||
// find the battery in the input
|
||||
ItemStack inputBattery = null;
|
||||
ItemStack masterOrb = new ItemStack(WayofTime.alchemicalWizardry.ModItems.masterBloodOrb, 1, OreDictionary.WILDCARD_VALUE);
|
||||
|
||||
for (ItemStack stack : input)
|
||||
for (ItemStack battery : orbs)
|
||||
{
|
||||
if (stack == null)
|
||||
continue;
|
||||
if (stack.getItem() != battery.getItem())
|
||||
continue;
|
||||
if (!(stack.getItem() instanceof IBloodOrb))
|
||||
if (stack.getItem() != masterOrb.getItem())
|
||||
continue;
|
||||
|
||||
// we're guaranteed to only find one battery because more are prevented above
|
||||
|
||||
Reference in new issue
Block a user