diff --git a/src/main/java/tombenpotter/emt/ElectroMagicTools.java b/src/main/java/tombenpotter/emt/ElectroMagicTools.java index d42f70a..e284b50 100644 --- a/src/main/java/tombenpotter/emt/ElectroMagicTools.java +++ b/src/main/java/tombenpotter/emt/ElectroMagicTools.java @@ -27,7 +27,7 @@ import net.minecraftforge.common.MinecraftForge; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import tombenpotter.emt.common.commands.CommandOutputs; -import tombenpotter.emt.common.module.base.EMTEntityRegistry; +import tombenpotter.emt.common.modules.base.entities.BaseEntityRegistry; import tombenpotter.emt.common.module.ic2.recipes.EMTInitRecipes; import tombenpotter.emt.common.module.ic2.recipes.EMTPostInitRecipes; import tombenpotter.emt.common.module.ic2.recipes.UuMInfusionRecipes; @@ -78,7 +78,7 @@ public class ElectroMagicTools { ElectroMagicTools.logger.info(localize("console.EMT.init.recipes")); EMTInitRecipes.add(); ElectroMagicTools.logger.info(localize("console.EMT.init.entities")); - EMTEntityRegistry.registerEMTEntities(); + BaseEntityRegistry.registerEMTEntities(); ElectroMagicTools.logger.info(localize("console.EMT.init.guiHandler")); NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy); diff --git a/src/main/java/tombenpotter/emt/client/renderer/RenderLaser.java b/src/main/java/tombenpotter/emt/client/renderer/RenderLaser.java index 1102389..0d805dd 100644 --- a/src/main/java/tombenpotter/emt/client/renderer/RenderLaser.java +++ b/src/main/java/tombenpotter/emt/client/renderer/RenderLaser.java @@ -19,7 +19,7 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import tombenpotter.emt.ModInformation; -import tombenpotter.emt.common.module.base.entities.EntityLaser; +import tombenpotter.emt.common.modules.base.entities.EntityLaser; public class RenderLaser extends Render { diff --git a/src/main/java/tombenpotter/emt/common/module/base/EMTEntityRegistry.java b/src/main/java/tombenpotter/emt/common/module/base/EMTEntityRegistry.java deleted file mode 100644 index f699e5e..0000000 --- a/src/main/java/tombenpotter/emt/common/module/base/EMTEntityRegistry.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Tombenpotter. - * All rights reserved. - * - * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html - * - * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. - * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. - * http://www.minecraftforum.net/topic/1585216- - ******************************************************************************/ - -package tombenpotter.emt.common.module.base; - -import cpw.mods.fml.common.registry.EntityRegistry; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityList; -import net.minecraft.entity.EntityList.EntityEggInfo; -import net.minecraft.entity.EntityLiving; -import tombenpotter.emt.ElectroMagicTools; -import tombenpotter.emt.common.module.base.entities.EntityArcher; -import tombenpotter.emt.common.module.base.entities.EntityLaser; - -public class EMTEntityRegistry { - - private static int startEID = 300; - private static int entityIDs = 0; - private static final Class ARCHER_CLASS = EntityArcher.class; - - private static int getUniqueEntityID() { - - do { - startEID++; - } while (EntityList.getStringFromID(startEID) != null); - return startEID; - } - - @SuppressWarnings("unchecked") - public static void registerEntityEgg(Class entity, int colPrim, int colSec) { - int id = getUniqueEntityID(); - EntityList.IDtoClassMapping.put(id, entity); - EntityList.entityEggs.put(id, new EntityEggInfo(id, colPrim, colSec)); - return; - } - - public static void registerEMTEntities() { - - EntityRegistry.registerModEntity(EntityLaser.class, "entityLaser", entityIDs++, ElectroMagicTools.instance, 80, 3, true); - EntityRegistry.registerModEntity(EntityArcher.class, "entityArcher", entityIDs++, ElectroMagicTools.instance, 80, 3, true); - registerEntityEgg(ARCHER_CLASS, 0x99111F, 0xE5685); - } -} diff --git a/src/main/java/tombenpotter/emt/common/module/base/entities/EntityArcher.java b/src/main/java/tombenpotter/emt/common/module/base/entities/EntityArcher.java deleted file mode 100644 index 44ca599..0000000 --- a/src/main/java/tombenpotter/emt/common/module/base/entities/EntityArcher.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Tombenpotter. - * All rights reserved. - * - * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html - * - * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. - * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. - * http://www.minecraftforum.net/topic/1585216- - ******************************************************************************/ - -package tombenpotter.emt.common.module.base.entities; - -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.EntityAINearestAttackableTarget; -import net.minecraft.entity.ai.EntityAISwimming; -import net.minecraft.entity.ai.EntityAIWander; -import net.minecraft.entity.ai.EntityAIWatchClosest; -import net.minecraft.entity.monster.EntitySnowman; -import net.minecraft.entity.monster.IMob; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.DamageSource; -import net.minecraft.world.World; -import net.minecraftforge.common.IExtendedEntityProperties; - -public class EntityArcher extends EntitySnowman implements IExtendedEntityProperties { - - public EntityArcher(World par1World) { - super(par1World); - this.isImmuneToFire = true; - this.tasks.addTask(1, new EntityAISwimming(this)); - this.tasks.addTask(2, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); - this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, true, false, IMob.mobSelector)); - this.tasks.addTask(4, new EntityAIWander(this, 0.30D)); - } - - @Override - protected void applyEntityAttributes() { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30D); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); - } - - @Override - public void onDeath(DamageSource par1DamageSource) { - super.onDeath(par1DamageSource); - this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 1, true); - this.setDead(); - } - - @Override - protected Item getDropItem() { - return Items.arrow; - } - - @Override - protected void dropFewItems(boolean par1, int par2) { - int j; - int k; - - j = this.rand.nextInt(3 + par2); - - for (k = 0; k < j; ++k) { - this.dropItem(Items.arrow, 1); - } - j = this.rand.nextInt(3 + par2); - - for (k = 0; k < j; ++k) { - this.dropItem(Items.bone, 1); - } - } - - @Override - protected void dropRareDrop(int par1) { - this.entityDropItem(new ItemStack(Blocks.web, 1, 1), 0.0F); - } - - protected void addRandomArmor() { - super.addRandomArmor(); - this.setCurrentItemOrArmor(0, new ItemStack(Items.bow)); - } - - @Override - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { - EntityArrow entityarrow = new EntityArrow(this.worldObj, this, par1EntityLivingBase, 1.6F, (float) (14 - this.worldObj.difficultySetting.getDifficultyId() * 4)); - int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem()); - int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem()); - entityarrow.setDamage((double) (par2 * 2.0F) + this.rand.nextGaussian() * 0.25D + (double) ((float) this.worldObj.difficultySetting.getDifficultyId() * 0.11F)); - - if (i > 0) { - entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D); - } - - if (j > 0) { - entityarrow.setKnockbackStrength(j); - } - - if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0) { - entityarrow.setFire(100); - } - - this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); - this.worldObj.spawnEntityInWorld(entityarrow); - } - - @Override - public void saveNBTData(NBTTagCompound compound) { - } - - @Override - public void loadNBTData(NBTTagCompound compound) { - } - - @Override - public void init(Entity entity, World world) { - } -} diff --git a/src/main/java/tombenpotter/emt/common/module/base/items/ItemEMTItems.java b/src/main/java/tombenpotter/emt/common/module/base/items/ItemEMTItems.java deleted file mode 100644 index 140915d..0000000 --- a/src/main/java/tombenpotter/emt/common/module/base/items/ItemEMTItems.java +++ /dev/null @@ -1,221 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Tombenpotter. - * All rights reserved. - * - * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html - * - * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. - * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. - * http://www.minecraftforum.net/topic/1585216- - ******************************************************************************/ - -package tombenpotter.emt.common.module.base.items; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.effect.EntityLightningBolt; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.MovingObjectPosition.MovingObjectType; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; -import net.minecraftforge.oredict.OreDictionary; -import thaumcraft.common.config.Config; -import thaumcraft.common.lib.InventoryHelper; -import tombenpotter.emt.ElectroMagicTools; -import tombenpotter.emt.ModInformation; - -import java.util.List; - -public class ItemEMTItems extends Item { - - public IIcon[] icon = new IIcon[500]; - - public ItemEMTItems() { - this.setCreativeTab(ElectroMagicTools.tabEMT); - this.setMaxDamage(0); - this.setMaxStackSize(64); - setHasSubtypes(true); - OreDictionary.registerOre("plateThaumium", new ItemStack(this, 1, 5)); - OreDictionary.registerOre("slimeball", new ItemStack(this, 1, 8)); - } - - @Override - public String getUnlocalizedName(ItemStack itemstack) { - String name = ""; - switch (itemstack.getItemDamage()) { - case 0: { - name = "oreClusterUranium"; - break; - } - case 1: { - name = "crushedOreAmber"; - break; - } - case 2: { - name = "purifiedOreAmber"; - break; - } - case 3: { - name = "crushedOreCinnabar"; - break; - } - case 4: { - name = "purifiedOreCinnabar"; - break; - } - case 5: { - name = "thaumiumPlate"; - break; - } - case 6: { - name = "lightningSummoner"; - break; - } - case 7: { - name = "featherMesh"; - break; - } - case 8: { - name = "glue"; - break; - } - case 9: { - name = "ductTape"; - break; - } - case 10: { - name = "rubberBall"; - break; - } - case 11: { - name = "cardboard"; - break; - } - case 12: { - name = "featherGluedCardboardWing"; - break; - } - case 13: { - name = "denseIronSheet"; - break; - } - case 14: { - name = "taintedFeather"; - break; - } - case 15: { - name = "thaumiumWing"; - break; - } - case 16: { - name = "uumatterDrop"; - break; - } - default: - name = "nothing"; - break; - } - return getUnlocalizedName() + "." + name; - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister ri) { - this.icon[0] = ri.registerIcon(ModInformation.texturePath + ":materials/clusteruranium"); - this.icon[1] = ri.registerIcon(ModInformation.texturePath + ":materials/crushedamber"); - this.icon[2] = ri.registerIcon(ModInformation.texturePath + ":materials/purifiedamber"); - this.icon[3] = ri.registerIcon(ModInformation.texturePath + ":materials/crushedcinnabar"); - this.icon[4] = ri.registerIcon(ModInformation.texturePath + ":materials/purifiedcinnabar"); - this.icon[5] = ri.registerIcon(ModInformation.texturePath + ":materials/thaumiumplate"); - this.icon[6] = ri.registerIcon(ModInformation.texturePath + ":materials/lightningsummoner"); - this.icon[7] = ri.registerIcon(ModInformation.texturePath + ":materials/feathermesh"); - this.icon[8] = ri.registerIcon(ModInformation.texturePath + ":materials/glue"); - this.icon[9] = ri.registerIcon(ModInformation.texturePath + ":materials/ducttape"); - this.icon[10] = ri.registerIcon(ModInformation.texturePath + ":materials/rubberball"); - this.icon[11] = ri.registerIcon(ModInformation.texturePath + ":materials/cardboard"); - this.icon[12] = ri.registerIcon(ModInformation.texturePath + ":materials/cardboardsheet"); - this.icon[13] = ri.registerIcon(ModInformation.texturePath + ":materials/denseironsheet"); - this.icon[14] = ri.registerIcon(ModInformation.texturePath + ":materials/taintedfeather"); - this.icon[15] = ri.registerIcon(ModInformation.texturePath + ":materials/thaumiumWing"); - this.icon[16] = ri.registerIcon(ModInformation.texturePath + ":materials/uumatterdrop"); - } - - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) { - return this.icon[meta]; - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List list) { - for (int i = 1; i <= 16; i++) { - list.add(new ItemStack(this, 1, i)); - } - } - - @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - if (stack != null && stack.getItemDamage() == 6) { - player.swingItem(); - float f = 1.0F; - float f1 = player.prevRotationPitch + ((player.rotationPitch - player.prevRotationPitch) * f); - float f2 = player.prevRotationYaw + ((player.rotationYaw - player.prevRotationYaw) * f); - double d = player.prevPosX + ((player.posX - player.prevPosX) * f); - double d1 = (player.prevPosY + ((player.posY - player.prevPosY) * f) + 1.6200000000000001D) - player.yOffset; - double d2 = player.prevPosZ + ((player.posZ - player.prevPosZ) * f); - Vec3 vec3d = Vec3.createVectorHelper(d, d1, d2); - float f3 = MathHelper.cos((-f2 * 0.01745329F) - 3.141593F); - float f4 = MathHelper.sin((-f2 * 0.01745329F) - 3.141593F); - float f5 = -MathHelper.cos(-f1 * 0.01745329F); - float f6 = MathHelper.sin(-f1 * 0.01745329F); - float f7 = f4 * f5; - float f8 = f6; - float f9 = f3 * f5; - double d3 = 5000D; - Vec3 vec3d1 = vec3d.addVector(f7 * d3, f8 * d3, f9 * d3); - MovingObjectPosition movingobjectposition = player.worldObj.rayTraceBlocks(vec3d, vec3d1, true); - if (movingobjectposition == null) { - return stack; - } - if (movingobjectposition.typeOfHit == MovingObjectType.BLOCK) { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - world.spawnEntityInWorld(new EntityLightningBolt(world, i, j, k)); - } else if (movingobjectposition.typeOfHit == MovingObjectType.ENTITY) { - Entity entityhit = movingobjectposition.entityHit; - double x = entityhit.posX; - double y = entityhit.posY; - double z = entityhit.posZ; - world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z)); - } - if (player.capabilities.isCreativeMode) { - return stack; - } else { - player.inventory.consumeInventoryItem(this); - return stack; - } - } - return stack; - } - - public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { - super.onUpdate(stack, world, entity, par4, par5); - if ((!entity.worldObj.isRemote) && ((stack.getItemDamage() == 14)) && ((entity instanceof EntityLivingBase)) && (!((EntityLivingBase) entity).isEntityUndead()) && (!((EntityLivingBase) entity).isPotionActive(Config.potionTaintPoisonID)) && (world.rand.nextInt(4321) <= stack.stackSize)) { - ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Config.potionTaintPoisonID, 120, 0, false)); - if ((entity instanceof EntityPlayer)) { - InventoryHelper.consumeInventoryItem((EntityPlayer) entity, stack.getItem(), stack.getItemDamage()); - } - } - } -} diff --git a/src/main/java/tombenpotter/emt/common/module/base/items/ItemTaintedThorHammer.java b/src/main/java/tombenpotter/emt/common/module/base/items/ItemTaintedThorHammer.java deleted file mode 100644 index 2a14941..0000000 --- a/src/main/java/tombenpotter/emt/common/module/base/items/ItemTaintedThorHammer.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Tombenpotter. - * All rights reserved. - * - * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html - * - * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. - * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. - * http://www.minecraftforum.net/topic/1585216- - ******************************************************************************/ - -package tombenpotter.emt.common.module.base.items; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; -import net.minecraft.world.World; -import org.lwjgl.input.Keyboard; -import thaumcraft.common.entities.projectile.EntityAlumentum; -import tombenpotter.emt.ModInformation; -import tombenpotter.emt.common.module.base.items.ItemThorHammer; -import tombenpotter.emt.common.util.TextHelper; - -import java.util.List; - -public class ItemTaintedThorHammer extends ItemThorHammer { - - public ItemTaintedThorHammer() { - this.setMaxDamage(1000); - } - - @SideOnly(Side.CLIENT) - @Override - public void registerIcons(IIconRegister iconRegister) { - this.itemIcon = iconRegister.registerIcon(ModInformation.texturePath + ":hammer/taintedthorhammer"); - } - - @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { - player.swingItem(); - world.spawnEntityInWorld(new EntityAlumentum(world, player.posX + 8, player.posY, player.posZ - 8)); - world.spawnEntityInWorld(new EntityAlumentum(world, player.posX - 8, player.posY, player.posZ + 8)); - world.spawnEntityInWorld(new EntityAlumentum(world, player.posX - 8, player.posY, player.posZ - 8)); - world.spawnEntityInWorld(new EntityAlumentum(world, player.posX + 8, player.posY, player.posZ + 8)); - world.spawnEntityInWorld(new EntityAlumentum(world, player.posX, player.posY + 4, player.posZ)); - world.spawnEntityInWorld(new EntityAlumentum(world, player.posX, player.posY + 8, player.posZ)); - - if (player.capabilities.isCreativeMode) { - return itemstack; - } else { - itemstack.damageItem(20, player); - return itemstack; - } - } - - @Override - public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { - entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 2F); - itemstack.damageItem(1, attacker); - return true; - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer entityPlayer, List list, boolean par4) { - list.add(TextHelper.localize("tooltip.EMT.hammer.broken.thor")); - list.add(TextHelper.localize("tooltip.EMT.hammer.broken.danger")); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - list.add(TextHelper.localize("tooltip.EMT.hammer.broken.plsNoRightClick")); - } else { - list.add(TextHelper.localize("tooltip.EMT.hammer.broken.plsRightClick")); - } - } -} diff --git a/src/main/java/tombenpotter/emt/common/module/base/items/ItemThorHammer.java b/src/main/java/tombenpotter/emt/common/module/base/items/ItemThorHammer.java deleted file mode 100644 index 4ed4594..0000000 --- a/src/main/java/tombenpotter/emt/common/module/base/items/ItemThorHammer.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Tombenpotter. - * All rights reserved. - * - * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html - * - * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. - * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. - * http://www.minecraftforum.net/topic/1585216- - ******************************************************************************/ - -package tombenpotter.emt.common.module.base.items; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.effect.EntityLightningBolt; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemSword; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.MovingObjectPosition.MovingObjectType; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; -import thaumcraft.api.IRepairable; -import tombenpotter.emt.ElectroMagicTools; -import tombenpotter.emt.ModInformation; - -import java.util.List; - -public class ItemThorHammer extends ItemSword implements IRepairable { - - public ItemThorHammer() { - super(ToolMaterial.EMERALD); - this.setCreativeTab(ElectroMagicTools.tabEMT); - this.setMaxDamage(2000); - // OreDictionary.registerOre("craftingToolForgeHammer", this); - } - - @SideOnly(Side.CLIENT) - @Override - public void registerIcons(IIconRegister iconRegister) { - this.itemIcon = iconRegister.registerIcon(ModInformation.texturePath + ":hammer/thorhammer"); - } - - @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { - player.swingItem(); - float f = 1.0F; - float f1 = player.prevRotationPitch + ((player.rotationPitch - player.prevRotationPitch) * f); - float f2 = player.prevRotationYaw + ((player.rotationYaw - player.prevRotationYaw) * f); - double d = player.prevPosX + ((player.posX - player.prevPosX) * f); - double d1 = (player.prevPosY + ((player.posY - player.prevPosY) * f) + 1.6200000000000001D) - player.yOffset; - double d2 = player.prevPosZ + ((player.posZ - player.prevPosZ) * f); - Vec3 vec3d = Vec3.createVectorHelper(d, d1, d2); - float f3 = MathHelper.cos((-f2 * 0.01745329F) - 3.141593F); - float f4 = MathHelper.sin((-f2 * 0.01745329F) - 3.141593F); - float f5 = -MathHelper.cos(-f1 * 0.01745329F); - float f6 = MathHelper.sin(-f1 * 0.01745329F); - float f7 = f4 * f5; - float f8 = f6; - float f9 = f3 * f5; - double d3 = 5000D; - Vec3 vec3d1 = vec3d.addVector(f7 * d3, f8 * d3, f9 * d3); - MovingObjectPosition movingobjectposition = player.worldObj.rayTraceBlocks(vec3d, vec3d1, true); - if (movingobjectposition == null) { - return itemstack; - } - if (movingobjectposition.typeOfHit == MovingObjectType.BLOCK) { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - world.spawnEntityInWorld(new EntityLightningBolt(world, i, j, k)); - } else if (movingobjectposition.typeOfHit == MovingObjectType.ENTITY) { - Entity entityhit = movingobjectposition.entityHit; - double x = entityhit.posX; - double y = entityhit.posY; - double z = entityhit.posZ; - world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z)); - } - if (player.capabilities.isCreativeMode) { - return itemstack; - } else { - itemstack.damageItem(20, player); - return itemstack; - } - } - - @Override - public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { - entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 12F); - itemstack.damageItem(1, attacker); - return true; - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { - list.add("The Hammer of Thor"); - } -} diff --git a/src/main/java/tombenpotter/emt/common/module/base/items/foci/ItemChristmasFocus.java b/src/main/java/tombenpotter/emt/common/module/base/items/foci/ItemChristmasFocus.java deleted file mode 100644 index 4223b94..0000000 --- a/src/main/java/tombenpotter/emt/common/module/base/items/foci/ItemChristmasFocus.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Tombenpotter. - * All rights reserved. - * - * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html - * - * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. - * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. - * http://www.minecraftforum.net/topic/1585216- - ******************************************************************************/ - -package tombenpotter.emt.common.module.base.items.foci; - -import net.minecraft.entity.monster.EntitySnowman; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; -import thaumcraft.common.items.wands.ItemWandCasting; - -public class ItemChristmasFocus extends ItemBaseFocus { - - private static final AspectList visCost = new AspectList().add(Aspect.ORDER, 500).add(Aspect.AIR, 500); - - public ItemChristmasFocus() { - super("focus.christmas", "focus_christmas"); - } - - @Override - public int getFocusColor() { - return 99999999; - } - - @Override - public AspectList getVisCost() { - return visCost; - } - - @Override - public String getSortingHelper(ItemStack itemstack) { - return "CHRISTMAS"; - } - - @Override - public ItemStack onFocusRightClick(ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition mop) { - ItemWandCasting wand = (ItemWandCasting) itemstack.getItem(); - if ((mop != null) && (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)) { - int x = mop.blockX; - int y = mop.blockY + 1; - int z = mop.blockZ; - if (wand.consumeAllVis(itemstack, player, getVisCost(), true, true)) { - if (!world.isRemote) { - EntitySnowman snowman; - snowman = new EntitySnowman(world); - snowman.setPosition(x, y, z); - world.spawnEntityInWorld(snowman); - } - } - player.swingItem(); - } - return itemstack; - } -} diff --git a/src/main/java/tombenpotter/emt/common/module/base/items/tools/ItemBaseChainsaw.java b/src/main/java/tombenpotter/emt/common/module/base/items/tools/ItemBaseChainsaw.java deleted file mode 100644 index 976e38c..0000000 --- a/src/main/java/tombenpotter/emt/common/module/base/items/tools/ItemBaseChainsaw.java +++ /dev/null @@ -1,127 +0,0 @@ -package tombenpotter.emt.common.module.base.items.tools; - -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.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.ItemAxe; -import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatList; -import net.minecraft.world.World; -import net.minecraftforge.common.IShearable; -import tombenpotter.emt.ElectroMagicTools; -import tombenpotter.emt.ModInformation; -import tombenpotter.emt.common.util.ConfigHandler; -import tombenpotter.emt.common.util.RandomHelper; - -import java.util.ArrayList; -import java.util.Random; - -public class ItemBaseChainsaw extends ItemAxe { - - public String textureName; - - public ItemBaseChainsaw(ToolMaterial material, int maxDamage, String textureName) { - super(material); - this.setCreativeTab(ElectroMagicTools.tabEMT); - this.setMaxStackSize(1); - this.setMaxDamage(maxDamage); - this.textureName = textureName; - this.efficiencyOnProperMaterial = this.toolMaterial.getEfficiencyOnProperMaterial(); - } - - @SideOnly(Side.CLIENT) - @Override - public void registerIcons(IIconRegister iconRegister) { - this.itemIcon = iconRegister.registerIcon(ModInformation.texturePath + ":tools/chainsaws" + textureName); - } - - @Override - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entityLiving) { - if ((double) block.getBlockHardness(world, x, y, z) != 0.0D) stack.damageItem(1, entityLiving); - return true; - } - - @Override - public boolean canHarvestBlock(Block block, ItemStack stack) { - return false; - } - - @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) { - if (block.getHarvestTool(meta) == null) { - return efficiencyOnProperMaterial; - } else { - if ((canHarvestBlock(block, stack) && (block.getHarvestTool(meta).equals("axe")) || Items.shears.canHarvestBlock(block, stack))) { - return efficiencyOnProperMaterial; - } - } - return super.getDigSpeed(stack, block, meta); - } - - @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) { - return RandomHelper.placeTorch(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset); - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public boolean getIsRepairable(ItemStack stack1, ItemStack stack2) { - return false; - } - - @Override - public int getItemEnchantability() { - if (ConfigHandler.enchanting == false) return 0; - else return toolMaterial.getEnchantability(); - } - - @Override - public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) { - return ConfigHandler.enchanting; - } - - @Override - public boolean hitEntity(ItemStack stack, EntityLivingBase entityliving, EntityLivingBase attacker) { - stack.damageItem(1, attacker); - return true; - } - - @Override - public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) { - if (player.worldObj.isRemote) { - return false; - } - Block block = player.worldObj.getBlock(x, y, z); - if (block instanceof IShearable) { - IShearable target = (IShearable) block; - if (target.isShearable(stack, player.worldObj, x, y, z)) { - ArrayList drops = target.onSheared(stack, player.worldObj, x, y, z, - EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); - Random rand = new Random(); - for (ItemStack drop : drops) { - float f = 0.7F; - double d = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - double d1 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - double d2 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItem(player.worldObj, (double) x + d, (double) y + d1, (double) z + d2, drop); - entityitem.delayBeforeCanPickup = 10; - player.worldObj.spawnEntityInWorld(entityitem); - } - stack.damageItem(1, player); - player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); - } - } - return false; - } -} diff --git a/src/main/java/tombenpotter/emt/common/module/base/items/tools/ItemBaseDrill.java b/src/main/java/tombenpotter/emt/common/module/base/items/tools/ItemBaseDrill.java deleted file mode 100644 index 57d09f7..0000000 --- a/src/main/java/tombenpotter/emt/common/module/base/items/tools/ItemBaseDrill.java +++ /dev/null @@ -1,89 +0,0 @@ -package tombenpotter.emt.common.module.base.items.tools; - -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.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemPickaxe; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import tombenpotter.emt.ElectroMagicTools; -import tombenpotter.emt.ModInformation; -import tombenpotter.emt.common.util.ConfigHandler; -import tombenpotter.emt.common.util.RandomHelper; - -public class ItemBaseDrill extends ItemPickaxe { - - public String textureName; - - public ItemBaseDrill(ToolMaterial material, int maxDamage, String textureName) { - super(material); - this.setCreativeTab(ElectroMagicTools.tabEMT); - this.setMaxStackSize(1); - this.setMaxDamage(maxDamage); - this.textureName = textureName; - this.efficiencyOnProperMaterial = this.toolMaterial.getEfficiencyOnProperMaterial(); - } - - @SideOnly(Side.CLIENT) - @Override - public void registerIcons(IIconRegister iconRegister) { - this.itemIcon = iconRegister.registerIcon(ModInformation.texturePath + ":tools/drills/" + textureName); - } - - @Override - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entityLiving) { - if ((double) block.getBlockHardness(world, x, y, z) != 0.0D) stack.damageItem(1, entityLiving); - return true; - } - - @Override - public boolean canHarvestBlock(Block block, ItemStack stack) { - return false; - } - - @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) { - if (block.getHarvestTool(meta) == null) { - return efficiencyOnProperMaterial; - } else { - if (canHarvestBlock(block, stack) && (block.getHarvestTool(meta).equals("pickaxe") || block.getHarvestTool(meta).equals("shovel"))) { - return efficiencyOnProperMaterial; - } - } - return super.getDigSpeed(stack, block, meta); - } - - @Override - public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) { - return true; - } - - @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) { - return RandomHelper.placeTorch(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset); - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public boolean getIsRepairable(ItemStack stack1, ItemStack stack2) { - return false; - } - - @Override - public int getItemEnchantability() { - if (ConfigHandler.enchanting == false) return 0; - else return toolMaterial.getEnchantability(); - } - - @Override - public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) { - return ConfigHandler.enchanting; - } -} diff --git a/src/main/java/tombenpotter/emt/common/module/base/items/tools/ItemBaseOmnitool.java b/src/main/java/tombenpotter/emt/common/module/base/items/tools/ItemBaseOmnitool.java deleted file mode 100644 index fbb3d5c..0000000 --- a/src/main/java/tombenpotter/emt/common/module/base/items/tools/ItemBaseOmnitool.java +++ /dev/null @@ -1,122 +0,0 @@ -package tombenpotter.emt.common.module.base.items.tools; - -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.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.ItemPickaxe; -import net.minecraft.item.ItemStack; -import net.minecraft.stats.StatList; -import net.minecraft.world.World; -import net.minecraftforge.common.IShearable; -import tombenpotter.emt.ElectroMagicTools; -import tombenpotter.emt.ModInformation; -import tombenpotter.emt.common.util.ConfigHandler; -import tombenpotter.emt.common.util.RandomHelper; - -import java.util.ArrayList; -import java.util.Random; - -public class ItemBaseOmnitool extends ItemPickaxe { - - public String textureName; - - public ItemBaseOmnitool(ToolMaterial material, int maxDamage, String textureName) { - super(material); - this.setCreativeTab(ElectroMagicTools.tabEMT); - this.setMaxStackSize(1); - this.setMaxDamage(maxDamage); - this.textureName = textureName; - this.efficiencyOnProperMaterial = this.toolMaterial.getEfficiencyOnProperMaterial(); - } - - @SideOnly(Side.CLIENT) - @Override - public void registerIcons(IIconRegister iconRegister) { - this.itemIcon = iconRegister.registerIcon(ModInformation.texturePath + ":tools/omnitools" + textureName); - } - - @Override - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entityLiving) { - if ((double) block.getBlockHardness(world, x, y, z) != 0.0D) stack.damageItem(1, entityLiving); - return true; - } - - @Override - public boolean canHarvestBlock(Block block, ItemStack stack) { - return false; - } - - @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) { - if (block.getHarvestTool(meta) == null) { - return efficiencyOnProperMaterial; - } else { - if (canHarvestBlock(block, stack) && (block.getHarvestTool(meta).equals("pickaxe") || block.getHarvestTool(meta).equals("shovel")) || block.getHarvestTool(meta).equals("axe") || Items.shears.canHarvestBlock(block, stack)) { - return efficiencyOnProperMaterial; - } - } - return super.getDigSpeed(stack, block, meta); - } - - @Override - public boolean hitEntity(ItemStack stack, EntityLivingBase entityliving, EntityLivingBase attacker) { - stack.damageItem(1, attacker); - return true; - } - - @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) { - return RandomHelper.placeTorch(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset); - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public int getItemEnchantability() { - if (ConfigHandler.enchanting == false) return 0; - else return toolMaterial.getEnchantability(); - } - - @Override - public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) { - return ConfigHandler.enchanting; - } - - @Override - public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) { - if (player.worldObj.isRemote) { - return false; - } - Block block = player.worldObj.getBlock(x, y, z); - if (block instanceof IShearable) { - IShearable target = (IShearable) block; - if (target.isShearable(stack, player.worldObj, x, y, z)) { - ArrayList drops = target.onSheared(stack, player.worldObj, x, y, z, - EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); - Random rand = new Random(); - for (ItemStack drop : drops) { - float f = 0.7F; - double d = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - double d1 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - double d2 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItem(player.worldObj, (double) x + d, (double) y + d1, (double) z + d2, drop); - entityitem.delayBeforeCanPickup = 10; - player.worldObj.spawnEntityInWorld(entityitem); - } - stack.damageItem(1, player); - player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); - } - } - return false; - } -} diff --git a/src/main/java/tombenpotter/emt/common/module/ic2/IC2ModuleItemRegistry.java b/src/main/java/tombenpotter/emt/common/module/ic2/IC2ModuleItemRegistry.java index 1e6dbc1..8fe6f7c 100644 --- a/src/main/java/tombenpotter/emt/common/module/ic2/IC2ModuleItemRegistry.java +++ b/src/main/java/tombenpotter/emt/common/module/ic2/IC2ModuleItemRegistry.java @@ -19,9 +19,12 @@ import net.minecraftforge.common.util.EnumHelper; import thaumcraft.api.ThaumcraftApi; import tombenpotter.emt.ModInformation; import tombenpotter.emt.common.module.base.items.*; -import tombenpotter.emt.common.module.base.items.foci.ItemChristmasFocus; -import tombenpotter.emt.common.module.base.items.foci.ItemExplosionFocus; -import tombenpotter.emt.common.module.base.items.foci.ItemShieldFocus; +import tombenpotter.emt.common.modules.base.items.ItemMaterials; +import tombenpotter.emt.common.modules.base.items.armor.ItemFeatherWing; +import tombenpotter.emt.common.modules.base.items.armor.ItemThaumiumReinforcedWing; +import tombenpotter.emt.common.modules.base.items.foci.ItemChristmasFocus; +import tombenpotter.emt.common.modules.base.items.foci.ItemExplosionFocus; +import tombenpotter.emt.common.modules.base.items.foci.ItemShieldFocus; import tombenpotter.emt.common.module.ic2.items.ItemElectricScribingTools; import tombenpotter.emt.common.module.ic2.items.armor.boots.ItemElectricBootsTraveller; import tombenpotter.emt.common.module.ic2.items.armor.boots.ItemNanoBootsTraveller; @@ -44,6 +47,8 @@ import tombenpotter.emt.common.module.ic2.items.tools.drills.ItemThaumiumDrill; import tombenpotter.emt.common.module.ic2.items.tools.omnitools.ItemOmnitoolDiamond; import tombenpotter.emt.common.module.ic2.items.tools.omnitools.ItemOmnitoolIron; import tombenpotter.emt.common.module.ic2.items.tools.omnitools.ItemOmnitoolThaumium; +import tombenpotter.emt.common.modules.base.items.tools.ItemThorHammerBroken; +import tombenpotter.emt.common.modules.base.items.tools.ItemThorHammer; public class IC2ModuleItemRegistry { @@ -82,7 +87,7 @@ public class IC2ModuleItemRegistry { public static ItemArmor.ArmorMaterial featherWingMaterial = EnumHelper.addArmorMaterial("FEATEHRWiNG", 1, new int[]{2, 2, 2, 2}, 6); public static void registerItems() { - itemEMTItems = new ItemEMTItems().setUnlocalizedName(ModInformation.modid + ".emtitems"); + itemEMTItems = new ItemMaterials().setUnlocalizedName(ModInformation.modid + ".emtitems"); GameRegistry.registerItem(itemEMTItems, "EMTItems"); emtBauble = new ItemEMTBaubles().setUnlocalizedName(ModInformation.modid + ".emtbauble"); GameRegistry.registerItem(emtBauble, "EMTBaubles"); @@ -115,7 +120,7 @@ public class IC2ModuleItemRegistry { quantumWing = new ItemQuantumWing(ItemArmor.ArmorMaterial.DIAMOND, 7, 1).setUnlocalizedName(ModInformation.modid + ".wing.quantum"); GameRegistry.registerItem(quantumWing, "QuantumWing"); - taintedThorHammer = new ItemTaintedThorHammer().setUnlocalizedName(ModInformation.modid + ".hammer.broken"); + taintedThorHammer = new ItemThorHammerBroken().setUnlocalizedName(ModInformation.modid + ".hammer.broken"); GameRegistry.registerItem(taintedThorHammer, "TaintedMjolnir"); thorHammer = new ItemThorHammer().setUnlocalizedName(ModInformation.modid + ".hammer"); GameRegistry.registerItem(thorHammer, "Mjolnir"); diff --git a/src/main/java/tombenpotter/emt/common/module/ic2/IC2ModuleTERegistry.java b/src/main/java/tombenpotter/emt/common/module/ic2/IC2ModuleTERegistry.java index af74a39..0a713e7 100644 --- a/src/main/java/tombenpotter/emt/common/module/ic2/IC2ModuleTERegistry.java +++ b/src/main/java/tombenpotter/emt/common/module/ic2/IC2ModuleTERegistry.java @@ -13,7 +13,7 @@ package tombenpotter.emt.common.module.ic2; import cpw.mods.fml.common.registry.GameRegistry; -import tombenpotter.emt.common.module.base.tile.TileEntityPortableNode; +import tombenpotter.emt.common.modules.base.tile.TileEntityPortableNode; import tombenpotter.emt.common.module.ic2.tile.TileEntityEtherealMacerator; import tombenpotter.emt.common.module.ic2.tile.TileEntityIndustrialWandRecharge; import tombenpotter.emt.common.module.ic2.tile.generators.*; diff --git a/src/main/java/tombenpotter/emt/common/module/ic2/blocks/BlockPortableNode.java b/src/main/java/tombenpotter/emt/common/module/ic2/blocks/BlockPortableNode.java index 8d95986..9d70e00 100644 --- a/src/main/java/tombenpotter/emt/common/module/ic2/blocks/BlockPortableNode.java +++ b/src/main/java/tombenpotter/emt/common/module/ic2/blocks/BlockPortableNode.java @@ -27,7 +27,7 @@ import net.minecraft.world.World; import thaumcraft.common.blocks.BlockAiry; import tombenpotter.emt.ElectroMagicTools; import tombenpotter.emt.ModInformation; -import tombenpotter.emt.common.module.base.tile.TileEntityPortableNode; +import tombenpotter.emt.common.modules.base.tile.TileEntityPortableNode; import java.util.List; import java.util.Random; diff --git a/src/main/java/tombenpotter/emt/common/module/ic2/items/armor/wings/ItemNanoWing.java b/src/main/java/tombenpotter/emt/common/module/ic2/items/armor/wings/ItemNanoWing.java index eb82465..f5618f7 100644 --- a/src/main/java/tombenpotter/emt/common/module/ic2/items/armor/wings/ItemNanoWing.java +++ b/src/main/java/tombenpotter/emt/common/module/ic2/items/armor/wings/ItemNanoWing.java @@ -18,7 +18,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.ISpecialArmor; import tombenpotter.emt.ElectroMagicTools; import tombenpotter.emt.ModInformation; -import tombenpotter.emt.common.module.base.items.ItemThaumiumReinforcedWing; +import tombenpotter.emt.common.modules.base.items.armor.ItemThaumiumReinforcedWing; import tombenpotter.emt.common.util.ConfigHandler; import java.util.List; diff --git a/src/main/java/tombenpotter/emt/common/module/ic2/items/tools/ItemElectricThorHammer.java b/src/main/java/tombenpotter/emt/common/module/ic2/items/tools/ItemElectricThorHammer.java index a46761e..558d021 100644 --- a/src/main/java/tombenpotter/emt/common/module/ic2/items/tools/ItemElectricThorHammer.java +++ b/src/main/java/tombenpotter/emt/common/module/ic2/items/tools/ItemElectricThorHammer.java @@ -30,7 +30,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; import tombenpotter.emt.ElectroMagicTools; import tombenpotter.emt.ModInformation; -import tombenpotter.emt.common.module.base.entities.EntityArcher; +import tombenpotter.emt.common.modules.base.entities.EntityArcher; import tombenpotter.emt.common.util.ConfigHandler; import tombenpotter.emt.common.util.TextHelper; diff --git a/src/main/java/tombenpotter/emt/common/module/vanilla/VanillaItemsRegistry.java b/src/main/java/tombenpotter/emt/common/module/vanilla/VanillaItemsRegistry.java index be5dcf3..9725ae7 100644 --- a/src/main/java/tombenpotter/emt/common/module/vanilla/VanillaItemsRegistry.java +++ b/src/main/java/tombenpotter/emt/common/module/vanilla/VanillaItemsRegistry.java @@ -8,44 +8,25 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.oredict.OreDictionary; import tombenpotter.emt.ModInformation; -import tombenpotter.emt.common.module.vanilla.items.ItemCraftingComponent; -import tombenpotter.emt.common.module.vanilla.items.ItemShardCarver; -import tombenpotter.emt.common.module.vanilla.items.tools.ItemVanillaChainsaw; -import tombenpotter.emt.common.module.vanilla.items.tools.ItemVanillaDrill; -import tombenpotter.emt.common.module.vanilla.items.tools.ItemVanillaOmnitool; +import tombenpotter.emt.common.modules.base.items.ItemBaseBaubles; +import tombenpotter.emt.common.modules.base.items.ItemCraftingComponents; +import tombenpotter.emt.common.modules.base.items.ItemMaterials; +import tombenpotter.emt.common.modules.base.items.ItemShardCarver; +import tombenpotter.emt.common.modules.base.items.foci.ItemChristmasFocus; +import tombenpotter.emt.common.modules.base.items.tools.*; public class VanillaItemsRegistry { - public static Item woodenDrill; - public static Item stoneDrill; - public static Item ironDrill; - public static Item goldenDrill; - public static Item diamondDrill; - public static Item copperDrill; - public static Item tinDrill; - public static Item leadDrill; - public static Item bronzeDrill; - - public static Item woodenChainsaw; - public static Item stoneChainsaw; - public static Item ironChainsaw; - public static Item goldenChainsaw; - public static Item diamondChainsaw; - public static Item copperChainsaw; - public static Item tinChainsaw; - public static Item leadChainsaw; - public static Item bronzeChainsaw; - - public static Item ironOmnitool; - public static Item goldenOmnitool; - public static Item diamondOmnitool; - public static Item copperOmnitool; - public static Item tinOmnitool; - public static Item leadOmnitool; - public static Item bronzeOmnitool; - - public static Item craftingComponent; + public static Item woodenDrill, stoneDrill, ironDrill, goldenDrill, diamondDrill, copperDrill, tinDrill, leadDrill, bronzeDrill; + public static Item woodenChainsaw, stoneChainsaw, ironChainsaw, goldenChainsaw, diamondChainsaw, copperChainsaw, tinChainsaw, leadChainsaw, bronzeChainsaw; + public static Item ironOmnitool, goldenOmnitool, diamondOmnitool, copperOmnitool, tinOmnitool, leadOmnitool, bronzeOmnitool; public static Item woodCarver, stoneCarver, ironCarver, obsidianCarver, diamondCarver; + public static Item baseBaubles, materials, craftingComponents; + + public static Item thorHammer; + public static Item thorHammerBroken; + + public static Item focusChristmas; public static Item.ToolMaterial copperMaterial = EnumHelper.addToolMaterial("copperToolMaterial", 2, 300, 6.0F, 2.0F, 14); public static Item.ToolMaterial tinMaterial = EnumHelper.addToolMaterial("tinToolMatierial", 2, 200, 8.0F, 4F, 18); @@ -53,8 +34,18 @@ public class VanillaItemsRegistry { public static Item.ToolMaterial bronzeMaterial = EnumHelper.addToolMaterial("bronzeToolMaterial", 2, 350, 7.0F, 3.0F, 16); public static void registerItems() { - craftingComponent = new ItemCraftingComponent().setUnlocalizedName(ModInformation.modid + ".material"); - GameRegistry.registerItem(craftingComponent, "craftingComponents"); + craftingComponents = new ItemCraftingComponents("components"); + GameRegistry.registerItem(craftingComponents, "craftingComponents"); + baseBaubles = new ItemBaseBaubles(); + GameRegistry.registerItem(baseBaubles, "BaseBaubles"); + materials = new ItemMaterials(); + GameRegistry.registerItem(materials, "Materials"); + thorHammer = new ItemThorHammer(); + GameRegistry.registerItem(thorHammer, "ThorHammer"); + thorHammerBroken = new ItemThorHammerBroken(); + GameRegistry.registerItem(thorHammerBroken, "ThorHammerBroken"); + focusChristmas = new ItemChristmasFocus(); + GameRegistry.registerItem(focusChristmas, "FocusChristmas"); woodCarver = new ItemShardCarver(8).setUnlocalizedName(ModInformation.modid + ".carver.wood"); GameRegistry.registerItem(woodCarver, "woodCarver"); diff --git a/src/main/java/tombenpotter/emt/common/module/vanilla/VanillaItemstacks.java b/src/main/java/tombenpotter/emt/common/module/vanilla/VanillaItemstacks.java index 381e0d1..2b83cc4 100644 --- a/src/main/java/tombenpotter/emt/common/module/vanilla/VanillaItemstacks.java +++ b/src/main/java/tombenpotter/emt/common/module/vanilla/VanillaItemstacks.java @@ -32,43 +32,43 @@ public class VanillaItemstacks { public static ItemStack leadOmnitool = new ItemStack(VanillaItemsRegistry.leadOmnitool); public static ItemStack bronzeOmnitool = new ItemStack(VanillaItemsRegistry.bronzeOmnitool); - public static ItemStack woodenDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 0); - public static ItemStack stoneDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 1); - public static ItemStack ironDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 2); - public static ItemStack goldenDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 3); - public static ItemStack diamondDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 4); - public static ItemStack copperDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 5); - public static ItemStack tinDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 6); - public static ItemStack leadDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 7); - public static ItemStack bronzeDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 8); + public static ItemStack woodenDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 0); + public static ItemStack stoneDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 1); + public static ItemStack ironDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 2); + public static ItemStack goldenDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 3); + public static ItemStack diamondDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 4); + public static ItemStack copperDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 5); + public static ItemStack tinDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 6); + public static ItemStack leadDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 7); + public static ItemStack bronzeDrillTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 8); - public static ItemStack woodenChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 9); - public static ItemStack stoneChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 10); - public static ItemStack ironChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 11); - public static ItemStack goldenChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 12); - public static ItemStack diamondChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 13); - public static ItemStack copperChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 14); - public static ItemStack tinChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 15); - public static ItemStack leadChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 16); - public static ItemStack bronzeChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 17); + public static ItemStack woodenChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 9); + public static ItemStack stoneChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 10); + public static ItemStack ironChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 11); + public static ItemStack goldenChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 12); + public static ItemStack diamondChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 13); + public static ItemStack copperChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 14); + public static ItemStack tinChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 15); + public static ItemStack leadChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 16); + public static ItemStack bronzeChainsawTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 17); - public static ItemStack ironOmnitoolTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 18); - public static ItemStack goldenOmnitoolTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 19); - public static ItemStack diamondOmnitoolTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 20); - public static ItemStack copperOmnitoolTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 21); - public static ItemStack tinOmnitoolTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 22); - public static ItemStack leadOmnitoolTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 23); - public static ItemStack bronzeOmnitoolTop = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 24); + public static ItemStack ironOmnitoolTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 18); + public static ItemStack goldenOmnitoolTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 19); + public static ItemStack diamondOmnitoolTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 20); + public static ItemStack copperOmnitoolTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 21); + public static ItemStack tinOmnitoolTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 22); + public static ItemStack leadOmnitoolTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 23); + public static ItemStack bronzeOmnitoolTop = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 24); - public static ItemStack woodenShard = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 25); - public static ItemStack stoneShard = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 26); - public static ItemStack ironShard = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 27); - public static ItemStack goldenShard = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 28); - public static ItemStack obsidianShard = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 29); - public static ItemStack copperShard = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 30); - public static ItemStack tinShard = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 31); - public static ItemStack leadShard = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 32); - public static ItemStack bronzeShard = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 33); + public static ItemStack woodenShard = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 25); + public static ItemStack stoneShard = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 26); + public static ItemStack ironShard = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 27); + public static ItemStack goldenShard = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 28); + public static ItemStack obsidianShard = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 29); + public static ItemStack copperShard = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 30); + public static ItemStack tinShard = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 31); + public static ItemStack leadShard = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 32); + public static ItemStack bronzeShard = new ItemStack(VanillaItemsRegistry.craftingComponents, 1, 33); public static ItemStack woodenCarver = new ItemStack(VanillaItemsRegistry.woodCarver, 1, OreDictionary.WILDCARD_VALUE); public static ItemStack stoneCarver = new ItemStack(VanillaItemsRegistry.stoneCarver, 1, OreDictionary.WILDCARD_VALUE); diff --git a/src/main/java/tombenpotter/emt/common/modules/ModuleRegistry.java b/src/main/java/tombenpotter/emt/common/modules/ModuleRegistry.java index a657d08..fa7691c 100644 --- a/src/main/java/tombenpotter/emt/common/modules/ModuleRegistry.java +++ b/src/main/java/tombenpotter/emt/common/modules/ModuleRegistry.java @@ -1,21 +1,10 @@ package tombenpotter.emt.common.modules; -import tombenpotter.emt.common.modules.base.blocks.BaseBlockRegistry; -import tombenpotter.emt.common.modules.base.BaseRecipeRegistry; -import tombenpotter.emt.common.modules.base.items.BaseItemRegistry; -import tombenpotter.emt.common.modules.ic2.IC2RecipeRegistry; -import tombenpotter.emt.common.modules.ic2.blocks.IC2BlockRegistry; -import tombenpotter.emt.common.modules.ic2.items.IC2ItemRegistry; -import tombenpotter.emt.common.modules.te.TERecipeRegistry; -import tombenpotter.emt.common.modules.te.blocks.TEBlockRegistry; -import tombenpotter.emt.common.modules.te.items.TEItemRegistry; -import tombenpotter.emt.common.util.ConfigHandler; - public class ModuleRegistry { - public static void RegisterModules() { - - BaseBlockRegistry.registerBaseBlocks(); + public static void registerModules() { +/* + BaseBlockRegistry.registerBaseBlocks(); BaseItemRegistry.registerBaseItems(); BaseRecipeRegistry.registerBaseRecipes(); @@ -30,5 +19,6 @@ public class ModuleRegistry { TEItemRegistry.registerTEItems(); TERecipeRegistry.registerTERecipes(); } - } + */ + } } diff --git a/src/main/java/tombenpotter/emt/common/modules/base/entities/BaseEntityRegistry.java b/src/main/java/tombenpotter/emt/common/modules/base/entities/BaseEntityRegistry.java index 7cf0600..a624506 100644 --- a/src/main/java/tombenpotter/emt/common/modules/base/entities/BaseEntityRegistry.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/entities/BaseEntityRegistry.java @@ -1,5 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ + package tombenpotter.emt.common.modules.base.entities; +import cpw.mods.fml.common.registry.EntityRegistry; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityList.EntityEggInfo; +import net.minecraft.entity.EntityLiving; +import tombenpotter.emt.ElectroMagicTools; + public class BaseEntityRegistry { + private static int startEID = 300; + private static int entityIDs = 0; + private static final Class ARCHER_CLASS = EntityArcher.class; + + private static int getUniqueEntityID() { + + do { + startEID++; + } while (EntityList.getStringFromID(startEID) != null); + return startEID; + } + + @SuppressWarnings("unchecked") + public static void registerEntityEgg(Class entity, int colPrim, int colSec) { + int id = getUniqueEntityID(); + EntityList.IDtoClassMapping.put(id, entity); + EntityList.entityEggs.put(id, new EntityEggInfo(id, colPrim, colSec)); + return; + } + + public static void registerEMTEntities() { + + EntityRegistry.registerModEntity(EntityLaser.class, "entityLaser", entityIDs++, ElectroMagicTools.instance, 80, 3, true); + EntityRegistry.registerModEntity(EntityArcher.class, "entityArcher", entityIDs++, ElectroMagicTools.instance, 80, 3, true); + registerEntityEgg(ARCHER_CLASS, 0x99111F, 0xE5685); + } } diff --git a/src/main/java/tombenpotter/emt/common/modules/base/entities/EntityArcher.java b/src/main/java/tombenpotter/emt/common/modules/base/entities/EntityArcher.java index e1f1845..51a7a3f 100644 --- a/src/main/java/tombenpotter/emt/common/modules/base/entities/EntityArcher.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/entities/EntityArcher.java @@ -1,3 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ + package tombenpotter.emt.common.modules.base.entities; import net.minecraft.enchantment.Enchantment; @@ -25,93 +37,93 @@ import net.minecraftforge.common.IExtendedEntityProperties; public class EntityArcher extends EntitySnowman implements IExtendedEntityProperties { - public EntityArcher(World par1World) { - super(par1World); - this.isImmuneToFire = true; - this.tasks.addTask(1, new EntityAISwimming(this)); - this.tasks.addTask(2, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); - this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, true, false, IMob.mobSelector)); - this.tasks.addTask(4, new EntityAIWander(this, 0.30D)); - } + public EntityArcher(World par1World) { + super(par1World); + this.isImmuneToFire = true; + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, true, false, IMob.mobSelector)); + this.tasks.addTask(4, new EntityAIWander(this, 0.30D)); + } - @Override - protected void applyEntityAttributes() { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30D); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); - } + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); + } - @Override - public void onDeath(DamageSource par1DamageSource) { - super.onDeath(par1DamageSource); - this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 1, true); - this.setDead(); - } + @Override + public void onDeath(DamageSource par1DamageSource) { + super.onDeath(par1DamageSource); + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 1, true); + this.setDead(); + } - @Override - protected Item getDropItem() { - return Items.arrow; - } + @Override + protected Item getDropItem() { + return Items.arrow; + } - @Override - protected void dropFewItems(boolean par1, int par2) { - int j; - int k; + @Override + protected void dropFewItems(boolean par1, int par2) { + int j; + int k; - j = this.rand.nextInt(3 + par2); + j = this.rand.nextInt(3 + par2); - for (k = 0; k < j; ++k) { - this.dropItem(Items.arrow, 1); - } - j = this.rand.nextInt(3 + par2); + for (k = 0; k < j; ++k) { + this.dropItem(Items.arrow, 1); + } + j = this.rand.nextInt(3 + par2); - for (k = 0; k < j; ++k) { - this.dropItem(Items.bone, 1); - } - } + for (k = 0; k < j; ++k) { + this.dropItem(Items.bone, 1); + } + } - @Override - protected void dropRareDrop(int par1) { - this.entityDropItem(new ItemStack(Blocks.web, 1, 1), 0.0F); - } + @Override + protected void dropRareDrop(int par1) { + this.entityDropItem(new ItemStack(Blocks.web, 1, 1), 0.0F); + } - protected void addRandomArmor() { - super.addRandomArmor(); - this.setCurrentItemOrArmor(0, new ItemStack(Items.bow)); - } + protected void addRandomArmor() { + super.addRandomArmor(); + this.setCurrentItemOrArmor(0, new ItemStack(Items.bow)); + } - @Override - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { - EntityArrow entityarrow = new EntityArrow(this.worldObj, this, par1EntityLivingBase, 1.6F, (float) (14 - this.worldObj.difficultySetting.getDifficultyId() * 4)); - int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem()); - int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem()); - entityarrow.setDamage((double) (par2 * 2.0F) + this.rand.nextGaussian() * 0.25D + (double) ((float) this.worldObj.difficultySetting.getDifficultyId() * 0.11F)); + @Override + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { + EntityArrow entityarrow = new EntityArrow(this.worldObj, this, par1EntityLivingBase, 1.6F, (float) (14 - this.worldObj.difficultySetting.getDifficultyId() * 4)); + int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem()); + int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem()); + entityarrow.setDamage((double) (par2 * 2.0F) + this.rand.nextGaussian() * 0.25D + (double) ((float) this.worldObj.difficultySetting.getDifficultyId() * 0.11F)); - if (i > 0) { - entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D); - } + if (i > 0) { + entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D); + } - if (j > 0) { - entityarrow.setKnockbackStrength(j); - } + if (j > 0) { + entityarrow.setKnockbackStrength(j); + } - if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0) { - entityarrow.setFire(100); - } + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0) { + entityarrow.setFire(100); + } - this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); - this.worldObj.spawnEntityInWorld(entityarrow); - } + this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); + this.worldObj.spawnEntityInWorld(entityarrow); + } - @Override - public void saveNBTData(NBTTagCompound compound) { - } + @Override + public void saveNBTData(NBTTagCompound compound) { + } - @Override - public void loadNBTData(NBTTagCompound compound) { - } + @Override + public void loadNBTData(NBTTagCompound compound) { + } - @Override - public void init(Entity entity, World world) { - } -} \ No newline at end of file + @Override + public void init(Entity entity, World world) { + } +} diff --git a/src/main/java/tombenpotter/emt/common/module/base/entities/EntityLaser.java b/src/main/java/tombenpotter/emt/common/modules/base/entities/EntityLaser.java similarity index 99% rename from src/main/java/tombenpotter/emt/common/module/base/entities/EntityLaser.java rename to src/main/java/tombenpotter/emt/common/modules/base/entities/EntityLaser.java index 4c36f9f..a64e579 100644 --- a/src/main/java/tombenpotter/emt/common/module/base/entities/EntityLaser.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/entities/EntityLaser.java @@ -10,7 +10,7 @@ * http://www.minecraftforum.net/topic/1585216- ******************************************************************************/ -package tombenpotter.emt.common.module.base.entities; +package tombenpotter.emt.common.modules.base.entities; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/tombenpotter/emt/common/modules/base/items/BaseItemRegistry.java b/src/main/java/tombenpotter/emt/common/modules/base/items/BaseItemRegistry.java deleted file mode 100644 index 6b7eab8..0000000 --- a/src/main/java/tombenpotter/emt/common/modules/base/items/BaseItemRegistry.java +++ /dev/null @@ -1,36 +0,0 @@ -package tombenpotter.emt.common.modules.base.items; - -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.item.Item; -import tombenpotter.emt.common.modules.base.items.foci.ItemChristmasFocus; -import tombenpotter.emt.common.modules.base.items.tools.ItemThorHammer; -import tombenpotter.emt.common.modules.base.items.tools.ItemThorHammerBroken; - -public class BaseItemRegistry { - - public static Item baseBaubles; - public static Item materials; - public static Item toolMaterials; - - public static Item thorHammer; - public static Item thorHammerBroken; - - public static Item focusChristmas; - - public static void registerBaseItems() { - baseBaubles = new ItemBaseBaubles(); - GameRegistry.registerItem(baseBaubles, "BaseBaubles"); - materials = new ItemMaterials(); - GameRegistry.registerItem(materials, "Materials"); - toolMaterials = new ItemToolMaterials(); - GameRegistry.registerItem(toolMaterials, "ToolMaterials"); - - thorHammer = new ItemThorHammer(); - GameRegistry.registerItem(thorHammer, "ThorHammer"); - thorHammerBroken = new ItemThorHammerBroken(); - GameRegistry.registerItem(thorHammerBroken, "ThorHammerBroken"); - - focusChristmas = new ItemChristmasFocus(); - GameRegistry.registerItem(focusChristmas, "FocusChristmas"); - } -} diff --git a/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBase.java b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBase.java index e4f02bf..5913409 100644 --- a/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBase.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBase.java @@ -6,18 +6,16 @@ import tombenpotter.emt.ModInformation; public class ItemBase extends Item { - public ItemBase(String unlocName, String textureName) { - super(); + public ItemBase(String unlocName, String textureName) { + super(); + setUnlocalizedName(ModInformation.modid + ".module.base." + unlocName); + setTextureName(ModInformation.texturePath + ":" + textureName); + setCreativeTab(ElectroMagicTools.tabEMT); + } - setUnlocalizedName(ModInformation.modid + ".module.base." + unlocName); - setTextureName(ModInformation.texturePath + ":" + textureName); - setCreativeTab(ElectroMagicTools.tabEMT); - } - - public ItemBase(String unlocName) { - super(); - - setUnlocalizedName(ModInformation.modid + ".module.base." + unlocName); - setCreativeTab(ElectroMagicTools.tabEMT); - } + public ItemBase(String unlocName) { + super(); + setUnlocalizedName(ModInformation.modid + ".module.base." + unlocName); + setCreativeTab(ElectroMagicTools.tabEMT); + } } diff --git a/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBaseChainsaw.java b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBaseChainsaw.java index 43f2423..7342dfd 100644 --- a/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBaseChainsaw.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBaseChainsaw.java @@ -1,6 +1,9 @@ package tombenpotter.emt.common.modules.base.items; +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.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLivingBase; @@ -24,12 +27,19 @@ public class ItemBaseChainsaw extends ItemAxe { public String textureName; - public ItemBaseChainsaw(ToolMaterial material, int maxDamage, String unlocName, String textureName) { - super(material); - this.setCreativeTab(ElectroMagicTools.tabEMT); - this.setMaxDamage(maxDamage); - this.setTextureName(ModInformation.texturePath + ":" + textureName); - this.efficiencyOnProperMaterial = this.toolMaterial.getEfficiencyOnProperMaterial(); + public ItemBaseChainsaw(ToolMaterial material, int maxDamage, String textureName) { + super(material); + this.setCreativeTab(ElectroMagicTools.tabEMT); + this.setMaxStackSize(1); + this.setMaxDamage(maxDamage); + this.textureName = textureName; + this.efficiencyOnProperMaterial = this.toolMaterial.getEfficiencyOnProperMaterial(); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon(ModInformation.texturePath + ":tools/chainsaws" + textureName); } @Override @@ -70,14 +80,11 @@ public class ItemBaseChainsaw extends ItemAxe { return false; } - @Override - public int getItemEnchantability() { - if (!ConfigHandler.enchanting) { - return 0; - } else { - return toolMaterial.getEnchantability(); - } - } + @Override + public int getItemEnchantability() { + if (ConfigHandler.enchanting == false) return 0; + else return toolMaterial.getEnchantability(); + } @Override public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) { diff --git a/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBaseDrill.java b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBaseDrill.java index b85a470..fc5376f 100644 --- a/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBaseDrill.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBaseDrill.java @@ -1,6 +1,9 @@ package tombenpotter.emt.common.modules.base.items; +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.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemPickaxe; @@ -15,14 +18,21 @@ public class ItemBaseDrill extends ItemPickaxe { public String textureName; - public ItemBaseDrill(ToolMaterial material, int maxDamage, String unlocName, String textureName) { + public ItemBaseDrill(ToolMaterial material, int maxDamage, String textureName) { super(material); this.setCreativeTab(ElectroMagicTools.tabEMT); + this.setMaxStackSize(1); this.setMaxDamage(maxDamage); - this.setTextureName(ModInformation.texturePath + ":" + textureName); + this.textureName = textureName; this.efficiencyOnProperMaterial = this.toolMaterial.getEfficiencyOnProperMaterial(); } + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon(ModInformation.texturePath + ":tools/drills/" + textureName); + } + @Override public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entityLiving) { if ((double) block.getBlockHardness(world, x, y, z) != 0.0D) stack.damageItem(1, entityLiving); @@ -68,11 +78,8 @@ public class ItemBaseDrill extends ItemPickaxe { @Override public int getItemEnchantability() { - if (!ConfigHandler.enchanting) { - return 0; - } else { - return toolMaterial.getEnchantability(); - } + if (ConfigHandler.enchanting == false) return 0; + else return toolMaterial.getEnchantability(); } @Override diff --git a/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBaseOmnitool.java b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBaseOmnitool.java index eb74b12..e28c8f5 100644 --- a/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBaseOmnitool.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemBaseOmnitool.java @@ -1,6 +1,9 @@ package tombenpotter.emt.common.modules.base.items; +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.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLivingBase; @@ -24,12 +27,19 @@ public class ItemBaseOmnitool extends ItemPickaxe { public String textureName; - public ItemBaseOmnitool(ToolMaterial material, int maxDamage, String unlocName, String textureName) { - super(material); - this.setCreativeTab(ElectroMagicTools.tabEMT); - this.setMaxDamage(maxDamage); - this.setTextureName(ModInformation.texturePath + ":" + textureName); - this.efficiencyOnProperMaterial = this.toolMaterial.getEfficiencyOnProperMaterial(); + public ItemBaseOmnitool(ToolMaterial material, int maxDamage, String textureName) { + super(material); + this.setCreativeTab(ElectroMagicTools.tabEMT); + this.setMaxStackSize(1); + this.setMaxDamage(maxDamage); + this.textureName = textureName; + this.efficiencyOnProperMaterial = this.toolMaterial.getEfficiencyOnProperMaterial(); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon(ModInformation.texturePath + ":tools/omnitools" + textureName); } @Override @@ -71,14 +81,11 @@ public class ItemBaseOmnitool extends ItemPickaxe { return false; } - @Override - public int getItemEnchantability() { - if (!ConfigHandler.enchanting) { - return 0; - } else { - return toolMaterial.getEnchantability(); - } - } + @Override + public int getItemEnchantability() { + if (ConfigHandler.enchanting == false) return 0; + else return toolMaterial.getEnchantability(); + } @Override public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) { diff --git a/src/main/java/tombenpotter/emt/common/module/vanilla/items/ItemCraftingComponent.java b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemCraftingComponents.java similarity index 97% rename from src/main/java/tombenpotter/emt/common/module/vanilla/items/ItemCraftingComponent.java rename to src/main/java/tombenpotter/emt/common/modules/base/items/ItemCraftingComponents.java index 4299eee..6dbbf6b 100644 --- a/src/main/java/tombenpotter/emt/common/module/vanilla/items/ItemCraftingComponent.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemCraftingComponents.java @@ -1,4 +1,4 @@ -package tombenpotter.emt.common.module.vanilla.items; +package tombenpotter.emt.common.modules.base.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -7,12 +7,11 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import tombenpotter.emt.ElectroMagicTools; import tombenpotter.emt.ModInformation; import java.util.List; -public class ItemCraftingComponent extends Item { +public class ItemCraftingComponents extends ItemBase { public IIcon[] icon = new IIcon[100]; public final String drillTop = "drillTop"; @@ -20,10 +19,10 @@ public class ItemCraftingComponent extends Item { public final String omnitoolTop = "omnitoolTop"; public final String shard = "shard"; - public ItemCraftingComponent() { + public ItemCraftingComponents(String unlocName) { + super(unlocName); this.setMaxDamage(0); this.setHasSubtypes(true); - this.setCreativeTab(ElectroMagicTools.tabEMT); } @Override diff --git a/src/main/java/tombenpotter/emt/common/modules/base/items/ItemMaterials.java b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemMaterials.java index 3f4b543..169581e 100644 --- a/src/main/java/tombenpotter/emt/common/modules/base/items/ItemMaterials.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemMaterials.java @@ -1,3 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ + package tombenpotter.emt.common.modules.base.items; import cpw.mods.fml.relauncher.Side; @@ -14,189 +26,196 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; import net.minecraft.util.Vec3; import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; import thaumcraft.common.config.Config; import thaumcraft.common.lib.InventoryHelper; +import tombenpotter.emt.ElectroMagicTools; import tombenpotter.emt.ModInformation; import java.util.List; -public class ItemMaterials extends ItemBase { +public class ItemMaterials extends Item { - public IIcon[] icon = new IIcon[32]; + public IIcon[] icon = new IIcon[500]; - public ItemMaterials() { - super("materials"); - setHasSubtypes(true); - } + public ItemMaterials() { + this.setCreativeTab(ElectroMagicTools.tabEMT); + this.setMaxDamage(0); + this.setMaxStackSize(64); + setHasSubtypes(true); + OreDictionary.registerOre("plateThaumium", new ItemStack(this, 1, 5)); + OreDictionary.registerOre("slimeball", new ItemStack(this, 1, 8)); + } - @Override - public String getUnlocalizedName(ItemStack itemstack) { - String name = ""; - switch (itemstack.getItemDamage()) { - case 0: { - name = "oreClusterUranium"; - break; - } - case 1: { - name = "crushedOreAmber"; - break; - } - case 2: { - name = "purifiedOreAmber"; - break; - } - case 3: { - name = "crushedOreCinnabar"; - break; - } - case 4: { - name = "purifiedOreCinnabar"; - break; - } - case 5: { - name = "thaumiumPlate"; - break; - } - case 6: { - name = "lightningSummoner"; - break; - } - case 7: { - name = "featherMesh"; - break; - } - case 8: { - name = "glue"; - break; - } - case 9: { - name = "ductTape"; - break; - } - case 10: { - name = "rubberBall"; - break; - } - case 11: { - name = "cardboard"; - break; - } - case 12: { - name = "featherGluedCardboardWing"; - break; - } - case 13: { - name = "denseIronSheet"; - break; - } - case 14: { - name = "taintedFeather"; - break; - } - case 15: { - name = "thaumiumWing"; - break; - } - case 16: { - name = "uumatterDrop"; - break; - } - default: - name = "nothing"; - break; - } - return getUnlocalizedName() + "." + name; - } + @Override + public String getUnlocalizedName(ItemStack itemstack) { + String name = ""; + switch (itemstack.getItemDamage()) { + case 0: { + name = "oreClusterUranium"; + break; + } + case 1: { + name = "crushedOreAmber"; + break; + } + case 2: { + name = "purifiedOreAmber"; + break; + } + case 3: { + name = "crushedOreCinnabar"; + break; + } + case 4: { + name = "purifiedOreCinnabar"; + break; + } + case 5: { + name = "thaumiumPlate"; + break; + } + case 6: { + name = "lightningSummoner"; + break; + } + case 7: { + name = "featherMesh"; + break; + } + case 8: { + name = "glue"; + break; + } + case 9: { + name = "ductTape"; + break; + } + case 10: { + name = "rubberBall"; + break; + } + case 11: { + name = "cardboard"; + break; + } + case 12: { + name = "featherGluedCardboardWing"; + break; + } + case 13: { + name = "denseIronSheet"; + break; + } + case 14: { + name = "taintedFeather"; + break; + } + case 15: { + name = "thaumiumWing"; + break; + } + case 16: { + name = "uumatterDrop"; + break; + } + default: + name = "nothing"; + break; + } + return getUnlocalizedName() + "." + name; + } - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister ri) { - this.icon[0] = ri.registerIcon(ModInformation.texturePath + ":materials/clusteruranium"); - this.icon[1] = ri.registerIcon(ModInformation.texturePath + ":materials/crushedamber"); - this.icon[2] = ri.registerIcon(ModInformation.texturePath + ":materials/purifiedamber"); - this.icon[3] = ri.registerIcon(ModInformation.texturePath + ":materials/crushedcinnabar"); - this.icon[4] = ri.registerIcon(ModInformation.texturePath + ":materials/purifiedcinnabar"); - this.icon[5] = ri.registerIcon(ModInformation.texturePath + ":materials/thaumiumplate"); - this.icon[6] = ri.registerIcon(ModInformation.texturePath + ":materials/lightningsummoner"); - this.icon[7] = ri.registerIcon(ModInformation.texturePath + ":materials/feathermesh"); - this.icon[8] = ri.registerIcon(ModInformation.texturePath + ":materials/glue"); - this.icon[9] = ri.registerIcon(ModInformation.texturePath + ":materials/ducttape"); - this.icon[10] = ri.registerIcon(ModInformation.texturePath + ":materials/rubberball"); - this.icon[11] = ri.registerIcon(ModInformation.texturePath + ":materials/cardboard"); - this.icon[12] = ri.registerIcon(ModInformation.texturePath + ":materials/cardboardsheet"); - this.icon[13] = ri.registerIcon(ModInformation.texturePath + ":materials/denseironsheet"); - this.icon[14] = ri.registerIcon(ModInformation.texturePath + ":materials/taintedfeather"); - this.icon[15] = ri.registerIcon(ModInformation.texturePath + ":materials/thaumiumWing"); - this.icon[16] = ri.registerIcon(ModInformation.texturePath + ":materials/uumatterdrop"); - } + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister ri) { + this.icon[0] = ri.registerIcon(ModInformation.texturePath + ":materials/clusteruranium"); + this.icon[1] = ri.registerIcon(ModInformation.texturePath + ":materials/crushedamber"); + this.icon[2] = ri.registerIcon(ModInformation.texturePath + ":materials/purifiedamber"); + this.icon[3] = ri.registerIcon(ModInformation.texturePath + ":materials/crushedcinnabar"); + this.icon[4] = ri.registerIcon(ModInformation.texturePath + ":materials/purifiedcinnabar"); + this.icon[5] = ri.registerIcon(ModInformation.texturePath + ":materials/thaumiumplate"); + this.icon[6] = ri.registerIcon(ModInformation.texturePath + ":materials/lightningsummoner"); + this.icon[7] = ri.registerIcon(ModInformation.texturePath + ":materials/feathermesh"); + this.icon[8] = ri.registerIcon(ModInformation.texturePath + ":materials/glue"); + this.icon[9] = ri.registerIcon(ModInformation.texturePath + ":materials/ducttape"); + this.icon[10] = ri.registerIcon(ModInformation.texturePath + ":materials/rubberball"); + this.icon[11] = ri.registerIcon(ModInformation.texturePath + ":materials/cardboard"); + this.icon[12] = ri.registerIcon(ModInformation.texturePath + ":materials/cardboardsheet"); + this.icon[13] = ri.registerIcon(ModInformation.texturePath + ":materials/denseironsheet"); + this.icon[14] = ri.registerIcon(ModInformation.texturePath + ":materials/taintedfeather"); + this.icon[15] = ri.registerIcon(ModInformation.texturePath + ":materials/thaumiumWing"); + this.icon[16] = ri.registerIcon(ModInformation.texturePath + ":materials/uumatterdrop"); + } - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) { - return this.icon[meta]; - } + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + return this.icon[meta]; + } - @SuppressWarnings({"rawtypes", "unchecked"}) - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List list) { - for (int i = 1; i <= 16; i++) { - list.add(new ItemStack(this, 1, i)); - } - } + @SuppressWarnings({"rawtypes", "unchecked"}) + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List list) { + for (int i = 1; i <= 16; i++) { + list.add(new ItemStack(this, 1, i)); + } + } - @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - if (stack != null && stack.getItemDamage() == 6) { - player.swingItem(); - float f = 1.0F; - float f1 = player.prevRotationPitch + ((player.rotationPitch - player.prevRotationPitch) * f); - float f2 = player.prevRotationYaw + ((player.rotationYaw - player.prevRotationYaw) * f); - double d = player.prevPosX + ((player.posX - player.prevPosX) * f); - double d1 = (player.prevPosY + ((player.posY - player.prevPosY) * f) + 1.6200000000000001D) - player.yOffset; - double d2 = player.prevPosZ + ((player.posZ - player.prevPosZ) * f); - Vec3 vec3d = Vec3.createVectorHelper(d, d1, d2); - float f3 = MathHelper.cos((-f2 * 0.01745329F) - 3.141593F); - float f4 = MathHelper.sin((-f2 * 0.01745329F) - 3.141593F); - float f5 = -MathHelper.cos(-f1 * 0.01745329F); - float f6 = MathHelper.sin(-f1 * 0.01745329F); - float f7 = f4 * f5; - float f8 = f6; - float f9 = f3 * f5; - double d3 = 5000D; - Vec3 vec3d1 = vec3d.addVector(f7 * d3, f8 * d3, f9 * d3); - MovingObjectPosition movingobjectposition = player.worldObj.rayTraceBlocks(vec3d, vec3d1, true); - if (movingobjectposition == null) { - return stack; - } - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - world.spawnEntityInWorld(new EntityLightningBolt(world, i, j, k)); - } else if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) { - Entity entityhit = movingobjectposition.entityHit; - double x = entityhit.posX; - double y = entityhit.posY; - double z = entityhit.posZ; - world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z)); - } - if (player.capabilities.isCreativeMode) { - return stack; - } else { - player.inventory.consumeInventoryItem(this); - return stack; - } - } - return stack; - } + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + if (stack != null && stack.getItemDamage() == 6) { + player.swingItem(); + float f = 1.0F; + float f1 = player.prevRotationPitch + ((player.rotationPitch - player.prevRotationPitch) * f); + float f2 = player.prevRotationYaw + ((player.rotationYaw - player.prevRotationYaw) * f); + double d = player.prevPosX + ((player.posX - player.prevPosX) * f); + double d1 = (player.prevPosY + ((player.posY - player.prevPosY) * f) + 1.6200000000000001D) - player.yOffset; + double d2 = player.prevPosZ + ((player.posZ - player.prevPosZ) * f); + Vec3 vec3d = Vec3.createVectorHelper(d, d1, d2); + float f3 = MathHelper.cos((-f2 * 0.01745329F) - 3.141593F); + float f4 = MathHelper.sin((-f2 * 0.01745329F) - 3.141593F); + float f5 = -MathHelper.cos(-f1 * 0.01745329F); + float f6 = MathHelper.sin(-f1 * 0.01745329F); + float f7 = f4 * f5; + float f8 = f6; + float f9 = f3 * f5; + double d3 = 5000D; + Vec3 vec3d1 = vec3d.addVector(f7 * d3, f8 * d3, f9 * d3); + MovingObjectPosition movingobjectposition = player.worldObj.rayTraceBlocks(vec3d, vec3d1, true); + if (movingobjectposition == null) { + return stack; + } + if (movingobjectposition.typeOfHit == MovingObjectType.BLOCK) { + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; + world.spawnEntityInWorld(new EntityLightningBolt(world, i, j, k)); + } else if (movingobjectposition.typeOfHit == MovingObjectType.ENTITY) { + Entity entityhit = movingobjectposition.entityHit; + double x = entityhit.posX; + double y = entityhit.posY; + double z = entityhit.posZ; + world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z)); + } + if (player.capabilities.isCreativeMode) { + return stack; + } else { + player.inventory.consumeInventoryItem(this); + return stack; + } + } + return stack; + } - public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { - super.onUpdate(stack, world, entity, par4, par5); - if ((!entity.worldObj.isRemote) && ((stack.getItemDamage() == 14)) && ((entity instanceof EntityLivingBase)) && (!((EntityLivingBase) entity).isEntityUndead()) && (!((EntityLivingBase) entity).isPotionActive(Config.potionTaintPoisonID)) && (world.rand.nextInt(4321) <= stack.stackSize)) { - ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Config.potionTaintPoisonID, 120, 0, false)); - if ((entity instanceof EntityPlayer)) { - InventoryHelper.consumeInventoryItem((EntityPlayer) entity, stack.getItem(), stack.getItemDamage()); - } - } - } + public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { + super.onUpdate(stack, world, entity, par4, par5); + if ((!entity.worldObj.isRemote) && ((stack.getItemDamage() == 14)) && ((entity instanceof EntityLivingBase)) && (!((EntityLivingBase) entity).isEntityUndead()) && (!((EntityLivingBase) entity).isPotionActive(Config.potionTaintPoisonID)) && (world.rand.nextInt(4321) <= stack.stackSize)) { + ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Config.potionTaintPoisonID, 120, 0, false)); + if ((entity instanceof EntityPlayer)) { + InventoryHelper.consumeInventoryItem((EntityPlayer) entity, stack.getItem(), stack.getItemDamage()); + } + } + } } diff --git a/src/main/java/tombenpotter/emt/common/module/vanilla/items/ItemShardCarver.java b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemShardCarver.java similarity index 85% rename from src/main/java/tombenpotter/emt/common/module/vanilla/items/ItemShardCarver.java rename to src/main/java/tombenpotter/emt/common/modules/base/items/ItemShardCarver.java index 723abd6..de6c3c2 100644 --- a/src/main/java/tombenpotter/emt/common/module/vanilla/items/ItemShardCarver.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemShardCarver.java @@ -1,4 +1,4 @@ -package tombenpotter.emt.common.module.vanilla.items; +package tombenpotter.emt.common.modules.base.items; import net.minecraft.item.Item; import tombenpotter.emt.ElectroMagicTools; diff --git a/src/main/java/tombenpotter/emt/common/modules/base/items/ItemToolMaterials.java b/src/main/java/tombenpotter/emt/common/modules/base/items/ItemToolMaterials.java deleted file mode 100644 index 4927a10..0000000 --- a/src/main/java/tombenpotter/emt/common/modules/base/items/ItemToolMaterials.java +++ /dev/null @@ -1,143 +0,0 @@ -package tombenpotter.emt.common.modules.base.items; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -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 tombenpotter.emt.ModInformation; - -import java.util.List; - -public class ItemToolMaterials extends ItemBase { - - public IIcon[] icon = new IIcon[32]; - public final String drillTop = "drillTop"; - public final String chainsawTop = "chainsawTop"; - - public ItemToolMaterials() { - super("materials.tools"); - this.setHasSubtypes(true); - } - - @Override - public String getUnlocalizedName(ItemStack itemstack) { - String name = ""; - switch (itemstack.getItemDamage()) { - default: - name = "nothing"; - break; - case 0: { - name = drillTop + ".wood"; - break; - } - case 1: { - name = drillTop + ".stone"; - break; - } - case 2: { - name = drillTop + ".iron"; - break; - } - case 3: { - name = drillTop + ".gold"; - break; - } - case 4: { - name = drillTop + ".diamond"; - break; - } - case 5: { - name = drillTop + ".copper"; - break; - } - case 6: { - name = drillTop + ".tin"; - break; - } - case 7: { - name = drillTop + ".lead"; - break; - } - case 8: { - name = drillTop + ".bronze"; - break; - } - case 9: { - name = chainsawTop + ".wood"; - break; - } - case 10: { - name = chainsawTop + ".stone"; - break; - } - case 11: { - name = chainsawTop + ".iron"; - break; - } - case 12: { - name = chainsawTop + ".gold"; - break; - } - case 13: { - name = chainsawTop + ".diamond"; - break; - } - case 14: { - name = chainsawTop + ".copper"; - break; - } - case 15: { - name = chainsawTop + ".tin"; - break; - } - case 16: { - name = chainsawTop + ".lead"; - break; - } - case 17: { - name = chainsawTop + ".bronze"; - break; - } - } - return getUnlocalizedName() + "." + name; - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister ri) { - this.icon[0] = ri.registerIcon(ModInformation.texturePath + ":materials/" + drillTop + "_" + "wood"); - this.icon[1] = ri.registerIcon(ModInformation.texturePath + ":materials/" + drillTop + "_" + "stone"); - this.icon[2] = ri.registerIcon(ModInformation.texturePath + ":materials/" + drillTop + "_" + "iron"); - this.icon[3] = ri.registerIcon(ModInformation.texturePath + ":materials/" + drillTop + "_" + "gold"); - this.icon[4] = ri.registerIcon(ModInformation.texturePath + ":materials/" + drillTop + "_" + "diamond"); - this.icon[5] = ri.registerIcon(ModInformation.texturePath + ":materials/" + drillTop + "_" + "copper"); - this.icon[6] = ri.registerIcon(ModInformation.texturePath + ":materials/" + drillTop + "_" + "tin"); - this.icon[7] = ri.registerIcon(ModInformation.texturePath + ":materials/" + drillTop + "_" + "lead"); - this.icon[8] = ri.registerIcon(ModInformation.texturePath + ":materials/" + drillTop + "_" + "bronze"); - - this.icon[9] = ri.registerIcon(ModInformation.texturePath + ":materials/" + chainsawTop + "_" + "wood"); - this.icon[10] = ri.registerIcon(ModInformation.texturePath + ":materials/" + chainsawTop + "_" + "stone"); - this.icon[11] = ri.registerIcon(ModInformation.texturePath + ":materials/" + chainsawTop + "_" + "iron"); - this.icon[12] = ri.registerIcon(ModInformation.texturePath + ":materials/" + chainsawTop + "_" + "gold"); - this.icon[13] = ri.registerIcon(ModInformation.texturePath + ":materials/" + chainsawTop + "_" + "diamond"); - this.icon[14] = ri.registerIcon(ModInformation.texturePath + ":materials/" + chainsawTop + "_" + "copper"); - this.icon[15] = ri.registerIcon(ModInformation.texturePath + ":materials/" + chainsawTop + "_" + "tin"); - this.icon[16] = ri.registerIcon(ModInformation.texturePath + ":materials/" + chainsawTop + "_" + "lead"); - this.icon[17] = ri.registerIcon(ModInformation.texturePath + ":materials/" + chainsawTop + "_" + "bronze"); - } - - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) { - return this.icon[meta]; - } - - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List list) { - for (int i = 0; i <= 17; i++) { - list.add(new ItemStack(this, 1, i)); - } - } -} diff --git a/src/main/java/tombenpotter/emt/common/module/base/items/ItemFeatherWing.java b/src/main/java/tombenpotter/emt/common/modules/base/items/armor/ItemFeatherWing.java similarity index 97% rename from src/main/java/tombenpotter/emt/common/module/base/items/ItemFeatherWing.java rename to src/main/java/tombenpotter/emt/common/modules/base/items/armor/ItemFeatherWing.java index eb52d86..293e0c2 100644 --- a/src/main/java/tombenpotter/emt/common/module/base/items/ItemFeatherWing.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/armor/ItemFeatherWing.java @@ -1,4 +1,4 @@ -package tombenpotter.emt.common.module.base.items; +package tombenpotter.emt.common.modules.base.items.armor; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/tombenpotter/emt/common/module/base/items/ItemThaumiumReinforcedWing.java b/src/main/java/tombenpotter/emt/common/modules/base/items/armor/ItemThaumiumReinforcedWing.java similarity index 98% rename from src/main/java/tombenpotter/emt/common/module/base/items/ItemThaumiumReinforcedWing.java rename to src/main/java/tombenpotter/emt/common/modules/base/items/armor/ItemThaumiumReinforcedWing.java index 060fe2d..5a98a7e 100644 --- a/src/main/java/tombenpotter/emt/common/module/base/items/ItemThaumiumReinforcedWing.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/armor/ItemThaumiumReinforcedWing.java @@ -1,4 +1,4 @@ -package tombenpotter.emt.common.module.base.items; +package tombenpotter.emt.common.modules.base.items.armor; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/tombenpotter/emt/common/modules/base/items/foci/ItemChristmasFocus.java b/src/main/java/tombenpotter/emt/common/modules/base/items/foci/ItemChristmasFocus.java index 11839ef..4975619 100644 --- a/src/main/java/tombenpotter/emt/common/modules/base/items/foci/ItemChristmasFocus.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/foci/ItemChristmasFocus.java @@ -1,3 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ + package tombenpotter.emt.common.modules.base.items.foci; import net.minecraft.entity.monster.EntitySnowman; @@ -8,47 +20,48 @@ import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.common.items.wands.ItemWandCasting; +import tombenpotter.emt.common.module.base.items.foci.*; -public class ItemChristmasFocus extends ItemBaseFocus { +public class ItemChristmasFocus extends tombenpotter.emt.common.module.base.items.foci.ItemBaseFocus { - private static final AspectList visCost = new AspectList().add(Aspect.ORDER, 500).add(Aspect.AIR, 500); + private static final AspectList visCost = new AspectList().add(Aspect.ORDER, 500).add(Aspect.AIR, 500); - public ItemChristmasFocus() { - super("christmas", "focus_christmas"); - } + public ItemChristmasFocus() { + super("focus.christmas", "focus_christmas"); + } - @Override - public int getFocusColor() { - return 99999999; - } + @Override + public int getFocusColor() { + return 99999999; + } - @Override - public AspectList getVisCost() { - return visCost; - } + @Override + public AspectList getVisCost() { + return visCost; + } - @Override - public String getSortingHelper(ItemStack itemstack) { - return "CHRISTMAS"; - } + @Override + public String getSortingHelper(ItemStack itemstack) { + return "CHRISTMAS"; + } - @Override - public ItemStack onFocusRightClick(ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition mop) { - ItemWandCasting wand = (ItemWandCasting) itemstack.getItem(); - if ((mop != null) && (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)) { - int x = mop.blockX; - int y = mop.blockY + 1; - int z = mop.blockZ; - if (wand.consumeAllVis(itemstack, player, getVisCost(), true, true)) { - if (!world.isRemote) { - EntitySnowman snowman; - snowman = new EntitySnowman(world); - snowman.setPosition(x, y, z); - world.spawnEntityInWorld(snowman); - } - } - player.swingItem(); - } - return itemstack; - } -} \ No newline at end of file + @Override + public ItemStack onFocusRightClick(ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition mop) { + ItemWandCasting wand = (ItemWandCasting) itemstack.getItem(); + if ((mop != null) && (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)) { + int x = mop.blockX; + int y = mop.blockY + 1; + int z = mop.blockZ; + if (wand.consumeAllVis(itemstack, player, getVisCost(), true, true)) { + if (!world.isRemote) { + EntitySnowman snowman; + snowman = new EntitySnowman(world); + snowman.setPosition(x, y, z); + world.spawnEntityInWorld(snowman); + } + } + player.swingItem(); + } + return itemstack; + } +} diff --git a/src/main/java/tombenpotter/emt/common/module/base/items/foci/ItemExplosionFocus.java b/src/main/java/tombenpotter/emt/common/modules/base/items/foci/ItemExplosionFocus.java similarity index 89% rename from src/main/java/tombenpotter/emt/common/module/base/items/foci/ItemExplosionFocus.java rename to src/main/java/tombenpotter/emt/common/modules/base/items/foci/ItemExplosionFocus.java index aa03b3a..439b277 100644 --- a/src/main/java/tombenpotter/emt/common/module/base/items/foci/ItemExplosionFocus.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/foci/ItemExplosionFocus.java @@ -10,7 +10,7 @@ * http://www.minecraftforum.net/topic/1585216- ******************************************************************************/ -package tombenpotter.emt.common.module.base.items.foci; +package tombenpotter.emt.common.modules.base.items.foci; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -19,9 +19,9 @@ import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.common.items.wands.ItemWandCasting; -import tombenpotter.emt.common.module.base.entities.EntityLaser; +import tombenpotter.emt.common.modules.base.entities.EntityLaser; -public class ItemExplosionFocus extends ItemBaseFocus { +public class ItemExplosionFocus extends tombenpotter.emt.common.module.base.items.foci.ItemBaseFocus { private static final AspectList visCost = new AspectList().add(Aspect.FIRE, 200).add(Aspect.ENTROPY, 200); diff --git a/src/main/java/tombenpotter/emt/common/module/base/items/foci/ItemShieldFocus.java b/src/main/java/tombenpotter/emt/common/modules/base/items/foci/ItemShieldFocus.java similarity index 95% rename from src/main/java/tombenpotter/emt/common/module/base/items/foci/ItemShieldFocus.java rename to src/main/java/tombenpotter/emt/common/modules/base/items/foci/ItemShieldFocus.java index b41e798..eef16ab 100644 --- a/src/main/java/tombenpotter/emt/common/module/base/items/foci/ItemShieldFocus.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/foci/ItemShieldFocus.java @@ -10,7 +10,7 @@ * http://www.minecraftforum.net/topic/1585216- ******************************************************************************/ -package tombenpotter.emt.common.module.base.items.foci; +package tombenpotter.emt.common.modules.base.items.foci; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; @@ -20,9 +20,10 @@ import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.common.items.wands.ItemWandCasting; +import tombenpotter.emt.common.module.base.items.foci.*; import tombenpotter.emt.common.module.ic2.IC2ModuleBlockRegistry; -public class ItemShieldFocus extends ItemBaseFocus { +public class ItemShieldFocus extends tombenpotter.emt.common.module.base.items.foci.ItemBaseFocus { private static final AspectList visCost = new AspectList().add(Aspect.ORDER, 10).add(Aspect.WATER, 10).add(Aspect.AIR, 10); diff --git a/src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemThorHammer.java b/src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemThorHammer.java index 468067e..88eb702 100644 --- a/src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemThorHammer.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemThorHammer.java @@ -1,5 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ + package tombenpotter.emt.common.modules.base.items.tools; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.effect.EntityLightningBolt; @@ -9,77 +24,82 @@ import net.minecraft.item.ItemSword; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; import net.minecraft.util.Vec3; import net.minecraft.world.World; +import thaumcraft.api.IRepairable; import tombenpotter.emt.ElectroMagicTools; import tombenpotter.emt.ModInformation; -import tombenpotter.emt.common.util.TextHelper; import java.util.List; -public class ItemThorHammer extends ItemSword { +public class ItemThorHammer extends ItemSword implements IRepairable { - public ItemThorHammer() { - super(ToolMaterial.EMERALD); - this.setMaxDamage(2000); - this.setCreativeTab(ElectroMagicTools.tabEMT); - this.setUnlocalizedName(ModInformation.modid + ".module.base.hammer"); - this.setTextureName(ModInformation.texturePath + ":hammer/thorhammer"); - } + public ItemThorHammer() { + super(ToolMaterial.EMERALD); + this.setCreativeTab(ElectroMagicTools.tabEMT); + this.setMaxDamage(2000); + // OreDictionary.registerOre("craftingToolForgeHammer", this); + } - @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { - player.swingItem(); - float f = 1.0F; - float f1 = player.prevRotationPitch + ((player.rotationPitch - player.prevRotationPitch) * f); - float f2 = player.prevRotationYaw + ((player.rotationYaw - player.prevRotationYaw) * f); - double d = player.prevPosX + ((player.posX - player.prevPosX) * f); - double d1 = (player.prevPosY + ((player.posY - player.prevPosY) * f) + 1.6200000000000001D) - player.yOffset; - double d2 = player.prevPosZ + ((player.posZ - player.prevPosZ) * f); - Vec3 vec3d = Vec3.createVectorHelper(d, d1, d2); - float f3 = MathHelper.cos((-f2 * 0.01745329F) - 3.141593F); - float f4 = MathHelper.sin((-f2 * 0.01745329F) - 3.141593F); - float f5 = -MathHelper.cos(-f1 * 0.01745329F); - float f6 = MathHelper.sin(-f1 * 0.01745329F); - float f7 = f4 * f5; - float f8 = f6; - float f9 = f3 * f5; - double d3 = 5000D; - Vec3 vec3d1 = vec3d.addVector(f7 * d3, f8 * d3, f9 * d3); - MovingObjectPosition movingobjectposition = player.worldObj.rayTraceBlocks(vec3d, vec3d1, true); - if (movingobjectposition == null) { - return itemstack; - } - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - world.spawnEntityInWorld(new EntityLightningBolt(world, i, j, k)); - } else if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) { - Entity entityhit = movingobjectposition.entityHit; - double x = entityhit.posX; - double y = entityhit.posY; - double z = entityhit.posZ; - world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z)); - } - if (player.capabilities.isCreativeMode) { - return itemstack; - } else { - itemstack.damageItem(20, player); - return itemstack; - } - } + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon(ModInformation.texturePath + ":hammer/thorhammer"); + } - @Override - public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { - entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 12F); - itemstack.damageItem(1, attacker); - return true; - } + @Override + public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { + player.swingItem(); + float f = 1.0F; + float f1 = player.prevRotationPitch + ((player.rotationPitch - player.prevRotationPitch) * f); + float f2 = player.prevRotationYaw + ((player.rotationYaw - player.prevRotationYaw) * f); + double d = player.prevPosX + ((player.posX - player.prevPosX) * f); + double d1 = (player.prevPosY + ((player.posY - player.prevPosY) * f) + 1.6200000000000001D) - player.yOffset; + double d2 = player.prevPosZ + ((player.posZ - player.prevPosZ) * f); + Vec3 vec3d = Vec3.createVectorHelper(d, d1, d2); + float f3 = MathHelper.cos((-f2 * 0.01745329F) - 3.141593F); + float f4 = MathHelper.sin((-f2 * 0.01745329F) - 3.141593F); + float f5 = -MathHelper.cos(-f1 * 0.01745329F); + float f6 = MathHelper.sin(-f1 * 0.01745329F); + float f7 = f4 * f5; + float f8 = f6; + float f9 = f3 * f5; + double d3 = 5000D; + Vec3 vec3d1 = vec3d.addVector(f7 * d3, f8 * d3, f9 * d3); + MovingObjectPosition movingobjectposition = player.worldObj.rayTraceBlocks(vec3d, vec3d1, true); + if (movingobjectposition == null) { + return itemstack; + } + if (movingobjectposition.typeOfHit == MovingObjectType.BLOCK) { + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; + world.spawnEntityInWorld(new EntityLightningBolt(world, i, j, k)); + } else if (movingobjectposition.typeOfHit == MovingObjectType.ENTITY) { + Entity entityhit = movingobjectposition.entityHit; + double x = entityhit.posX; + double y = entityhit.posY; + double z = entityhit.posZ; + world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z)); + } + if (player.capabilities.isCreativeMode) { + return itemstack; + } else { + itemstack.damageItem(20, player); + return itemstack; + } + } - @Override - @SuppressWarnings("unchecked") - public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { - list.add(TextHelper.localize("tooltip.EMT.hammer.thor")); - } + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { + entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 12F); + itemstack.damageItem(1, attacker); + return true; + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { + list.add("The Hammer of Thor"); + } } diff --git a/src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemThorHammerBroken.java b/src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemThorHammerBroken.java index ab10340..2ed3ed2 100644 --- a/src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemThorHammerBroken.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemThorHammerBroken.java @@ -1,5 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2014 Tombenpotter. + * All rights reserved. + * + * This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html + * + * This class was made by Tombenpotter and is distributed as a part of the Electro-Magic Tools mod. + * Electro-Magic Tools is a derivative work on Thaumcraft 4 (c) Azanor 2012. + * http://www.minecraftforum.net/topic/1585216- + ******************************************************************************/ + package tombenpotter.emt.common.modules.base.items.tools; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -14,45 +29,50 @@ import java.util.List; public class ItemThorHammerBroken extends ItemThorHammer { - public ItemThorHammerBroken() { - this.setUnlocalizedName(getUnlocalizedName() + ".broken"); - this.setTextureName(ModInformation.texturePath + ":hammer/taintedthorhammer"); - } + public ItemThorHammerBroken() { + this.setMaxDamage(1000); + } - @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { - player.swingItem(); - world.spawnEntityInWorld(new EntityAlumentum(world, player.posX + 8, player.posY, player.posZ - 8)); - world.spawnEntityInWorld(new EntityAlumentum(world, player.posX - 8, player.posY, player.posZ + 8)); - world.spawnEntityInWorld(new EntityAlumentum(world, player.posX - 8, player.posY, player.posZ - 8)); - world.spawnEntityInWorld(new EntityAlumentum(world, player.posX + 8, player.posY, player.posZ + 8)); - world.spawnEntityInWorld(new EntityAlumentum(world, player.posX, player.posY + 4, player.posZ)); - world.spawnEntityInWorld(new EntityAlumentum(world, player.posX, player.posY + 8, player.posZ)); + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon(ModInformation.texturePath + ":hammer/taintedthorhammer"); + } - if (player.capabilities.isCreativeMode) { - return itemstack; - } else { - itemstack.damageItem(20, player); - return itemstack; - } - } + @Override + public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { + player.swingItem(); + world.spawnEntityInWorld(new EntityAlumentum(world, player.posX + 8, player.posY, player.posZ - 8)); + world.spawnEntityInWorld(new EntityAlumentum(world, player.posX - 8, player.posY, player.posZ + 8)); + world.spawnEntityInWorld(new EntityAlumentum(world, player.posX - 8, player.posY, player.posZ - 8)); + world.spawnEntityInWorld(new EntityAlumentum(world, player.posX + 8, player.posY, player.posZ + 8)); + world.spawnEntityInWorld(new EntityAlumentum(world, player.posX, player.posY + 4, player.posZ)); + world.spawnEntityInWorld(new EntityAlumentum(world, player.posX, player.posY + 8, player.posZ)); - @Override - public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { - entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 2F); - itemstack.damageItem(1, attacker); - return true; - } + if (player.capabilities.isCreativeMode) { + return itemstack; + } else { + itemstack.damageItem(20, player); + return itemstack; + } + } - @SuppressWarnings({"rawtypes", "unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer entityPlayer, List list, boolean par4) { - list.add(TextHelper.localize("tooltip.EMT.hammer.broken.thor")); - list.add(TextHelper.localize("tooltip.EMT.hammer.broken.danger")); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - list.add(TextHelper.localize("tooltip.EMT.hammer.broken.plsNoRightClick")); - } else { - list.add(TextHelper.localize("tooltip.EMT.hammer.broken.plsRightClick")); - } - } + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) { + entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 2F); + itemstack.damageItem(1, attacker); + return true; + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer entityPlayer, List list, boolean par4) { + list.add(TextHelper.localize("tooltip.EMT.hammer.broken.thor")); + list.add(TextHelper.localize("tooltip.EMT.hammer.broken.danger")); + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + list.add(TextHelper.localize("tooltip.EMT.hammer.broken.plsNoRightClick")); + } else { + list.add(TextHelper.localize("tooltip.EMT.hammer.broken.plsRightClick")); + } + } } diff --git a/src/main/java/tombenpotter/emt/common/module/vanilla/items/tools/ItemVanillaChainsaw.java b/src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemVanillaChainsaw.java similarity index 94% rename from src/main/java/tombenpotter/emt/common/module/vanilla/items/tools/ItemVanillaChainsaw.java rename to src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemVanillaChainsaw.java index 6690d87..64723cd 100644 --- a/src/main/java/tombenpotter/emt/common/module/vanilla/items/tools/ItemVanillaChainsaw.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemVanillaChainsaw.java @@ -1,11 +1,11 @@ -package tombenpotter.emt.common.module.vanilla.items.tools; +package tombenpotter.emt.common.modules.base.items.tools; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; -import tombenpotter.emt.common.module.base.items.tools.ItemBaseChainsaw; +import tombenpotter.emt.common.modules.base.items.ItemBaseChainsaw; import tombenpotter.emt.common.util.IRefillable; public class ItemVanillaChainsaw extends ItemBaseChainsaw implements IRefillable { diff --git a/src/main/java/tombenpotter/emt/common/module/vanilla/items/tools/ItemVanillaDrill.java b/src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemVanillaDrill.java similarity index 88% rename from src/main/java/tombenpotter/emt/common/module/vanilla/items/tools/ItemVanillaDrill.java rename to src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemVanillaDrill.java index eb12c4b..bfa66a0 100644 --- a/src/main/java/tombenpotter/emt/common/module/vanilla/items/tools/ItemVanillaDrill.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemVanillaDrill.java @@ -1,9 +1,9 @@ -package tombenpotter.emt.common.module.vanilla.items.tools; +package tombenpotter.emt.common.modules.base.items.tools; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import tombenpotter.emt.common.module.base.items.tools.ItemBaseDrill; +import tombenpotter.emt.common.modules.base.items.ItemBaseDrill; import tombenpotter.emt.common.util.IRefillable; public class ItemVanillaDrill extends ItemBaseDrill implements IRefillable { diff --git a/src/main/java/tombenpotter/emt/common/module/vanilla/items/tools/ItemVanillaOmnitool.java b/src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemVanillaOmnitool.java similarity index 94% rename from src/main/java/tombenpotter/emt/common/module/vanilla/items/tools/ItemVanillaOmnitool.java rename to src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemVanillaOmnitool.java index c7b5801..e1bd4bc 100644 --- a/src/main/java/tombenpotter/emt/common/module/vanilla/items/tools/ItemVanillaOmnitool.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/items/tools/ItemVanillaOmnitool.java @@ -1,11 +1,11 @@ -package tombenpotter.emt.common.module.vanilla.items.tools; +package tombenpotter.emt.common.modules.base.items.tools; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; -import tombenpotter.emt.common.module.base.items.tools.ItemBaseOmnitool; +import tombenpotter.emt.common.modules.base.items.ItemBaseOmnitool; import tombenpotter.emt.common.util.IRefillable; public class ItemVanillaOmnitool extends ItemBaseOmnitool implements IRefillable{ diff --git a/src/main/java/tombenpotter/emt/common/module/base/tile/TileEntityPortableNode.java b/src/main/java/tombenpotter/emt/common/modules/base/tile/TileEntityPortableNode.java similarity index 95% rename from src/main/java/tombenpotter/emt/common/module/base/tile/TileEntityPortableNode.java rename to src/main/java/tombenpotter/emt/common/modules/base/tile/TileEntityPortableNode.java index a70b363..05f9a4d 100644 --- a/src/main/java/tombenpotter/emt/common/module/base/tile/TileEntityPortableNode.java +++ b/src/main/java/tombenpotter/emt/common/modules/base/tile/TileEntityPortableNode.java @@ -10,7 +10,7 @@ * http://www.minecraftforum.net/topic/1585216- ******************************************************************************/ -package tombenpotter.emt.common.module.base.tile; +package tombenpotter.emt.common.modules.base.tile; import thaumcraft.api.nodes.NodeModifier; import thaumcraft.api.nodes.NodeType; diff --git a/src/main/java/tombenpotter/emt/common/util/EventHandlerEMT.java b/src/main/java/tombenpotter/emt/common/util/EventHandlerEMT.java index 06b8496..bbd6344 100644 --- a/src/main/java/tombenpotter/emt/common/util/EventHandlerEMT.java +++ b/src/main/java/tombenpotter/emt/common/util/EventHandlerEMT.java @@ -24,7 +24,7 @@ import thaumcraft.common.entities.monster.EntityTaintChicken; import tombenpotter.emt.ElectroMagicTools; import tombenpotter.emt.ModInformation; import tombenpotter.emt.common.module.ic2.IC2ModuleItemRegistry; -import tombenpotter.emt.common.module.vanilla.items.ItemShardCarver; +import tombenpotter.emt.common.modules.base.items.ItemShardCarver; public class EventHandlerEMT { diff --git a/src/main/java/tombenpotter/emt/proxies/ClientProxy.java b/src/main/java/tombenpotter/emt/proxies/ClientProxy.java index 7a5c879..33bd21e 100644 --- a/src/main/java/tombenpotter/emt/proxies/ClientProxy.java +++ b/src/main/java/tombenpotter/emt/proxies/ClientProxy.java @@ -15,8 +15,8 @@ package tombenpotter.emt.proxies; import cpw.mods.fml.client.registry.RenderingRegistry; import tombenpotter.emt.client.renderer.RenderArcher; import tombenpotter.emt.client.renderer.RenderLaser; -import tombenpotter.emt.common.module.base.entities.EntityArcher; -import tombenpotter.emt.common.module.base.entities.EntityLaser; +import tombenpotter.emt.common.modules.base.entities.EntityArcher; +import tombenpotter.emt.common.modules.base.entities.EntityLaser; public class ClientProxy extends CommonProxy { diff --git a/src/main/resources/assets/electromagictools/lang/en_US.lang b/src/main/resources/assets/electromagictools/lang/en_US.lang index 4486bef..30a9c1a 100644 --- a/src/main/resources/assets/electromagictools/lang/en_US.lang +++ b/src/main/resources/assets/electromagictools/lang/en_US.lang @@ -128,43 +128,43 @@ item.EMT.omnitool.tin.name=Tin Omnitool item.EMT.omnitool.lead.name=Lead Omnitool item.EMT.omnitool.bronze.name=Bronze Omnitool -item.EMT.material.drillTop.wood.name=Wooden Drill Top -item.EMT.material.drillTop.stone.name=Stone Drill Top -item.EMT.material.drillTop.iron.name=Iron Drill Top -item.EMT.material.drillTop.gold.name=Golden Drill Top -item.EMT.material.drillTop.diamond.name=Diamond Drill Top -item.EMT.material.drillTop.tin.name=Tin Drill Top -item.EMT.material.drillTop.copper.name=Copper Drill Top -item.EMT.material.drillTop.lead.name=Lead Drill Top -item.EMT.material.drillTop.bronze.name=Bronze Drill Top +item.EMT.module.base.components.drillTop.wood.name=Wooden Drill Top +item.EMT.module.base.components.drillTop.stone.name=Stone Drill Top +item.EMT.module.base.components.drillTop.iron.name=Iron Drill Top +item.EMT.module.base.components.drillTop.gold.name=Golden Drill Top +item.EMT.module.base.components.drillTop.diamond.name=Diamond Drill Top +item.EMT.module.base.components.drillTop.tin.name=Tin Drill Top +item.EMT.module.base.components.drillTop.copper.name=Copper Drill Top +item.EMT.module.base.components.drillTop.lead.name=Lead Drill Top +item.EMT.module.base.components.drillTop.bronze.name=Bronze Drill Top -item.EMT.material.chainsawTop.wood.name=Wooden Chainsaw Top -item.EMT.material.chainsawTop.stone.name=Stone Chainsaw Top -item.EMT.material.chainsawTop.iron.name=Iron Chainsaw Top -item.EMT.material.chainsawTop.gold.name=Golden Chainsaw Top -item.EMT.material.chainsawTop.diamond.name=Diamond Chainsaw Top -item.EMT.material.chainsawTop.tin.name=Tin Chainsaw Top -item.EMT.material.chainsawTop.copper.name=Copper Chainsaw Top -item.EMT.material.chainsawTop.lead.name=Lead Chainsaw Top -item.EMT.material.chainsawTop.bronze.name=Bronze Chainsaw Top +item.EMT.module.base.components.chainsawTop.wood.name=Wooden Chainsaw Top +item.EMT.module.base.components.chainsawTop.stone.name=Stone Chainsaw Top +item.EMT.module.base.components.chainsawTop.iron.name=Iron Chainsaw Top +item.EMT.module.base.components.chainsawTop.gold.name=Golden Chainsaw Top +item.EMT.module.base.components.chainsawTop.diamond.name=Diamond Chainsaw Top +item.EMT.module.base.components.chainsawTop.tin.name=Tin Chainsaw Top +item.EMT.module.base.components.chainsawTop.copper.name=Copper Chainsaw Top +item.EMT.module.base.components.chainsawTop.lead.name=Lead Chainsaw Top +item.EMT.module.base.components.chainsawTop.bronze.name=Bronze Chainsaw Top -item.EMT.material.omnitoolTop.iron.name=Iron Omnitool Top -item.EMT.material.omnitoolTop.gold.name=Golden Omnitool Top -item.EMT.material.omnitoolTop.diamond.name=Diamond Omnitool Top -item.EMT.material.omnitoolTop.copper.name=Copper Omnitool Top -item.EMT.material.omnitoolTop.tin.name=Tin Omnitool Top -item.EMT.material.omnitoolTop.lead.name=Lead Omnitool Top -item.EMT.material.omnitoolTop.bronze.name=Bronze Omnitool Top +item.EMT.module.base.components.omnitoolTop.iron.name=Iron Omnitool Top +item.EMT.module.base.components.omnitoolTop.gold.name=Golden Omnitool Top +item.EMT.module.base.components.omnitoolTop.diamond.name=Diamond Omnitool Top +item.EMT.module.base.components.omnitoolTop.copper.name=Copper Omnitool Top +item.EMT.module.base.components.omnitoolTop.tin.name=Tin Omnitool Top +item.EMT.module.base.components.omnitoolTop.lead.name=Lead Omnitool Top +item.EMT.module.base.components.omnitoolTop.bronze.name=Bronze Omnitool Top -item.EMT.material.shard.wood.name=Wooden Shard -item.EMT.material.shard.stone.name=Stone Shard -item.EMT.material.shard.iron.name=Iron Shard -item.EMT.material.shard.gold.name=Golden Shard -item.EMT.material.shard.obsidian.name=Obsidian Shard -item.EMT.material.shard.copper.name=Copper Shard -item.EMT.material.shard.tin.name=Tin Shard -item.EMT.material.shard.lead.name=Lead Shard -item.EMT.material.shard.bronze.name=Bronze Shard +item.EMT.module.base.components.shard.wood.name=Wooden Shard +item.EMT.module.base.components.shard.stone.name=Stone Shard +item.EMT.module.base.components.shard.iron.name=Iron Shard +item.EMT.module.base.components.shard.gold.name=Golden Shard +item.EMT.module.base.components.shard.obsidian.name=Obsidian Shard +item.EMT.module.base.components.shard.copper.name=Copper Shard +item.EMT.module.base.components.shard.tin.name=Tin Shard +item.EMT.module.base.components.shard.lead.name=Lead Shard +item.EMT.module.base.components.shard.bronze.name=Bronze Shard item.EMT.carver.wood.name=Wooden Shard Carver item.EMT.carver.stone.name=Stone Shard Carver