A bit of refractoring

This commit is contained in:
Tombenpotter committed 2014-10-17 22:45:57 +02:00
1 parent 0a6b5e57d6
commit cdd16a3d6c
45 files changed
+715 -1750

No files matched your search

@@ -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);
@@ -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 {
@@ -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<? extends EntityLiving> ARCHER_CLASS = EntityArcher.class;
private static int getUniqueEntityID() {
do {
startEID++;
} while (EntityList.getStringFromID(startEID) != null);
return startEID;
}
@SuppressWarnings("unchecked")
public static void registerEntityEgg(Class<? extends Entity> 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);
}
}
@@ -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) {
}
}
@@ -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());
}
}
}
}
@@ -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"));
}
}
}
@@ -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");
}
}
@@ -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;
}
}
@@ -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<ItemStack> 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;
}
}
@@ -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;
}
}
@@ -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<ItemStack> 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;
}
}
@@ -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");
@@ -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.*;
@@ -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;
@@ -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;
@@ -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;
@@ -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");
@@ -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);
@@ -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();
}
}
*/
}
}
@@ -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<? extends EntityLiving> ARCHER_CLASS = EntityArcher.class;
private static int getUniqueEntityID() {
do {
startEID++;
} while (EntityList.getStringFromID(startEID) != null);
return startEID;
}
@SuppressWarnings("unchecked")
public static void registerEntityEgg(Class<? extends Entity> 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);
}
}
@@ -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) {
}
}
@Override
public void init(Entity entity, World world) {
}
}
@@ -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;
@@ -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");
}
}
@@ -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);
}
}
@@ -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) {
@@ -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
@@ -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) {
@@ -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
@@ -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());
}
}
}
}
@@ -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;
@@ -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));
}
}
}
@@ -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;
@@ -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;
@@ -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;
}
}
@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;
}
}
@@ -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);
@@ -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);
@@ -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");
}
}
@@ -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"));
}
}
}
@@ -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 {
@@ -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 {
@@ -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{
@@ -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;
@@ -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 {
@@ -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 {