- 1,976
- 68
- 221
Просто решил поделиться кодом спеллбука - предмета, который сохраняет в себя определённые предметы и позволяет переключатся между ними и использовать их возможности:
Если у кого-то болят глаза от такого кода или хотите помочь сделать его более красивым - пишите внизу ваш вариант, буду весьма признателен :lol:
[merge_posts_bbcode]Добавлено: 31.01.2016 17:41:02[/merge_posts_bbcode]
P.S. Всё работает
[merge_posts_bbcode]Добавлено: 31.01.2016 17:42:13[/merge_posts_bbcode]
P.P.S. Если у кого-то есть идеи, как можно загружать предметы, не стоя (смотря, имея его в инвентаре и т.д.) на определённом блоке и не приседая, но всё ещё в 'onItemRightClick' - подскажите, пожалуйста
[merge_posts_bbcode]Добавлено: 31.01.2016 17:45:49[/merge_posts_bbcode]
P.P.P.S. Комментарии на англ из-за того, что при компиле русские буквы поломаются в кашу
[merge_posts_bbcode]Добавлено: 31.05.2016 04:02:57[/merge_posts_bbcode]
UDP: Сделал новый способ добавления спеллов... Ещё более упоротый, но как-то побарабану
Код:
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (!world.isRemote) {
if (stack.stackTagCompound == null) { // First NBT Creating
stack.stackTagCompound = new NBTTagCompound(); // New NBT
stack.stackTagCompound.setString("Owner", player.getDisplayName()); // Owner
stack.stackTagCompound.setInteger("savedSpells", 0);
// List of all available spells
stack.stackTagCompound.setBoolean("haveAcidArrow", false);
stack.stackTagCompound.setBoolean("haveBlink", false);
stack.stackTagCompound.setBoolean("haveDarkness", false);
stack.stackTagCompound.setBoolean("haveFireBall", false);
stack.stackTagCompound.setBoolean("haveFlameArrow", false);
stack.stackTagCompound.setBoolean("haveFlight", false);
stack.stackTagCompound.setBoolean("haveForceField", false);
stack.stackTagCompound.setBoolean("haveGasCloud", false);
stack.stackTagCompound.setBoolean("haveHaste", false);
stack.stackTagCompound.setBoolean("haveHealingMundane", false);
stack.stackTagCompound.setBoolean("haveHealingNormal", false);
stack.stackTagCompound.setBoolean("haveHealingAugmented", false);
stack.stackTagCompound.setBoolean("haveIceStorm", false);
stack.stackTagCompound.setBoolean("haveIgnite", false);
stack.stackTagCompound.setBoolean("haveInvisibility", false);
stack.stackTagCompound.setBoolean("haveLightningBolt", false);
stack.stackTagCompound.setBoolean("haveLightningStorm", false);
stack.stackTagCompound.setBoolean("haveLight", false);
stack.stackTagCompound.setBoolean("haveMagicMissile", false);
stack.stackTagCompound.setBoolean("haveMeteoricStrike", false);
stack.stackTagCompound.setBoolean("havePropulsion", false);
stack.stackTagCompound.setBoolean("haveStoneSkin", false);
stack.stackTagCompound.setBoolean("haveStrenght", false);
stack.stackTagCompound.setBoolean("haveSunBurst", false);
stack.stackTagCompound.setBoolean("haveWebs", false);
// Current spell number in saved list
stack.stackTagCompound.setInteger("curSpellN", 0);
}
// Just to operate with negative coordinates
int X = (int) player.posX;
int Y = (int) player.posY;
int Z = (int) player.posZ;
if (player.posX < 0) {
X = (int) player.posX - 1;
}
if (player.posZ < 0) {
Z = (int) player.posZ - 1;
}
// Scrolling through spell list
if (player.isSneaking()) {
stack.stackTagCompound.setInteger("curSpellN", stack.stackTagCompound.getInteger("curSpellN") + 1);
if (stack.stackTagCompound.getInteger("curSpellN") > stack.stackTagCompound.getInteger("savedSpells")) {
stack.stackTagCompound.setInteger("curSpellN", 1); // Just not to get 654161 spell number
}
}
// Doing what saved spell is supposed to do
if (!player.isSneaking()) {
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
}
}
return stack;
}
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) {
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "AcidArrow") {
RegistrationsList.spellAcidArrow.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Blink") {
RegistrationsList.spellBlink.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Darkness") {
RegistrationsList.spellDarkness.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "FireBall") {
RegistrationsList.spellFireBall.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "FlameArrow") {
RegistrationsList.spellFlameArrow.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Flight") {
RegistrationsList.spellFlight.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "ForceField") {
RegistrationsList.spellForceField.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "GasCloud") {
RegistrationsList.spellGasCloud.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Haste") {
RegistrationsList.spellHaste.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "HealingMundane") {
RegistrationsList.spellHealingMundane.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "HealingNormal") {
RegistrationsList.spellHealingNormal.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "HealingAugmented") {
RegistrationsList.spellHealingAugmented.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "IceStorm") {
RegistrationsList.spellIceStorm.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Ignite") {
RegistrationsList.spellIgnite.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Invisibility") {
RegistrationsList.spellInvisibility.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "LightningBolt") {
RegistrationsList.spellLightningBolt.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "LightningStorm") {
RegistrationsList.spellLightningBolt.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Light") {
RegistrationsList.spellLight.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "MagicMissile") {
RegistrationsList.spellMagicMissile.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "MeteoricStrike") {
RegistrationsList.spellMeteoricStrike.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Propulsion") {
RegistrationsList.spellPropulsion.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "StoneSkin") {
RegistrationsList.spellStoneSkin.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Strenght") {
RegistrationsList.spellStrenght.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "SunBurst") {
RegistrationsList.spellSunBurst.onUsingTick(stack, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Webs") {
RegistrationsList.spellWebs.onUsingTick(stack, player, count);
}
}
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int count){
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "AcidArrow") {
RegistrationsList.spellAcidArrow.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Blink") {
RegistrationsList.spellBlink.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Darkness") {
RegistrationsList.spellDarkness.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "FireBall") {
RegistrationsList.spellFireBall.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "FlameArrow") {
RegistrationsList.spellFlameArrow.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Flight") {
RegistrationsList.spellFlight.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "ForceField") {
RegistrationsList.spellForceField.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "GasCloud") {
RegistrationsList.spellGasCloud.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Haste") {
RegistrationsList.spellHaste.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "HealingMundane") {
RegistrationsList.spellHealingMundane.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "HealingNormal") {
RegistrationsList.spellHealingNormal.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "HealingAugmented") {
RegistrationsList.spellHealingAugmented.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "IceStorm") {
RegistrationsList.spellIceStorm.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Ignite") {
RegistrationsList.spellIgnite.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Invisibility") {
RegistrationsList.spellInvisibility.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "LightningStorm") {
RegistrationsList.spellLightningBolt.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "LightningBolt") {
RegistrationsList.spellLightningBolt.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Light") {
RegistrationsList.spellLight.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "MagicMissile") {
RegistrationsList.spellMagicMissile.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "MeteoricStrike") {
RegistrationsList.spellMeteoricStrike.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Propulsion") {
RegistrationsList.spellPropulsion.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "StoneSkin") {
RegistrationsList.spellStoneSkin.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Strenght") {
RegistrationsList.spellStrenght.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "SunBurst") {
RegistrationsList.spellSunBurst.onPlayerStoppedUsing(stack, world, player, count);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Webs") {
RegistrationsList.spellWebs.onPlayerStoppedUsing(stack, world, player, count);
}
}
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) {
if (!world.isRemote){
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "AcidArrow") {
RegistrationsList.spellAcidArrow.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Blink") {
RegistrationsList.spellBlink.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Darkness") {
RegistrationsList.spellDarkness.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "FireBall") {
RegistrationsList.spellFireBall.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "FlameArrow") {
RegistrationsList.spellFlameArrow.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Flight") {
RegistrationsList.spellFlight.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "ForceField") {
RegistrationsList.spellForceField.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "GasCloud") {
RegistrationsList.spellGasCloud.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Haste") {
RegistrationsList.spellHaste.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "HealingMundane") {
RegistrationsList.spellHealingMundane.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "HealingNormal") {
RegistrationsList.spellHealingNormal.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "HealingAugmented") {
RegistrationsList.spellHealingAugmented.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Ignite") {
RegistrationsList.spellIgnite.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "IceStorm") {
RegistrationsList.spellIceStorm.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Invisibility") {
RegistrationsList.spellInvisibility.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "LightningBolt") {
RegistrationsList.spellLightningBolt.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "LightningStorm") {
RegistrationsList.spellLightningBolt.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Light") {
RegistrationsList.spellLight.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "MagicMissile") {
RegistrationsList.spellMagicMissile.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "MeteoricStrike") {
RegistrationsList.spellMeteoricStrike.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Propulsion") {
RegistrationsList.spellPropulsion.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "StoneSkin") {
RegistrationsList.spellStoneSkin.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Strenght") {
RegistrationsList.spellStrenght.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "SunBurst") {
RegistrationsList.spellSunBurst.onEaten(stack, world, player);
}
if (stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")) == "Webs") {
RegistrationsList.spellWebs.onEaten(stack, world, player);
}
}
return stack;
}
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
if (stack.stackTagCompound != null) {
list.add(stack.stackTagCompound.getString("Owner") + "s' SpellBook");
list.add("Current spell: " + stack.stackTagCompound.getString("spellNumber" + stack.stackTagCompound.getInteger("curSpellN")));
}
}
@Override
public boolean onEntityItemUpdate(EntityItem entity) {
if (!entity.worldObj.isRemote) {
int X = (int) entity.posX;
int Y = (int) entity.posY;
int Z = (int) entity.posZ;
if (entity.posX < 0) {
X = (int) entity.posX - 1;
}
if (entity.posZ < 0) {
Z = (int) entity.posZ - 1;
}
if (StructureList.isSpellAddingAltar(entity.worldObj, X, Y, Z)) {
ItemStack stack = entity.getEntityItem();
if (stack.getTagCompound() != null && stack.getItem() == RegistrationsList.spellBook) {
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(entity.posX - 0.5D, entity.posY - 0.5D, entity.posZ - 0.5D, entity.posX + 0.5D, entity.posY + 0.5D, entity.posZ + 0.5D);
List list = entity.worldObj.getEntitiesWithinAABB(EntityItem.class, aabb);
Iterator iterator = list.iterator();
EntityItem near = null;
while (iterator.hasNext()) {
near = (EntityItem)iterator.next();
if (near == entity) continue;
ItemStack scroll = near.getEntityItem();
if (!stack.stackTagCompound.getBoolean("haveAcidArrow") && scroll.getItem() == RegistrationsList.spellAcidArrow && StructureList.DescriptorAcid(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveAcidArrow", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "AcidArrow");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveBlink") && scroll.getItem() == RegistrationsList.spellBlink && StructureList.DescriptorSonic(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveBlink", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "Blink");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveDarkness") && scroll.getItem() == RegistrationsList.spellDarkness && StructureList.DescriptorChaos(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveDarkness", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "Darkness");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveFireBall") && scroll.getItem() == RegistrationsList.spellFireBall && StructureList.DescriptorFire(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveFireBall", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "FireBall");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveFlameArrow") && scroll.getItem() == RegistrationsList.spellFlameArrow && StructureList.DescriptorFire(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveFlameArrow", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "FlameArrow");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveFlight") && scroll.getItem() == RegistrationsList.spellFlight && StructureList.DescriptorDivine(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveFlight", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "Flight");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveForceField") && scroll.getItem() == RegistrationsList.spellForceField && StructureList.DescriptorGood(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveForceField", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "ForceField");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveGasCloud") && scroll.getItem() == RegistrationsList.spellGasCloud && StructureList.DescriptorDeseases(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveGasCloud", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "GasCloud");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveHaste") && scroll.getItem() == RegistrationsList.spellHaste && StructureList.DescriptorGood(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveHaste", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "Haste");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveHealingMundane") && scroll.getItem() == RegistrationsList.spellHealingMundane && StructureList.DescriptorPositive(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveHealingMundane", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "HealingMundane");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveHealingNormal") && scroll.getItem() == RegistrationsList.spellHealingNormal && StructureList.DescriptorPositive(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveHealingNormal", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "HealingNormal");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveHealingAugmented") && scroll.getItem() == RegistrationsList.spellHealingAugmented && StructureList.DescriptorPositive(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveHealingAugmented", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "HealingAugmented");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveIgnite") && scroll.getItem() == RegistrationsList.spellIgnite && StructureList.DescriptorFrost(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveIgnite", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "Ignite");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveIceStorm") && scroll.getItem() == RegistrationsList.spellIceStorm && StructureList.DescriptorFrost(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveIceStorm", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "IceStorm");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveInvisibility") && scroll.getItem() == RegistrationsList.spellInvisibility && StructureList.DescriptorMind(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveInvisibility", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "Invisibility");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveLightningStorm") && scroll.getItem() == RegistrationsList.spellLightningStorm && StructureList.DescriptorElectro(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveLightningStorm", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "LightningStorm");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveLightningBolt") && scroll.getItem() == RegistrationsList.spellLightningBolt && StructureList.DescriptorElectro(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveLightningBolt", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "LightningBolt");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveLight") && scroll.getItem() == RegistrationsList.spellLight && StructureList.DescriptorDivine(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveLight", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "Light");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveMagicMissile") && scroll.getItem() == RegistrationsList.spellMagicMissile && StructureList.DescriptorDivine(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveMagicMissile", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "MagicMissile");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveMeteoricStrike") && scroll.getItem() == RegistrationsList.spellMeteoricStrike && StructureList.DescriptorFire(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveMeteoricStrike", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "MeteoricStrike");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("havePropulsion") && scroll.getItem() == RegistrationsList.spellPropulsion && StructureList.DescriptorElectro(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("havePropulsion", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "Propulsion");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveStoneSkin") && scroll.getItem() == RegistrationsList.spellStoneSkin && StructureList.DescriptorDivine(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveStoneSkin", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "StoneSkin");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveStrenght") && scroll.getItem() == RegistrationsList.spellStrenght && StructureList.DescriptorGood(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveStrenght", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "Strenght");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveSunBurst") && scroll.getItem() == RegistrationsList.spellSunBurst && StructureList.DescriptorFire(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveSunBurst", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "SunBurst");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
if (!stack.stackTagCompound.getBoolean("haveWebs") && scroll.getItem() == RegistrationsList.spellWebs && StructureList.DescriptorChaos(entity.worldObj, X, Y, Z)) {
stack.stackTagCompound.setInteger("savedSpells", stack.stackTagCompound.getInteger("savedSpells") + 1);
stack.stackTagCompound.setBoolean("haveWebs", true);
stack.stackTagCompound.setString("spellNumber" + stack.stackTagCompound.getInteger("savedSpells"), "Webs");
entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, ModInfo.MODID + ":spbadd", 1.0F, 1.0F);
entity.worldObj.spawnParticle("smoke", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
entity.worldObj.spawnParticle("flame", entity.posX, entity.posY, entity.posZ, 0.0D, 0.0D, 0.0D);
near.setDead();
}
}
}
}
}
return false;
}
[merge_posts_bbcode]Добавлено: 31.01.2016 17:41:02[/merge_posts_bbcode]
P.S. Всё работает
[merge_posts_bbcode]Добавлено: 31.01.2016 17:42:13[/merge_posts_bbcode]
P.P.S. Если у кого-то есть идеи, как можно загружать предметы, не стоя (смотря, имея его в инвентаре и т.д.) на определённом блоке и не приседая, но всё ещё в 'onItemRightClick' - подскажите, пожалуйста
[merge_posts_bbcode]Добавлено: 31.01.2016 17:45:49[/merge_posts_bbcode]
P.P.P.S. Комментарии на англ из-за того, что при компиле русские буквы поломаются в кашу
[merge_posts_bbcode]Добавлено: 31.05.2016 04:02:57[/merge_posts_bbcode]
UDP: Сделал новый способ добавления спеллов... Ещё более упоротый, но как-то побарабану