I have a block which can have many instances and when it is activated the code is run twice, cause i click and item on it and item goes on to it, but because i now have an empty hand the second time the empty hand version runs and gives me the item straight back.
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 1)) {
boolean test = false;
TileEntityAirRuneAltar tileEntity = (TileEntityAirRuneAltar) world.getTileEntity(varx, vary, varz);
if (item != Items.airTalisman && world.getBlock(varx, vary, varz) == Blocks.AirRuneAltar) {
This sided check works fine, *everyone* does it this way. You're simply doing it wrong.
@Override
public boolean onBlockActivated(World world, int posX, int posY, int posZ, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
if (!world.isRemote) {
// do server side code here, it only happens once
} else {
// do client side code here, which is nothing for most people
}
}
}
} else if (!props.isSkillHighEnough("runecrafting", 5) && item == Items.waterTalisman && world.getBlock(varx, vary, varz) == Blocks.WaterRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 5, but you are only " + props.currentRunecraftingLevel);
}
}
} finally {
}
case "firerunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 14)) {
if (item == Items.fireTalisman && world.getBlock(varx, vary, varz) == Blocks.FireRuneAltar) {
TileEntityFireRuneAltar tileEntity = (TileEntityFireRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.fireRune, tileEntity.quantityOfRuneEssence)));
props.currentRunecraftingExp = props.currentRunecraftingExp + tileEntity.quantityOfRuneEssence * ExpChart.FIRE_RUNE_EXP;
Minecraft.getMinecraft().thePlayer.sendChatMessage("You gained " + tileEntity.quantityOfRuneEssence * ExpChart.FIRE_RUNE_EXP + " Runecrafting Experience.");
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 10);
if (randomint == 1) {
int randomRune = randInt(0, 1);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.mindRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.bodyRune, 1)));
break;
}
}
randomint = 10;
item = null;
}
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.FireAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 14) && item == Items.fireTalisman && world.getBlock(varx, vary, varz) == Blocks.FireRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 14, but you are only " + props.currentRunecraftingLevel);
}
}
case "earthrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 9)) {
if (item == Items.earthTalisman && world.getBlock(varx, vary, varz) == Blocks.EarthRuneAltar) {
TileEntityEarthRuneAltar tileEntity = (TileEntityEarthRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.earthRune, tileEntity.quantityOfRuneEssence)));
props.currentRunecraftingExp = props.currentRunecraftingExp + tileEntity.quantityOfRuneEssence * ExpChart.EARTH_RUNE_EXP;
Minecraft.getMinecraft().thePlayer.sendChatMessage("You gained " + tileEntity.quantityOfRuneEssence * ExpChart.EARTH_RUNE_EXP + " Runecrafting Experience.");
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 10);
if (randomint == 1) {
int randomRune = randInt(0, 1);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.mindRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.bodyRune, 1)));
break;
}
} else if (!props.isSkillHighEnough("runecrafting", 9) && item == Items.earthTalisman && world.getBlock(varx, vary, varz) == Blocks.EarthRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 9, but you are only " + props.currentRunecraftingLevel);
}
}
case "mindrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 23)) {
if (item == Items.mindTalisman && world.getBlock(varx, vary, varz) == Blocks.MindRuneAltar) {
TileEntityMindRuneAltar tileEntity = (TileEntityMindRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.mindRune, tileEntity.quantityOfRuneEssence)));
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 10);
if (randomint == 1) {
int randomRune = randInt(0, 2);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.natureRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.lawRune, 1)));
break;
case 2:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.cosmicRune, 1)));
break;
}
}
randomint = 10;
item = null;
}
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.MindAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 23) && item == Items.mindTalisman && world.getBlock(varx, vary, varz) == Blocks.MindRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 23, but you are only " + props.currentRunecraftingLevel);
}
}
case "bodyrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 18)) {
if (item == Items.bodyTalisman && world.getBlock(varx, vary, varz) == Blocks.BodyRuneAltar) {
TileEntityBodyRuneAltar tileEntity = (TileEntityBodyRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.bodyRune, tileEntity.quantityOfRuneEssence)));
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 10);
if (randomint == 1) {
int randomRune = randInt(0, 2);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.natureRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.lawRune, 1)));
break;
case 2:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.cosmicRune, 1)));
break;
}
}
randomint = 10;
item = null;
}
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.BodyAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 18) && item == Items.bodyTalisman && world.getBlock(varx, vary, varz) == Blocks.BodyRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 18, but you are only " + props.currentRunecraftingLevel);
}
}
case "cosmicrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 27)) {
if (item == Items.cosmicTalisman && world.getBlock(varx, vary, varz) == Blocks.CosmicRuneAltar) {
TileEntityCosmicRuneAltar tileEntity = (TileEntityCosmicRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.cosmicRune, tileEntity.quantityOfRuneEssence)));
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 20);
if (randomint == 1) {
int randomRune = randInt(0, 1);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.chaosRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.deathRune, 1)));
break;
}
} else if (!props.isSkillHighEnough("runecrafting", 27) && item == Items.cosmicTalisman && world.getBlock(varx, vary, varz) == Blocks.CosmicRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 27, but you are only " + props.currentRunecraftingLevel);
}
}
case "chaosrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 35)) {
if (item == Items.chaosTalisman && world.getBlock(varx, vary, varz) == Blocks.ChaosRuneAltar) {
TileEntityChaosRuneAltar tileEntity = (TileEntityChaosRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.chaosRune, tileEntity.quantityOfRuneEssence)));
item = null;
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.ChaosAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 35) && item == Items.chaosTalisman && world.getBlock(varx, vary, varz) == Blocks.ChaosRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 35, but you are only " + props.currentRunecraftingLevel);
}
}
case "naturerunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 44)) {
if (item == Items.natureTalisman && world.getBlock(varx, vary, varz) == Blocks.NatureRuneAltar) {
TileEntityNatureRuneAltar tileEntity = (TileEntityNatureRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.natureRune, tileEntity.quantityOfRuneEssence)));
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 20);
if (randomint == 1) {
int randomRune = randInt(0, 1);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.chaosRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.deathRune, 1)));
break;
}
}
randomint = 10;
item = null;
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.NatureAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 44) && item == Items.natureTalisman && world.getBlock(varx, vary, varz) == Blocks.NatureRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 44, but you are only " + props.currentRunecraftingLevel);
}
}
}
case "lawrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 54)) {
if (item == Items.lawTalisman && world.getBlock(varx, vary, varz) == Blocks.LawRuneAltar) {
TileEntityLawRuneAltar tileEntity = (TileEntityLawRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.lawRune, tileEntity.quantityOfRuneEssence)));
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 20);
if (randomint == 1) {
int randomRune = randInt(0, 1);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.chaosRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.deathRune, 1)));
break;
} else if (!props.isSkillHighEnough("runecrafting", 54) && item == Items.lawTalisman && world.getBlock(varx, vary, varz) == Blocks.LawRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 54, but you are only " + props.currentRunecraftingLevel);
}
}
}
case "deathrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 65)) {
if (item == Items.deathTalisman && world.getBlock(varx, vary, varz) == Blocks.DeathRuneAltar) {
TileEntityDeathRuneAltar tileEntity = (TileEntityDeathRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.deathRune, tileEntity.quantityOfRuneEssence)));
item = null;
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.DeathAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 65) && item == Items.deathTalisman && world.getBlock(varx, vary, varz) == Blocks.DeathRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 65, but you are only " + props.currentRunecraftingLevel);
}
}
case "bloodrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 77)) {
if (item == Items.bloodTalisman && world.getBlock(varx, vary, varz) == Blocks.BloodRuneAltar) {
TileEntityBloodRuneAltar tileEntity = (TileEntityBloodRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.bloodRune, tileEntity.quantityOfRuneEssence)));
item = null;
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.BloodAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 65) && item == Items.bloodTalisman && world.getBlock(varx, vary, varz) == Blocks.BloodRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 77, but you are only " + props.currentRunecraftingLevel);
}
}
case "astralrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 85)) {
if (item == Items.astralTalisman && world.getBlock(varx, vary, varz) == Blocks.AstralRuneAltar) {
TileEntityAstralRuneAltar tileEntity = (TileEntityAstralRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.astralRune, tileEntity.quantityOfRuneEssence)));
item = null;
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.AstralAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 85) && item == Items.astralTalisman && world.getBlock(varx, vary, varz) == Blocks.AstralRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 85, but you are only " + props.currentRunecraftingLevel);
}
}
That's huge, impossible to make sense of when the forum butchers indentation.
Remove it all, and do a System.out.println inside !world.isRemote clause - see how many times it prints out. If it's twice, something else is interfereing causing it to fire twice. No idea what though.
not a solution to your problem, but you are using Minecraft.getMinecraft().thePlayer to send messages.. Use the EntityPlayer variable in the methods arguments.. Also, you are checking if it is on the server side multiple times within the code, even within another check for server side..
Ok ive just decided to fix it, instead being able to use any item to take the item out, im just going to use a certain item. Tried this and it works now.
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 1)) {
boolean test = false;
TileEntityAirRuneAltar tileEntity = (TileEntityAirRuneAltar) world.getTileEntity(varx, vary, varz);
if (item != Items.airTalisman && world.getBlock(varx, vary, varz) == Blocks.AirRuneAltar) {
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.runeEssence, tileEntity.quantityOfRuneEssence)));
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.AirAltar);
break;
}
if (item == Items.airTalisman && world.getBlock(varx, vary, varz) == Blocks.AirRuneAltar && tileEntity.time == 0) {
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.airRune, tileEntity.quantityOfRuneEssence)));
props.currentRunecraftingExp = props.currentRunecraftingExp + tileEntity.quantityOfRuneEssence * ExpChart.AIR_RUNE_EXP;
Minecraft.getMinecraft().thePlayer.sendChatMessage("You gained " + tileEntity.quantityOfRuneEssence * ExpChart.AIR_RUNE_EXP + " Runecrafting Experience.");
// + " Runecrafting experience. It is now " +
// props.currentRunecraftingExp + "/3000"
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 5);
if (randomint == 1) {
int randomRune = randInt(0, 2);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.waterRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.fireRune, 1)));
break;
case 2:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.earthRune, 1)));
break;
}
}
randomint = 10;
item = null;
}
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.AirAltar);
break;
}
Art by me: MrPancakeWolfie@DeviantArt
public boolean onBlockActivated(World world, int varx, int vary, int varz, EntityPlayer entity, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
if (!world.isRemote) {
String altarType = altarName;
if (blocktick == 0) {
if (entity.inventory.getCurrentItem() != null) {
item = entity.inventory.getCurrentItem().getItem();
}
ExtendedPlayer props = ExtendedPlayer.get(entity);
switch (altarType) {
case "airaltar":
try {
if (item == Items.runeEssence) {
numberOfRuneEssences = entity.inventory.getCurrentItem().stackSize;
System.out.println(numberOfRuneEssences);
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.AirRuneAltar);
entity.getHeldItem().stackSize = 0;
TileEntityAirRuneAltar tileEntity = (TileEntityAirRuneAltar) world.getTileEntity(varx, vary, varz);
tileEntity.quantityOfRuneEssence = numberOfRuneEssences;
item = null;
tileEntity.time = 5;
} else {
}
} finally {
}
case "wateraltar":
if (item == Items.runeEssence) {
numberOfRuneEssences = entity.inventory.getCurrentItem().stackSize;
System.out.println(numberOfRuneEssences);
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.WaterRuneAltar);
entity.getHeldItem().stackSize = 0;
TileEntityWaterRuneAltar tileEntity = (TileEntityWaterRuneAltar) world.getTileEntity(varx, vary, varz);
tileEntity.quantityOfRuneEssence = numberOfRuneEssences;
item = null;
} else {
}
case "firealtar":
if (item == Items.runeEssence) {
numberOfRuneEssences = entity.inventory.getCurrentItem().stackSize;
System.out.println(numberOfRuneEssences);
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.FireRuneAltar);
entity.getHeldItem().stackSize = 0;
TileEntityFireRuneAltar tileEntity = (TileEntityFireRuneAltar) world.getTileEntity(varx, vary, varz);
tileEntity.quantityOfRuneEssence = numberOfRuneEssences;
item = null;
} else {
}
case "earthaltar":
if (item == Items.runeEssence) {
numberOfRuneEssences = entity.inventory.getCurrentItem().stackSize;
System.out.println(numberOfRuneEssences);
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.EarthRuneAltar);
entity.getHeldItem().stackSize = 0;
TileEntityEarthRuneAltar tileEntity = (TileEntityEarthRuneAltar) world.getTileEntity(varx, vary, varz);
tileEntity.quantityOfRuneEssence = numberOfRuneEssences;
item = null;
} else {
}
case "mindaltar":
if (item == Items.runeEssence) {
numberOfRuneEssences = entity.inventory.getCurrentItem().stackSize;
System.out.println(numberOfRuneEssences);
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.MindRuneAltar);
entity.getHeldItem().stackSize = 0;
TileEntityMindRuneAltar tileEntity = (TileEntityMindRuneAltar) world.getTileEntity(varx, vary, varz);
tileEntity.quantityOfRuneEssence = numberOfRuneEssences;
item = null;
}
case "bodyaltar":
if (item == Items.runeEssence) {
numberOfRuneEssences = entity.inventory.getCurrentItem().stackSize;
System.out.println(numberOfRuneEssences);
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.BodyRuneAltar);
entity.getHeldItem().stackSize = 0;
TileEntityBodyRuneAltar tileEntity = (TileEntityBodyRuneAltar) world.getTileEntity(varx, vary, varz);
tileEntity.quantityOfRuneEssence = numberOfRuneEssences;
item = null;
}
case "cosmicaltar":
if (item == Items.runeEssence) {
numberOfRuneEssences = entity.inventory.getCurrentItem().stackSize;
System.out.println(numberOfRuneEssences);
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.CosmicRuneAltar);
entity.getHeldItem().stackSize = 0;
TileEntityCosmicRuneAltar tileEntity = (TileEntityCosmicRuneAltar) world.getTileEntity(varx, vary, varz);
tileEntity.quantityOfRuneEssence = numberOfRuneEssences;
item = null;
}
case "chaosaltar":
if (item == Items.runeEssence) {
numberOfRuneEssences = entity.inventory.getCurrentItem().stackSize;
System.out.println(numberOfRuneEssences);
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.ChaosRuneAltar);
entity.getHeldItem().stackSize = 0;
TileEntityChaosRuneAltar tileEntity = (TileEntityChaosRuneAltar) world.getTileEntity(varx, vary, varz);
tileEntity.quantityOfRuneEssence = numberOfRuneEssences;
item = null;
}
case "naturealtar":
if (item == Items.runeEssence) {
numberOfRuneEssences = entity.inventory.getCurrentItem().stackSize;
System.out.println(numberOfRuneEssences);
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.NatureRuneAltar);
entity.getHeldItem().stackSize = 0;
TileEntityNatureRuneAltar tileEntity = (TileEntityNatureRuneAltar) world.getTileEntity(varx, vary, varz);
tileEntity.quantityOfRuneEssence = numberOfRuneEssences;
item = null;
}
case "lawaltar":
if (item == Items.runeEssence) {
numberOfRuneEssences = entity.inventory.getCurrentItem().stackSize;
System.out.println(numberOfRuneEssences);
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.LawRuneAltar);
entity.getHeldItem().stackSize = 0;
TileEntityLawRuneAltar tileEntity = (TileEntityLawRuneAltar) world.getTileEntity(varx, vary, varz);
tileEntity.quantityOfRuneEssence = numberOfRuneEssences;
item = null;
} else {
}
case "deathaltar":
if (item == Items.runeEssence) {
numberOfRuneEssences = entity.inventory.getCurrentItem().stackSize;
System.out.println(numberOfRuneEssences);
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.DeathRuneAltar);
entity.getHeldItem().stackSize = 0;
TileEntityDeathRuneAltar tileEntity = (TileEntityDeathRuneAltar) world.getTileEntity(varx, vary, varz);
tileEntity.quantityOfRuneEssence = numberOfRuneEssences;
item = null;
} else {
}
case "bloodaltar":
if (item == Items.runeEssence) {
numberOfRuneEssences = entity.inventory.getCurrentItem().stackSize;
System.out.println(numberOfRuneEssences);
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.BloodRuneAltar);
entity.getHeldItem().stackSize = 0;
TileEntityBloodRuneAltar tileEntity = (TileEntityBloodRuneAltar) world.getTileEntity(varx, vary, varz);
tileEntity.quantityOfRuneEssence = numberOfRuneEssences;
item = null;
} else {
}
case "astralaltar":
if (item == Items.runeEssence) {
numberOfRuneEssences = entity.inventory.getCurrentItem().stackSize;
System.out.println(numberOfRuneEssences);
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.AstralRuneAltar);
entity.getHeldItem().stackSize = 0;
TileEntityAstralRuneAltar tileEntity = (TileEntityAstralRuneAltar) world.getTileEntity(varx, vary, varz);
tileEntity.quantityOfRuneEssence = numberOfRuneEssences;
item = null;
} else {
}
// ///////////////////////////////////////////////////////////////////////////////////////////////////
case "airrunealtar":
try {
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 1)) {
boolean test = false;
TileEntityAirRuneAltar tileEntity = (TileEntityAirRuneAltar) world.getTileEntity(varx, vary, varz);
if (item != Items.airTalisman && world.getBlock(varx, vary, varz) == Blocks.AirRuneAltar) {
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.runeEssence, tileEntity.quantityOfRuneEssence)));
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.AirAltar);
break;
}
if (item == Items.airTalisman && world.getBlock(varx, vary, varz) == Blocks.AirRuneAltar && tileEntity.time == 0) {
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.airRune, tileEntity.quantityOfRuneEssence)));
props.currentRunecraftingExp = props.currentRunecraftingExp + tileEntity.quantityOfRuneEssence * ExpChart.AIR_RUNE_EXP;
Minecraft.getMinecraft().thePlayer.sendChatMessage("You gained " + tileEntity.quantityOfRuneEssence * ExpChart.AIR_RUNE_EXP + " Runecrafting Experience.");
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 5);
if (randomint == 1) {
int randomRune = randInt(0, 2);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.waterRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.fireRune, 1)));
break;
case 2:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.earthRune, 1)));
break;
}
}
randomint = 10;
item = null;
}
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.AirAltar);
break;
}
}
}
} finally {
}
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
case "waterrunealtar":
try {
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 5)) {
if (item == Items.waterTalisman && world.getBlock(varx, vary, varz) == Blocks.WaterRuneAltar) {
TileEntityWaterRuneAltar tileEntity = (TileEntityWaterRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.waterRune, tileEntity.quantityOfRuneEssence)));
props.currentRunecraftingExp = props.currentRunecraftingExp + tileEntity.quantityOfRuneEssence * ExpChart.WATER_RUNE_EXP;
Minecraft.getMinecraft().thePlayer.sendChatMessage("You gained " + tileEntity.quantityOfRuneEssence * ExpChart.WATER_RUNE_EXP + " Runecrafting Experience.");
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 10);
if (randomint == 1) {
int randomRune = randInt(0, 1);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.mindRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.bodyRune, 1)));
break;
}
}
randomint = 10;
item = null;
}
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.WaterAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 5) && item == Items.waterTalisman && world.getBlock(varx, vary, varz) == Blocks.WaterRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 5, but you are only " + props.currentRunecraftingLevel);
}
}
} finally {
}
case "firerunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 14)) {
if (item == Items.fireTalisman && world.getBlock(varx, vary, varz) == Blocks.FireRuneAltar) {
TileEntityFireRuneAltar tileEntity = (TileEntityFireRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.fireRune, tileEntity.quantityOfRuneEssence)));
props.currentRunecraftingExp = props.currentRunecraftingExp + tileEntity.quantityOfRuneEssence * ExpChart.FIRE_RUNE_EXP;
Minecraft.getMinecraft().thePlayer.sendChatMessage("You gained " + tileEntity.quantityOfRuneEssence * ExpChart.FIRE_RUNE_EXP + " Runecrafting Experience.");
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 10);
if (randomint == 1) {
int randomRune = randInt(0, 1);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.mindRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.bodyRune, 1)));
break;
}
}
randomint = 10;
item = null;
}
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.FireAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 14) && item == Items.fireTalisman && world.getBlock(varx, vary, varz) == Blocks.FireRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 14, but you are only " + props.currentRunecraftingLevel);
}
}
case "earthrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 9)) {
if (item == Items.earthTalisman && world.getBlock(varx, vary, varz) == Blocks.EarthRuneAltar) {
TileEntityEarthRuneAltar tileEntity = (TileEntityEarthRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.earthRune, tileEntity.quantityOfRuneEssence)));
props.currentRunecraftingExp = props.currentRunecraftingExp + tileEntity.quantityOfRuneEssence * ExpChart.EARTH_RUNE_EXP;
Minecraft.getMinecraft().thePlayer.sendChatMessage("You gained " + tileEntity.quantityOfRuneEssence * ExpChart.EARTH_RUNE_EXP + " Runecrafting Experience.");
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 10);
if (randomint == 1) {
int randomRune = randInt(0, 1);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.mindRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.bodyRune, 1)));
break;
}
}
randomint = 10;
item = null;
}
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.EarthAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 9) && item == Items.earthTalisman && world.getBlock(varx, vary, varz) == Blocks.EarthRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 9, but you are only " + props.currentRunecraftingLevel);
}
}
case "mindrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 23)) {
if (item == Items.mindTalisman && world.getBlock(varx, vary, varz) == Blocks.MindRuneAltar) {
TileEntityMindRuneAltar tileEntity = (TileEntityMindRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.mindRune, tileEntity.quantityOfRuneEssence)));
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 10);
if (randomint == 1) {
int randomRune = randInt(0, 2);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.natureRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.lawRune, 1)));
break;
case 2:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.cosmicRune, 1)));
break;
}
}
randomint = 10;
item = null;
}
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.MindAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 23) && item == Items.mindTalisman && world.getBlock(varx, vary, varz) == Blocks.MindRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 23, but you are only " + props.currentRunecraftingLevel);
}
}
case "bodyrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 18)) {
if (item == Items.bodyTalisman && world.getBlock(varx, vary, varz) == Blocks.BodyRuneAltar) {
TileEntityBodyRuneAltar tileEntity = (TileEntityBodyRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.bodyRune, tileEntity.quantityOfRuneEssence)));
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 10);
if (randomint == 1) {
int randomRune = randInt(0, 2);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.natureRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.lawRune, 1)));
break;
case 2:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.cosmicRune, 1)));
break;
}
}
randomint = 10;
item = null;
}
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.BodyAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 18) && item == Items.bodyTalisman && world.getBlock(varx, vary, varz) == Blocks.BodyRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 18, but you are only " + props.currentRunecraftingLevel);
}
}
case "cosmicrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 27)) {
if (item == Items.cosmicTalisman && world.getBlock(varx, vary, varz) == Blocks.CosmicRuneAltar) {
TileEntityCosmicRuneAltar tileEntity = (TileEntityCosmicRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.cosmicRune, tileEntity.quantityOfRuneEssence)));
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 20);
if (randomint == 1) {
int randomRune = randInt(0, 1);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.chaosRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.deathRune, 1)));
break;
}
}
randomint = 10;
item = null;
}
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.CosmicAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 27) && item == Items.cosmicTalisman && world.getBlock(varx, vary, varz) == Blocks.CosmicRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 27, but you are only " + props.currentRunecraftingLevel);
}
}
case "chaosrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 35)) {
if (item == Items.chaosTalisman && world.getBlock(varx, vary, varz) == Blocks.ChaosRuneAltar) {
TileEntityChaosRuneAltar tileEntity = (TileEntityChaosRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.chaosRune, tileEntity.quantityOfRuneEssence)));
item = null;
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.ChaosAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 35) && item == Items.chaosTalisman && world.getBlock(varx, vary, varz) == Blocks.ChaosRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 35, but you are only " + props.currentRunecraftingLevel);
}
}
case "naturerunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 44)) {
if (item == Items.natureTalisman && world.getBlock(varx, vary, varz) == Blocks.NatureRuneAltar) {
TileEntityNatureRuneAltar tileEntity = (TileEntityNatureRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.natureRune, tileEntity.quantityOfRuneEssence)));
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 20);
if (randomint == 1) {
int randomRune = randInt(0, 1);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.chaosRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.deathRune, 1)));
break;
}
}
randomint = 10;
item = null;
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.NatureAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 44) && item == Items.natureTalisman && world.getBlock(varx, vary, varz) == Blocks.NatureRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 44, but you are only " + props.currentRunecraftingLevel);
}
}
}
case "lawrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 54)) {
if (item == Items.lawTalisman && world.getBlock(varx, vary, varz) == Blocks.LawRuneAltar) {
TileEntityLawRuneAltar tileEntity = (TileEntityLawRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.lawRune, tileEntity.quantityOfRuneEssence)));
if (numberOfRuneEssences >= 5) {
int randomint = randInt(1, 20);
if (randomint == 1) {
int randomRune = randInt(0, 1);
switch (randomRune) {
case 0:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.chaosRune, 1)));
break;
case 1:
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.deathRune, 1)));
break;
}
}
randomint = 10;
item = null;
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.LawAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 54) && item == Items.lawTalisman && world.getBlock(varx, vary, varz) == Blocks.LawRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 54, but you are only " + props.currentRunecraftingLevel);
}
}
}
case "deathrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 65)) {
if (item == Items.deathTalisman && world.getBlock(varx, vary, varz) == Blocks.DeathRuneAltar) {
TileEntityDeathRuneAltar tileEntity = (TileEntityDeathRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.deathRune, tileEntity.quantityOfRuneEssence)));
item = null;
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.DeathAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 65) && item == Items.deathTalisman && world.getBlock(varx, vary, varz) == Blocks.DeathRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 65, but you are only " + props.currentRunecraftingLevel);
}
}
case "bloodrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 77)) {
if (item == Items.bloodTalisman && world.getBlock(varx, vary, varz) == Blocks.BloodRuneAltar) {
TileEntityBloodRuneAltar tileEntity = (TileEntityBloodRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.bloodRune, tileEntity.quantityOfRuneEssence)));
item = null;
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.BloodAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 65) && item == Items.bloodTalisman && world.getBlock(varx, vary, varz) == Blocks.BloodRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 77, but you are only " + props.currentRunecraftingLevel);
}
}
case "astralrunealtar":
if (!world.isRemote) {
if (props.isSkillHighEnough("runecrafting", 85)) {
if (item == Items.astralTalisman && world.getBlock(varx, vary, varz) == Blocks.AstralRuneAltar) {
TileEntityAstralRuneAltar tileEntity = (TileEntityAstralRuneAltar) world.getTileEntity(varx, vary, varz);
world.spawnEntityInWorld(new EntityItem(world, varx, vary + 1, varz, new ItemStack(Items.astralRune, tileEntity.quantityOfRuneEssence)));
item = null;
world.setBlockToAir(varx, vary, varz);
world.setBlock(varx, vary, varz, Blocks.AstralAltar);
}
} else if (!props.isSkillHighEnough("runecrafting", 85) && item == Items.astralTalisman && world.getBlock(varx, vary, varz) == Blocks.AstralRuneAltar) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("Your Runecrafting is not high enough. You require a skill level of 85, but you are only " + props.currentRunecraftingLevel);
}
}
default:
;
}
item = null;
blocktick = 20;
}
}
return true;
}
Remove it all, and do a System.out.println inside !world.isRemote clause - see how many times it prints out. If it's twice, something else is interfereing causing it to fire twice. No idea what though.
Art by me: MrPancakeWolfie@DeviantArt