public class ItemModArmor extends ItemArmor
{
private static final int maxDamageArray[] =
{
11, 16, 15, 13
};
public final int ArmorType;
public final int DamageReduceAmount;
public final int RenderIndex;
private final EnumModArmorMaterial Material;
public ItemModArmor(int i, EnumModArmorMaterial enumarmormaterial, int j, int k)
{
super(i, EnumArmorMaterial.DIAMOND, j, k);
Material = enumarmormaterial;
ArmorType = k;
RenderIndex = j;
DamageReduceAmount = enumarmormaterial.getDamageReductionAmount(k);
setMaxDamage(enumarmormaterial.getDurability(k));
maxStackSize = 1;
}
@Override
public int getItemEnchantability()
{
return Material.getEnchantability();
}
static int[] getMaxDamageArray()
{
return maxDamageArray;
}
}
And Here is the EnumModArmorMaterial.java:
public enum EnumModArmorMaterial
{
OBSIDIAN(36, new int[]{4, 9, 7, 4}, 12);
private int maxDamageFactor;
private int damageReductionAmountArray[];
/**
* Return the enchantability factor of the material
*/
private int enchantability;
private int colour;
private EnumModArmorMaterial(int par3, int par4ArrayOfInteger[], int par5)
{
maxDamageFactor = par3;
damageReductionAmountArray = par4ArrayOfInteger;
enchantability = par5;
}
/**
* Returns the durability for a armor slot of for this type.
*/
public int getDurability(int par1)
{
return ItemModArmor.getMaxDamageArray()[par1] * maxDamageFactor;
}
/**
* Return the damage reduction (each 1 point is a half a shield on gui) of
* the piece index passed (0 = helmet, 1 = plate, 2 = legs and 3 = boots)
*/
public int getDamageReductionAmount(int par1)
{
return damageReductionAmountArray[par1];
}
/**
* Return the enchantability factor of the material.
*/
public int getEnchantability()
{
return enchantability;
}
}
New mod that adds lampposts! Unlike other mods I have seen, this one doesn't have a fixed length (although there is a maximum of 5 blocks high) and can be activated with redstone. Right now, the material is wood, but the next update will probably contain iron and a "nether" type lamp post.
package net.minecraft.src;
import javax.swing.Timer;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;
public class BlockPlate extends Block {
public BlockPlate(int i, int j) {
super(i, j, Material.iron);
}
Timer timer;
public int idDropped(int i, int j) {
return dirt.blockID;
}
public int quantityDropped(Random random) {
return 1;
}
public void onEntityCollidedWithBlock(final World world, final int i, final int j, final int k, Entity entity) {
//checks that the entity that collided is the Player
if(entity != null && entity.equals(ModLoader.getMinecraftInstance().thePlayer)) {
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("You Have Ten Seconds Until the Hunger Games begin!");
} else {
return;
}
if (timer == null) {
ActionListener actionListener = new ActionListener() {
int x = i;
int y = j;
int z = k;
public void actionPerformed(ActionEvent e) {
//Spawning entity and setting location
Entity entity = new Entitycareertribute1m(world);
entity.posX = x;
entity.posY = y + 1;
entity.posZ = z;
world.spawnEntityInWorld(entity);
}
};
//timer will just run once
timer = new Timer(10000, actionListener);
timer.setRepeats(false);
timer.start();
} else {
timer.restart();
}
}
}
package net.minecraft.src;
import javax.swing.Timer;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;
public class BlockPlate extends Block{
public BlockPlate(int i, int j){
super(i, j, Material.iron);
}
Timer timer;
public int idDropped(int i, int j)
{
return dirt.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
public void onEntityCollidedWithBlock(World world, int i, int j, int k, EntityPlayer entity)
{
ModLoader.getMinecraftInstance().thePlayer.addChatMessage("You Have Ten Seconds Until the Hunger Games begin!");
if (timer == null) {
ActionListener actionListener = new ActionListener() {
int x = i;
int y = j;
int z = k;
public void actionPerformed(ActionEvent e)
{
Entity entity = new Entitycareertribute1m(world);
entity.posX = x;
entity.posY = y + 1;
entity.posZ = z;
worldObj.spawnEntityInWorld(entity);
}
}
}
timer = new Timer(10000, this);
timer.setRepeats(false);
timer.start();
}
else {
timer.restart();
}
}
}
There are two fields in the EntityPlayer class which could be useful to you.
/**
* The total amount of experience the player has. This also includes the amount of experience within * their Experience Bar.
*/
public int experienceTotal;
/**
* The current amount of experience the player has within their Experience Bar.
*/
public float experience;
The tools are as fast as gold tools and have 2048 uses (diamond has 1561). With full armor, a skeleton arrow does half a heart of damage on Hard. The sword can kill a spider on Hard with two hits.
0
This should fix your problem.
Just a quick question, are you using an IDE or a text editor to write your code?
0
0
0
0
You need Python to use MCP and the Java SDK to compiler the .java files, which you create in a text editor or an IDE.
0
0
1
1
0
0
Then you would only need to do:
or
0
I don't think there is a method that returns a targeted Block.
0
No. It has diamond's enchantability.
Link Removed are the sources.
0
The tools are as fast as gold tools and have 2048 uses (diamond has 1561). With full armor, a skeleton arrow does half a heart of damage on Hard. The sword can kill a spider on Hard with two hits.
0
Thanks! I got confused with the image links, but it's fixed now.