Updated for 1.7.2
This commit is contained in:
parent
cc178e1a3b
commit
29228e18fe
105 changed files with 1939 additions and 2690 deletions
|
|
@ -1,12 +1,12 @@
|
|||
package mysticworld.items;
|
||||
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import net.minecraftforge.common.EnumHelper;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
|
||||
public class EnumArmor
|
||||
{
|
||||
static EnumArmorMaterial Verdite = EnumHelper.addArmorMaterial("Verdite", 262, new int[]{2, 5, 4, 1}, 5);
|
||||
static EnumArmorMaterial Mithril = EnumHelper.addArmorMaterial("Mithril", 500, new int[]{2, 7, 6, 2}, 9);
|
||||
static EnumArmorMaterial Adamantine = EnumHelper.addArmorMaterial("Adamantine", 3000, new int[]{4, 9, 6, 4}, 13);
|
||||
static EnumArmorMaterial Iridium = EnumHelper.addArmorMaterial("Iridium", 4000, new int[]{4, 10, 7, 5}, 15);
|
||||
static ItemArmor.ArmorMaterial Verdite = EnumHelper.addArmorMaterial("Verdite", 262, new int[]{2, 5, 4, 1}, 5);
|
||||
static ItemArmor.ArmorMaterial Mithril = EnumHelper.addArmorMaterial("Mithril", 500, new int[]{2, 7, 6, 2}, 9);
|
||||
static ItemArmor.ArmorMaterial Adamantine = EnumHelper.addArmorMaterial("Adamantine", 3000, new int[]{4, 9, 6, 4}, 13);
|
||||
static ItemArmor.ArmorMaterial Iridium = EnumHelper.addArmorMaterial("Iridium", 4000, new int[]{4, 10, 7, 5}, 15);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,29 @@
|
|||
package mysticworld.items;
|
||||
|
||||
import mysticworld.MysticWorld;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemArmorAdamantine extends ItemArmor {
|
||||
int ArmorType;
|
||||
|
||||
public ItemArmorAdamantine(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {
|
||||
super(par1, par2EnumArmorMaterial, par3, par4);
|
||||
public ItemArmorAdamantine(ArmorMaterial par2EnumArmorMaterial, int par4) {
|
||||
super(par2EnumArmorMaterial, 0, par4);
|
||||
this.ArmorType = par4;
|
||||
this.setMaxDamage(3000);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) {
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer) {
|
||||
int suffix = this.armorType == 2 ? 2 : 1;
|
||||
return "mysticworld:textures/models/armor/Adamantine_layer_" + suffix + ".png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister) {
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
itemIcon = iconRegister.registerIcon("mysticworld:AdamantineArmor_" + ArmorType);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
package mysticworld.items;
|
||||
|
||||
import mysticworld.MysticWorld;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
|
|
@ -14,44 +13,44 @@ import net.minecraft.world.World;
|
|||
public class ItemArmorIridium extends ItemArmor {
|
||||
int ArmorType;
|
||||
|
||||
public ItemArmorIridium(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {
|
||||
super(par1, par2EnumArmorMaterial, par3, par4);
|
||||
public ItemArmorIridium(ArmorMaterial par2EnumArmorMaterial, int par4) {
|
||||
super(par2EnumArmorMaterial, 0, par4);
|
||||
this.ArmorType = par4;
|
||||
this.setMaxDamage(4000);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) {
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer) {
|
||||
int suffix = this.armorType == 2 ? 2 : 1;
|
||||
return "mysticworld:textures/models/armor/Iridium_layer_" + suffix + ".png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
ItemStack helmet = player.getCurrentItemOrArmor(4);
|
||||
ItemStack plate = player.getCurrentItemOrArmor(3);
|
||||
ItemStack legs = player.getCurrentItemOrArmor(2);
|
||||
ItemStack boots = player.getCurrentItemOrArmor(1);
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
ItemStack helmet = player.getEquipmentInSlot(4);
|
||||
ItemStack plate = player.getEquipmentInSlot(3);
|
||||
ItemStack legs = player.getEquipmentInSlot(2);
|
||||
ItemStack boots = player.getEquipmentInSlot(1);
|
||||
if (helmet != null) {
|
||||
if (helmet.itemID == ItemHandler.iridiumHelmet.itemID) {
|
||||
if (helmet.getItem() == ItemHandler.iridiumHelmet) {
|
||||
player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 200, 0)));
|
||||
}
|
||||
}
|
||||
if (plate != null) {
|
||||
if (plate.itemID == ItemHandler.iridiumChestplate.itemID) {
|
||||
if (plate.getItem() == ItemHandler.iridiumChestplate) {
|
||||
player.addPotionEffect((new PotionEffect(Potion.regeneration.getId(), 200, 0)));
|
||||
}
|
||||
}
|
||||
if (legs != null) {
|
||||
if (legs.itemID == ItemHandler.iridiumLeggings.itemID) {
|
||||
if (legs.getItem() == ItemHandler.iridiumLeggings) {
|
||||
player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 200, 2)));
|
||||
player.addVelocity(0.0005, 0, 0.0005);
|
||||
player.stepHeight = 1.001F;
|
||||
}
|
||||
}
|
||||
if (boots != null) {
|
||||
if (boots.itemID == ItemHandler.iridiumBoots.itemID) {
|
||||
if (boots.getItem() == ItemHandler.iridiumBoots) {
|
||||
player.fallDistance = 0.0F;
|
||||
player.addPotionEffect((new PotionEffect(Potion.jump.getId(), 200, 2)));
|
||||
}
|
||||
|
|
@ -59,7 +58,7 @@ public class ItemArmorIridium extends ItemArmor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister) {
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
itemIcon = iconRegister.registerIcon("mysticworld:IridiumArmor_" + ArmorType);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +1,29 @@
|
|||
package mysticworld.items;
|
||||
|
||||
import mysticworld.MysticWorld;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemArmorMithril extends ItemArmor {
|
||||
int ArmorType;
|
||||
|
||||
public ItemArmorMithril(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {
|
||||
super(par1, par2EnumArmorMaterial, par3, par4);
|
||||
public ItemArmorMithril(ArmorMaterial par2EnumArmorMaterial, int par4) {
|
||||
super(par2EnumArmorMaterial, 0, par4);
|
||||
this.ArmorType = par4;
|
||||
this.setMaxDamage(500);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) {
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer) {
|
||||
int suffix = this.armorType == 2 ? 2 : 1;
|
||||
return "mysticworld:textures/models/armor/Mithril_layer_" + suffix + ".png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister) {
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
itemIcon = iconRegister.registerIcon("mysticworld:MithrilArmor_" + ArmorType);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,29 @@
|
|||
package mysticworld.items;
|
||||
|
||||
import mysticworld.MysticWorld;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemArmorVerdite extends ItemArmor {
|
||||
int ArmorType;
|
||||
|
||||
public ItemArmorVerdite(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {
|
||||
super(par1, par2EnumArmorMaterial, par3, par4);
|
||||
public ItemArmorVerdite(ArmorMaterial par2EnumArmorMaterial, int par4) {
|
||||
super(par2EnumArmorMaterial, 0, par4);
|
||||
this.ArmorType = par4;
|
||||
this.setMaxDamage(262);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) {
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer) {
|
||||
int suffix = this.armorType == 2 ? 2 : 1;
|
||||
return "mysticworld:textures/models/armor/Verdite_layer_" + suffix + ".png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister) {
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
itemIcon = iconRegister.registerIcon("mysticworld:VerditeArmor_" + ArmorType);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,26 +3,27 @@ package mysticworld.items;
|
|||
import java.util.List;
|
||||
|
||||
import mysticworld.MysticWorld;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemBushFruit extends ItemFood {
|
||||
private Icon[] icons;
|
||||
private IIcon[] icons;
|
||||
private static final String[] FRUIT_TYPES = new String[] { "Mundane", "Poison", "Weakness", "Slowness", "Harming", "Wither", "Health", "Speed", "FireResistance", "Regen", "NightVision",
|
||||
"Invisibility" };
|
||||
|
||||
public ItemBushFruit(int id, int health) {
|
||||
super(id, health, 0.6F, false);
|
||||
public ItemBushFruit(int health) {
|
||||
super(health, 0.6F, false);
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
maxStackSize = 64;
|
||||
|
|
@ -32,7 +33,7 @@ public class ItemBushFruit extends ItemFood {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int meta) {
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
int j = MathHelper.clamp_int(meta, 0, FRUIT_TYPES.length);
|
||||
return icons[j];
|
||||
}
|
||||
|
|
@ -44,7 +45,7 @@ public class ItemBushFruit extends ItemFood {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for (int var4 = 0; var4 < FRUIT_TYPES.length; var4++) {
|
||||
par3List.add(new ItemStack(par1, 1, var4));
|
||||
}
|
||||
|
|
@ -60,8 +61,8 @@ public class ItemBushFruit extends ItemFood {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister) {
|
||||
icons = new Icon[FRUIT_TYPES.length];
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
icons = new IIcon[FRUIT_TYPES.length];
|
||||
for (int i = 0; i < FRUIT_TYPES.length; ++i) {
|
||||
icons[i] = iconRegister.registerIcon("mysticworld:Fruit" + FRUIT_TYPES[i]);
|
||||
}
|
||||
|
|
@ -76,77 +77,77 @@ public class ItemBushFruit extends ItemFood {
|
|||
case 1:
|
||||
potion = player.getActivePotionEffect(Potion.poison);
|
||||
if (potion != null) {
|
||||
duration = potion.duration;
|
||||
duration = potion.getDuration();
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(Potion.poison.id, duration + 160, 0));
|
||||
break;
|
||||
case 2:
|
||||
potion = player.getActivePotionEffect(Potion.weakness);
|
||||
if (potion != null) {
|
||||
duration = potion.duration;
|
||||
duration = potion.getDuration();
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(Potion.weakness.id, duration + 160, 0));
|
||||
break;
|
||||
case 3:
|
||||
potion = player.getActivePotionEffect(Potion.moveSlowdown);
|
||||
if (potion != null) {
|
||||
duration = potion.duration;
|
||||
duration = potion.getDuration();
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, duration + 160, 0));
|
||||
break;
|
||||
case 4:
|
||||
potion = player.getActivePotionEffect(Potion.harm);
|
||||
if (potion != null) {
|
||||
duration = potion.duration;
|
||||
duration = potion.getDuration();
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(Potion.harm.id, duration + 1, 0));
|
||||
break;
|
||||
case 5:
|
||||
potion = player.getActivePotionEffect(Potion.wither);
|
||||
if (potion != null) {
|
||||
duration = potion.duration;
|
||||
duration = potion.getDuration();
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(Potion.wither.id, duration + 160, 0));
|
||||
break;
|
||||
case 6:
|
||||
potion = player.getActivePotionEffect(Potion.heal);
|
||||
if (potion != null) {
|
||||
duration = potion.duration;
|
||||
duration = potion.getDuration();
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(Potion.heal.id, duration + 1, 0));
|
||||
break;
|
||||
case 7:
|
||||
potion = player.getActivePotionEffect(Potion.moveSpeed);
|
||||
if (potion != null) {
|
||||
duration = potion.duration;
|
||||
duration = potion.getDuration();
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, duration + 160, 0));
|
||||
break;
|
||||
case 8:
|
||||
potion = player.getActivePotionEffect(Potion.fireResistance);
|
||||
if (potion != null) {
|
||||
duration = potion.duration;
|
||||
duration = potion.getDuration();
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, duration + 160, 0));
|
||||
break;
|
||||
case 9:
|
||||
potion = player.getActivePotionEffect(Potion.regeneration);
|
||||
if (potion != null) {
|
||||
duration = potion.duration;
|
||||
duration = potion.getDuration();
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, duration + 160, 0));
|
||||
break;
|
||||
case 10:
|
||||
potion = player.getActivePotionEffect(Potion.nightVision);
|
||||
if (potion != null) {
|
||||
duration = potion.duration;
|
||||
duration = potion.getDuration();
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, duration + 160, 0));
|
||||
break;
|
||||
case 11:
|
||||
potion = player.getActivePotionEffect(Potion.invisibility);
|
||||
if (potion != null) {
|
||||
duration = potion.duration;
|
||||
duration = potion.getDuration();
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(Potion.invisibility.id, duration + 160, 0));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -4,21 +4,21 @@ import java.util.List;
|
|||
|
||||
import mysticworld.MysticWorld;
|
||||
import mysticworld.lib.Strings;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
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.Icon;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemImbuedShard extends Item {
|
||||
private Icon[] icons;
|
||||
private IIcon[] icons;
|
||||
private static final String[] SHARD_TYPES = new String[] { "Fire", "Water", "Earth", "Air", "Energy" };
|
||||
|
||||
public ItemImbuedShard(int id) {
|
||||
super(id);
|
||||
public ItemImbuedShard() {
|
||||
super();
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName(Strings.IMBUED_SHARD_NAME);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
|
|
@ -26,14 +26,14 @@ public class ItemImbuedShard extends Item {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int meta) {
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
int j = MathHelper.clamp_int(meta, 0, 5);
|
||||
return icons[j];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for (int var4 = 0; var4 < SHARD_TYPES.length; var4++) {
|
||||
par3List.add(new ItemStack(par1, 1, var4));
|
||||
}
|
||||
|
|
@ -47,8 +47,8 @@ public class ItemImbuedShard extends Item {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister) {
|
||||
icons = new Icon[SHARD_TYPES.length];
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
icons = new IIcon[SHARD_TYPES.length];
|
||||
for (int i = 0; i < SHARD_TYPES.length; ++i) {
|
||||
icons[i] = iconRegister.registerIcon("mysticworld:Shard" + SHARD_TYPES[i]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import mysticworld.MysticWorld;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemOrb extends Item {
|
||||
Random rand = new Random();
|
||||
|
||||
public ItemOrb(int id) {
|
||||
super(id);
|
||||
public ItemOrb() {
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(200);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
|
|
@ -21,6 +21,6 @@ public class ItemOrb extends Item {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister par1IconRegister) {
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import net.minecraft.world.World;
|
|||
import org.lwjgl.input.Mouse;
|
||||
|
||||
public class ItemOrbAir extends ItemOrb {
|
||||
public ItemOrbAir(int id) {
|
||||
super(id);
|
||||
public ItemOrbAir() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,26 +1,15 @@
|
|||
package mysticworld.items;
|
||||
|
||||
import mysticworld.MysticWorld;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockCocoa;
|
||||
import net.minecraft.block.BlockCrops;
|
||||
import net.minecraft.block.BlockDirectional;
|
||||
import net.minecraft.block.BlockMushroom;
|
||||
import net.minecraft.block.BlockSapling;
|
||||
import net.minecraft.block.BlockStem;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemDye;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.Event.Result;
|
||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
|
||||
public class ItemOrbEarth extends ItemOrb {
|
||||
public ItemOrbEarth(int id) {
|
||||
super(id);
|
||||
public ItemOrbEarth() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -47,113 +36,6 @@ public class ItemOrbEarth extends ItemOrb {
|
|||
}
|
||||
|
||||
public static boolean applyBonemeal(ItemStack itemStack, World par1World, int par2, int par3, int par4, EntityPlayer player) {
|
||||
int l = par1World.getBlockId(par2, par3, par4);
|
||||
BonemealEvent event = new BonemealEvent(player, par1World, l, par2, par3, par4);
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) {
|
||||
return false;
|
||||
}
|
||||
if (event.getResult() == Result.ALLOW) {
|
||||
itemStack.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
if (l == Block.sapling.blockID) {
|
||||
if (!par1World.isRemote) {
|
||||
if (par1World.rand.nextFloat() < 0.45D) {
|
||||
((BlockSapling) Block.sapling).markOrGrowMarked(par1World, par2, par3, par4, par1World.rand);
|
||||
}
|
||||
itemStack.damageItem(1, player);
|
||||
}
|
||||
return true;
|
||||
} else if (l == Block.cobblestone.blockID) {
|
||||
if (!par1World.isRemote) {
|
||||
par1World.setBlock(par2, par3, par4, Block.cobblestoneMossy.blockID);
|
||||
}
|
||||
itemStack.damageItem(1, player);
|
||||
} else if (l == Block.deadBush.blockID) {
|
||||
if (!par1World.isRemote) {
|
||||
par1World.setBlock(par2, par3, par4, 0);
|
||||
par1World.spawnEntityInWorld(new EntityItem(par1World, par2, par3, par4, new ItemStack(Block.sapling, 1)));
|
||||
}
|
||||
itemStack.damageItem(1, player);
|
||||
} else if (l != Block.mushroomBrown.blockID && l != Block.mushroomRed.blockID) {
|
||||
if (l != Block.melonStem.blockID && l != Block.pumpkinStem.blockID) {
|
||||
if (l > 0 && Block.blocksList[l] instanceof BlockCrops) {
|
||||
if (par1World.getBlockMetadata(par2, par3, par4) == 7) {
|
||||
return false;
|
||||
} else {
|
||||
if (!par1World.isRemote) {
|
||||
((BlockCrops) Block.blocksList[l]).fertilize(par1World, par2, par3, par4);
|
||||
itemStack.damageItem(1, player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
int i1;
|
||||
int j1;
|
||||
int k1;
|
||||
if (l == Block.cocoaPlant.blockID) {
|
||||
i1 = par1World.getBlockMetadata(par2, par3, par4);
|
||||
j1 = BlockDirectional.getDirection(i1);
|
||||
k1 = BlockCocoa.func_72219_c(i1);
|
||||
if (k1 >= 2) {
|
||||
return false;
|
||||
} else {
|
||||
if (!par1World.isRemote) {
|
||||
++k1;
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, k1 << 2 | j1, 2);
|
||||
itemStack.damageItem(1, player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else if (l != Block.grass.blockID) {
|
||||
return false;
|
||||
} else {
|
||||
if (!par1World.isRemote) {
|
||||
itemStack.damageItem(1, player);
|
||||
label102: for (i1 = 0; i1 < 128; ++i1) {
|
||||
j1 = par2;
|
||||
k1 = par3 + 1;
|
||||
int l1 = par4;
|
||||
for (int i2 = 0; i2 < i1 / 16; ++i2) {
|
||||
j1 += itemRand.nextInt(3) - 1;
|
||||
k1 += (itemRand.nextInt(3) - 1) * itemRand.nextInt(3) / 2;
|
||||
l1 += itemRand.nextInt(3) - 1;
|
||||
if (par1World.getBlockId(j1, k1 - 1, l1) != Block.grass.blockID || par1World.isBlockNormalCube(j1, k1, l1)) {
|
||||
continue label102;
|
||||
}
|
||||
}
|
||||
if (par1World.getBlockId(j1, k1, l1) == 0) {
|
||||
if (itemRand.nextInt(10) != 0) {
|
||||
if (Block.tallGrass.canBlockStay(par1World, j1, k1, l1)) {
|
||||
par1World.setBlock(j1, k1, l1, Block.tallGrass.blockID, 1, 3);
|
||||
}
|
||||
} else {
|
||||
ForgeHooks.plantGrass(par1World, j1, k1, l1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (par1World.getBlockMetadata(par2, par3, par4) == 7) {
|
||||
return false;
|
||||
} else {
|
||||
if (!par1World.isRemote) {
|
||||
((BlockStem) Block.blocksList[l]).fertilizeStem(par1World, par2, par3, par4);
|
||||
itemStack.damageItem(1, player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (!par1World.isRemote) {
|
||||
if (par1World.rand.nextFloat() < 0.4D) {
|
||||
((BlockMushroom) Block.blocksList[l]).fertilizeMushroom(par1World, par2, par3, par4, par1World.rand);
|
||||
}
|
||||
itemStack.damageItem(1, player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return ItemDye.applyBonemeal(itemStack, par1World, par2, par3, par4, player);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,16 +2,18 @@ package mysticworld.items;
|
|||
|
||||
import mysticworld.MysticWorld;
|
||||
import mysticworld.blocks.BlockHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemOrbEnergy extends ItemOrb {
|
||||
public ItemOrbEnergy(int id) {
|
||||
super(id);
|
||||
public ItemOrbEnergy() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -37,10 +39,10 @@ public class ItemOrbEnergy extends ItemOrb {
|
|||
if (!entityPlayer.canPlayerEdit(par4, par5, par6, par7, itemStack)) {
|
||||
return false;
|
||||
} else {
|
||||
int i1 = world.getBlockId(par4, par5, par6);
|
||||
if (i1 == 0) {
|
||||
Block i1 = world.getBlock(par4, par5, par6);
|
||||
if (i1 == Blocks.air) {
|
||||
world.playSoundEffect(par4 + 0.5D, par5 + 0.5D, par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(par4, par5, par6, BlockHandler.lightCube.blockID);
|
||||
world.setBlock(par4, par5, par6, BlockHandler.lightCube);
|
||||
}
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
|
@ -12,8 +13,8 @@ import net.minecraft.util.DamageSource;
|
|||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemOrbFire extends ItemOrb {
|
||||
public ItemOrbFire(int id) {
|
||||
super(id);
|
||||
public ItemOrbFire() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -49,7 +50,7 @@ public class ItemOrbFire extends ItemOrb {
|
|||
} else {
|
||||
if (par3World.isAirBlock(par4, par5, par6)) {
|
||||
par3World.playSoundEffect(par4 + 0.5D, par5 + 0.5D, par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
par3World.setBlock(par4, par5, par6, Block.fire.blockID);
|
||||
par3World.setBlock(par4, par5, par6, Blocks.fire);
|
||||
}
|
||||
par1ItemStack.damageItem(1, par2EntityPlayer);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemOrbWater extends ItemOrb {
|
||||
public ItemOrbWater(int id) {
|
||||
super(id);
|
||||
public ItemOrbWater() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -21,7 +21,7 @@ public class ItemOrbWater extends ItemOrb {
|
|||
if (movingobjectposition == null) {
|
||||
return itemStack;
|
||||
} else {
|
||||
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
int i = movingobjectposition.blockX;
|
||||
int j = movingobjectposition.blockY;
|
||||
int k = movingobjectposition.blockZ;
|
||||
|
|
@ -31,7 +31,7 @@ public class ItemOrbWater extends ItemOrb {
|
|||
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) {
|
||||
return itemStack;
|
||||
}
|
||||
if (world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0) {
|
||||
if (world.getBlock(i, j, k).getMaterial() == Material.water && world.getBlockMetadata(i, j, k) == 0) {
|
||||
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlockToAir(i, j, k);
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
|
|
@ -58,10 +58,10 @@ public class ItemOrbWater extends ItemOrb {
|
|||
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) {
|
||||
return itemStack;
|
||||
} else {
|
||||
int i1 = world.getBlockId(i, j, k);
|
||||
if (i1 == 0) {
|
||||
Block i1 = world.getBlock(i, j, k);
|
||||
if (i1 == Blocks.air) {
|
||||
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(i, j, k, Block.waterMoving.blockID);
|
||||
world.setBlock(i, j, k, Blocks.flowing_water);
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
}
|
||||
return itemStack;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package mysticworld.items;
|
|||
import java.util.Random;
|
||||
|
||||
import mysticworld.MysticWorld;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
|
@ -11,8 +11,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
public class ItemStaff extends Item {
|
||||
Random rand = new Random();
|
||||
|
||||
public ItemStaff(int id) {
|
||||
super(id);
|
||||
public ItemStaff() {
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(200);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
|
|
@ -26,6 +26,6 @@ public class ItemStaff extends Item {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister par1IconRegister) {
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import net.minecraft.world.World;
|
|||
import org.lwjgl.input.Mouse;
|
||||
|
||||
public class ItemStaffAir extends ItemStaff {
|
||||
public ItemStaffAir(int id) {
|
||||
super(id);
|
||||
public ItemStaffAir() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -33,13 +33,13 @@ public class ItemStaffAir extends ItemStaff {
|
|||
ItemStack currentItem = player.inventory.getCurrentItem();
|
||||
itemStack.stackTagCompound.setInteger("maxChargeTime", 3 * 20);
|
||||
if (currentItem != null) {
|
||||
if (currentItem.itemID == itemStack.itemID) {
|
||||
if (currentItem.getItem() == itemStack.getItem()) {
|
||||
player.fallDistance = 0.0F;
|
||||
chargeEffect(itemStack, world, player);
|
||||
if (!Mouse.isButtonDown(1)) {
|
||||
if (itemStack.stackTagCompound.getInteger("chargeTime") > 0) {
|
||||
if (!world.isRemote) {
|
||||
world.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) player.posX, (int) player.posY, (int) player.posZ, 0);
|
||||
world.playAuxSFXAtEntity(null, 1009, (int) player.posX, (int) player.posY, (int) player.posZ, 0);
|
||||
world.spawnEntityInWorld(new EntityChargeAir(world, player, 1.0f + ((itemStack.stackTagCompound.getInteger("chargeTime")) * (5.0f * (1 / (float) itemStack.stackTagCompound
|
||||
.getInteger("maxChargeTime")))), (itemStack.stackTagCompound.getInteger("chargeTime")) * (2.5D * (1.0D / itemStack.stackTagCompound.getInteger("maxChargeTime")))));
|
||||
itemStack.damageItem(1, player);
|
||||
|
|
|
|||
|
|
@ -2,40 +2,26 @@ package mysticworld.items;
|
|||
|
||||
import mysticworld.MysticWorld;
|
||||
import mysticworld.entity.EntityChargeEarth;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockCocoa;
|
||||
import net.minecraft.block.BlockCrops;
|
||||
import net.minecraft.block.BlockDirectional;
|
||||
import net.minecraft.block.BlockMushroom;
|
||||
import net.minecraft.block.BlockSapling;
|
||||
import net.minecraft.block.BlockStem;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemDye;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.Event.Result;
|
||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class ItemStaffEarth extends ItemStaff {
|
||||
public ItemStaffEarth(int id) {
|
||||
super(id);
|
||||
public ItemStaffEarth() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
|
||||
if (movingobjectposition == null) {
|
||||
return itemStack;
|
||||
} else {
|
||||
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
int i = movingobjectposition.blockX;
|
||||
int j = movingobjectposition.blockY;
|
||||
int k = movingobjectposition.blockZ;
|
||||
|
|
@ -55,7 +41,7 @@ public class ItemStaffEarth extends ItemStaff {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
world.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ, 0);
|
||||
world.playAuxSFXAtEntity(null, 1009, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ, 0);
|
||||
if (!world.isRemote) {
|
||||
world.spawnEntityInWorld(new EntityChargeEarth(world, entityPlayer));
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
|
|
@ -74,113 +60,6 @@ public class ItemStaffEarth extends ItemStaff {
|
|||
}
|
||||
|
||||
public static boolean applyBonemeal(ItemStack itemStack, World par1World, int par2, int par3, int par4, EntityPlayer player) {
|
||||
int l = par1World.getBlockId(par2, par3, par4);
|
||||
BonemealEvent event = new BonemealEvent(player, par1World, l, par2, par3, par4);
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) {
|
||||
return false;
|
||||
}
|
||||
if (event.getResult() == Result.ALLOW) {
|
||||
itemStack.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
if (l == Block.sapling.blockID) {
|
||||
if (!par1World.isRemote) {
|
||||
if (par1World.rand.nextFloat() < 0.45D) {
|
||||
((BlockSapling) Block.sapling).markOrGrowMarked(par1World, par2, par3, par4, par1World.rand);
|
||||
}
|
||||
itemStack.damageItem(1, player);
|
||||
}
|
||||
return true;
|
||||
} else if (l == Block.cobblestone.blockID) {
|
||||
if (!par1World.isRemote) {
|
||||
par1World.setBlock(par2, par3, par4, Block.cobblestoneMossy.blockID);
|
||||
}
|
||||
itemStack.damageItem(1, player);
|
||||
} else if (l == Block.deadBush.blockID) {
|
||||
if (!par1World.isRemote) {
|
||||
par1World.setBlock(par2, par3, par4, 0);
|
||||
par1World.spawnEntityInWorld(new EntityItem(par1World, par2, par3, par4, new ItemStack(Block.sapling, 1)));
|
||||
}
|
||||
itemStack.damageItem(1, player);
|
||||
} else if (l != Block.mushroomBrown.blockID && l != Block.mushroomRed.blockID) {
|
||||
if (l != Block.melonStem.blockID && l != Block.pumpkinStem.blockID) {
|
||||
if (l > 0 && Block.blocksList[l] instanceof BlockCrops) {
|
||||
if (par1World.getBlockMetadata(par2, par3, par4) == 7) {
|
||||
return false;
|
||||
} else {
|
||||
if (!par1World.isRemote) {
|
||||
((BlockCrops) Block.blocksList[l]).fertilize(par1World, par2, par3, par4);
|
||||
itemStack.damageItem(1, player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
int i1;
|
||||
int j1;
|
||||
int k1;
|
||||
if (l == Block.cocoaPlant.blockID) {
|
||||
i1 = par1World.getBlockMetadata(par2, par3, par4);
|
||||
j1 = BlockDirectional.getDirection(i1);
|
||||
k1 = BlockCocoa.func_72219_c(i1);
|
||||
if (k1 >= 2) {
|
||||
return false;
|
||||
} else {
|
||||
if (!par1World.isRemote) {
|
||||
++k1;
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, k1 << 2 | j1, 2);
|
||||
itemStack.damageItem(1, player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else if (l != Block.grass.blockID) {
|
||||
return false;
|
||||
} else {
|
||||
if (!par1World.isRemote) {
|
||||
itemStack.damageItem(1, player);
|
||||
label102: for (i1 = 0; i1 < 128; ++i1) {
|
||||
j1 = par2;
|
||||
k1 = par3 + 1;
|
||||
int l1 = par4;
|
||||
for (int i2 = 0; i2 < i1 / 16; ++i2) {
|
||||
j1 += itemRand.nextInt(3) - 1;
|
||||
k1 += (itemRand.nextInt(3) - 1) * itemRand.nextInt(3) / 2;
|
||||
l1 += itemRand.nextInt(3) - 1;
|
||||
if (par1World.getBlockId(j1, k1 - 1, l1) != Block.grass.blockID || par1World.isBlockNormalCube(j1, k1, l1)) {
|
||||
continue label102;
|
||||
}
|
||||
}
|
||||
if (par1World.getBlockId(j1, k1, l1) == 0) {
|
||||
if (itemRand.nextInt(10) != 0) {
|
||||
if (Block.tallGrass.canBlockStay(par1World, j1, k1, l1)) {
|
||||
par1World.setBlock(j1, k1, l1, Block.tallGrass.blockID, 1, 3);
|
||||
}
|
||||
} else {
|
||||
ForgeHooks.plantGrass(par1World, j1, k1, l1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (par1World.getBlockMetadata(par2, par3, par4) == 7) {
|
||||
return false;
|
||||
} else {
|
||||
if (!par1World.isRemote) {
|
||||
((BlockStem) Block.blocksList[l]).fertilizeStem(par1World, par2, par3, par4);
|
||||
itemStack.damageItem(1, player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (!par1World.isRemote) {
|
||||
if (par1World.rand.nextFloat() < 0.4D) {
|
||||
((BlockMushroom) Block.blocksList[l]).fertilizeMushroom(par1World, par2, par3, par4, par1World.rand);
|
||||
}
|
||||
itemStack.damageItem(1, player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return ItemDye.applyBonemeal(itemStack, par1World, par2, par3, par4, player);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,25 +8,22 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class ItemStaffEnegy extends ItemStaff {
|
||||
public ItemStaffEnegy(int id) {
|
||||
super(id);
|
||||
public ItemStaffEnegy() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
|
||||
if (movingobjectposition == null) {
|
||||
return itemStack;
|
||||
} else {
|
||||
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
int i = movingobjectposition.blockX;
|
||||
int j = movingobjectposition.blockY;
|
||||
int k = movingobjectposition.blockZ;
|
||||
|
|
@ -59,7 +56,7 @@ public class ItemStaffEnegy extends ItemStaff {
|
|||
} else {
|
||||
if (world.isAirBlock(i, j, k)) {
|
||||
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(i, j, k, BlockHandler.lightCube.blockID);
|
||||
world.setBlock(i, j, k, BlockHandler.lightCube);
|
||||
}
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
return itemStack;
|
||||
|
|
@ -68,7 +65,7 @@ public class ItemStaffEnegy extends ItemStaff {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
world.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ, 0);
|
||||
world.playAuxSFXAtEntity(null, 1009, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ, 0);
|
||||
if (!world.isRemote) {
|
||||
world.spawnEntityInWorld(new EntityChargeEnergy(world, entityPlayer));
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
|
|
|
|||
|
|
@ -6,25 +6,23 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class ItemStaffFire extends ItemStaff {
|
||||
public ItemStaffFire(int id) {
|
||||
super(id);
|
||||
public ItemStaffFire() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean itemInteractionForEntity(ItemStack itemStack, EntityPlayer entityPlayer, EntityLivingBase entityLiving) {
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
entityLiving.setFire(5);
|
||||
entityLiving.attackEntityFrom(DamageSource.magic, 7);
|
||||
itemStack.damageItem(1, entityLiving);
|
||||
|
|
@ -35,12 +33,12 @@ public class ItemStaffFire extends ItemStaff {
|
|||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
|
||||
if (movingobjectposition == null) {
|
||||
return itemStack;
|
||||
} else {
|
||||
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
int i = movingobjectposition.blockX;
|
||||
int j = movingobjectposition.blockY;
|
||||
int k = movingobjectposition.blockZ;
|
||||
|
|
@ -50,12 +48,12 @@ public class ItemStaffFire extends ItemStaff {
|
|||
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) {
|
||||
return itemStack;
|
||||
} else {
|
||||
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(world.getBlockId(i, j, k), 1, world.getBlockMetadata(i, j, k)));
|
||||
if (!world.isRemote && !(result == null)) {
|
||||
int id = result.itemID;
|
||||
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(world.getBlock(i, j, k), 1, world.getBlockMetadata(i, j, k)));
|
||||
if (!world.isRemote && result != null) {
|
||||
Item id = result.getItem();
|
||||
int meta = result.getItemDamage();
|
||||
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(i, j, k, 0);
|
||||
world.setBlockToAir(i, j, k);
|
||||
world.spawnEntityInWorld(new EntityItem(world, i, j, k, new ItemStack(id, 1, meta)));
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
}
|
||||
|
|
@ -63,7 +61,7 @@ public class ItemStaffFire extends ItemStaff {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
world.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ, 0);
|
||||
world.playAuxSFXAtEntity(null, 1009, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ, 0);
|
||||
if (!world.isRemote) {
|
||||
world.spawnEntityInWorld(new EntityChargeFire(world, entityPlayer));
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
|
|
|
|||
|
|
@ -3,35 +3,35 @@ package mysticworld.items;
|
|||
import java.util.List;
|
||||
|
||||
import mysticworld.MysticWorld;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
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.Icon;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemStaffParts extends Item {
|
||||
private Icon[] icons;
|
||||
private IIcon[] icons;
|
||||
private static final String[] STAFF_PARTS = new String[] { "Staff", "Hilt", "Handle", "Head" };
|
||||
|
||||
public ItemStaffParts(int id) {
|
||||
super(id);
|
||||
public ItemStaffParts() {
|
||||
super();
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int meta) {
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
int j = MathHelper.clamp_int(meta, 0, STAFF_PARTS.length);
|
||||
return icons[j];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for (int var4 = 0; var4 < STAFF_PARTS.length; var4++) {
|
||||
par3List.add(new ItemStack(par1, 1, var4));
|
||||
}
|
||||
|
|
@ -51,8 +51,8 @@ public class ItemStaffParts extends Item {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister) {
|
||||
icons = new Icon[STAFF_PARTS.length];
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
icons = new IIcon[STAFF_PARTS.length];
|
||||
for (int i = 0; i < STAFF_PARTS.length; ++i) {
|
||||
icons[i] = iconRegister.registerIcon("mysticworld:StaffPart_" + STAFF_PARTS[i]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
package mysticworld.items;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemStaffPower extends Item {
|
||||
private Icon[] icons;
|
||||
private IIcon[] icons;
|
||||
private static final String[] CHARGE_NAMES = new String[] { "Fire", "Water", "Earth", "Air", "Energy" };
|
||||
|
||||
public ItemStaffPower(int id) {
|
||||
super(id);
|
||||
public ItemStaffPower() {
|
||||
super();
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(null);
|
||||
maxStackSize = 64;
|
||||
|
|
@ -21,7 +21,7 @@ public class ItemStaffPower extends Item {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int meta) {
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
int j = MathHelper.clamp_int(meta, 0, 5);
|
||||
return icons[j];
|
||||
}
|
||||
|
|
@ -34,8 +34,8 @@ public class ItemStaffPower extends Item {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister) {
|
||||
icons = new Icon[CHARGE_NAMES.length];
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
icons = new IIcon[CHARGE_NAMES.length];
|
||||
for (int i = 0; i < CHARGE_NAMES.length; ++i) {
|
||||
icons[i] = iconRegister.registerIcon("mysticworld:Charge" + CHARGE_NAMES[i]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,16 +6,14 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class ItemStaffWater extends ItemStaff {
|
||||
public ItemStaffWater(int id) {
|
||||
super(id);
|
||||
public ItemStaffWater() {
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(200);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
|
|
@ -23,12 +21,12 @@ public class ItemStaffWater extends ItemStaff {
|
|||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
|
||||
if (movingobjectposition == null) {
|
||||
return itemStack;
|
||||
} else {
|
||||
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
int i = movingobjectposition.blockX;
|
||||
int j = movingobjectposition.blockY;
|
||||
int k = movingobjectposition.blockZ;
|
||||
|
|
@ -38,7 +36,7 @@ public class ItemStaffWater extends ItemStaff {
|
|||
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) {
|
||||
return itemStack;
|
||||
}
|
||||
if (world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0) {
|
||||
if (world.getBlock(i, j, k).getMaterial() == Material.water && world.getBlockMetadata(i, j, k) == 0) {
|
||||
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlockToAir(i, j, k);
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
|
|
@ -65,10 +63,10 @@ public class ItemStaffWater extends ItemStaff {
|
|||
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) {
|
||||
return itemStack;
|
||||
} else {
|
||||
int i1 = world.getBlockId(i, j, k);
|
||||
if (i1 == 0) {
|
||||
Block i1 = world.getBlock(i, j, k);
|
||||
if (i1 == Blocks.air) {
|
||||
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
world.setBlock(i, j, k, Block.waterMoving.blockID);
|
||||
world.setBlock(i, j, k, Blocks.flowing_water);
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
}
|
||||
return itemStack;
|
||||
|
|
@ -78,7 +76,7 @@ public class ItemStaffWater extends ItemStaff {
|
|||
return itemStack;
|
||||
}
|
||||
} else {
|
||||
world.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ, 0);
|
||||
world.playAuxSFXAtEntity(null, 1009, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ, 0);
|
||||
if (!world.isRemote) {
|
||||
world.spawnEntityInWorld(new EntityChargeWater(world, entityPlayer));
|
||||
itemStack.damageItem(1, entityPlayer);
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemVoidShard extends Item {
|
||||
public ItemVoidShard(int id) {
|
||||
super(id);
|
||||
public ItemVoidShard() {
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
this.setMaxDamage(1);
|
||||
|
|
@ -28,7 +28,7 @@ public class ItemVoidShard extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack itemStack) {
|
||||
public boolean hasEffect(ItemStack itemStack, int i) {
|
||||
if (itemStack.stackTagCompound == null)
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
if (itemStack.stackTagCompound.hasKey("filled")) {
|
||||
|
|
@ -44,7 +44,7 @@ public class ItemVoidShard extends Item {
|
|||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
int experience = entityPlayer.experienceLevel;
|
||||
int experienceSubtract = entityPlayer.experienceLevel - 30;
|
||||
if (itemStack.stackTagCompound.getBoolean("filled") == false) {
|
||||
if (!itemStack.stackTagCompound.getBoolean("filled")) {
|
||||
if (experience > 0 && experience <= 30) {
|
||||
entityPlayer.experienceLevel = 0;
|
||||
itemStack.stackTagCompound.setInteger("xpStored", experience);
|
||||
|
|
|
|||
Loading…
Reference in a new issue