Small things
This commit is contained in:
parent
41b42c9447
commit
5e2a620a3b
9 changed files with 144 additions and 45 deletions
|
@ -85,15 +85,22 @@ public class BlockSocket extends BlockContainer
|
|||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
return true;
|
||||
}
|
||||
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
return true;
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,21 +13,25 @@ public class CommandSN extends CommandBase
|
|||
{
|
||||
public CommandSN() {}
|
||||
|
||||
@Override
|
||||
public String getCommandName()
|
||||
{
|
||||
return "soulnetwork";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRequiredPermissionLevel()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender icommandsender)
|
||||
{
|
||||
return "commands.soulnetwork.usage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender icommandsender, String[] astring)
|
||||
{
|
||||
EntityPlayerMP targetPlayer = getPlayer(icommandsender, astring[0]);
|
||||
|
@ -83,6 +87,12 @@ public class CommandSN extends CommandBase
|
|||
SoulNetworkHandler.addCurrentEssenceToMaximum(owner, fillAmount, fillAmount);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.fillMax.success", owner);
|
||||
}
|
||||
else if ("create".equalsIgnoreCase(astring[1]))
|
||||
{
|
||||
int orbTier = parseIntBounded(icommandsender, astring[2], 1, 6);
|
||||
SoulNetworkHandler.setMaxOrbToMax(owner, orbTier);
|
||||
func_152373_a(icommandsender, this, "commands.soulnetwork.create.success", owner, orbTier);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new CommandException("commands.soulnetwork.notACommand");
|
||||
|
@ -98,6 +108,7 @@ public class CommandSN extends CommandBase
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List addTabCompletionOptions(ICommandSender iCommandSender, String[] astring)
|
||||
{
|
||||
if (astring.length == 1)
|
||||
|
@ -106,7 +117,7 @@ public class CommandSN extends CommandBase
|
|||
}
|
||||
else if (astring.length == 2)
|
||||
{
|
||||
return getListOfStringsMatchingLastWord(astring, "add", "subtract", "fill", "empty", "get");
|
||||
return getListOfStringsMatchingLastWord(astring, "add", "subtract", "fill", "empty", "get", "fillMax", "create");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -117,6 +128,7 @@ public class CommandSN extends CommandBase
|
|||
return MinecraftServer.getServer().getAllUsernames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsernameIndex(String[] astring, int par2)
|
||||
{
|
||||
return par2 == 0;
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
package WayofTime.alchemicalWizardry.common.items;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
|
||||
import WayofTime.alchemicalWizardry.common.block.RitualStone;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemRitualDismantler extends EnergyItems
|
||||
{
|
||||
public ItemRitualDismantler()
|
||||
{
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:ritual_dismantler");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List par3List, boolean x)
|
||||
{
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.dismatler.desc"));
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + stack.getTagCompound().getString("ownerName"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
return EnergyItems.checkAndSetItemOwner(stack, player) && breakRitualStoneAtMasterStone(stack, player, world, x, y, z);
|
||||
}
|
||||
|
||||
public boolean breakRitualStoneAtMasterStone(ItemStack stack, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
ItemStack[] playerInventory = player.inventory.mainInventory;
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TEMasterStone)
|
||||
{
|
||||
TEMasterStone masterStone = (TEMasterStone) tileEntity;
|
||||
int direction = masterStone.getDirection();
|
||||
int freeSpace = -1;
|
||||
|
||||
List<RitualComponent> ritualList = Rituals.getRitualList(masterStone.getCurrentRitual());
|
||||
if (ritualList == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < playerInventory.length; i++)
|
||||
{
|
||||
if (playerInventory[i] == null)
|
||||
{
|
||||
freeSpace = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (RitualComponent rc : ritualList)
|
||||
{
|
||||
if (!world.isAirBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)) && world.getBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)) instanceof RitualStone)
|
||||
{
|
||||
if (freeSpace >= 0)
|
||||
{
|
||||
if (EnergyItems.syphonBatteries(stack, player, getEnergyUsed()) || player.capabilities.isCreativeMode)
|
||||
{
|
||||
world.setBlockToAir(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction));
|
||||
player.inventory.addItemStackToInventory(new ItemStack(ModBlocks.ritualStone));
|
||||
if (world.isRemote)
|
||||
{
|
||||
world.playAuxSFX(2005, x, y + 1, z, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -197,7 +197,6 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
|
|||
|
||||
if (tileEntity instanceof TEMasterStone)
|
||||
{
|
||||
TEMasterStone masterStone = (TEMasterStone) tileEntity;
|
||||
List<RitualComponent> ritualList = Rituals.getRitualList(this.getCurrentRitual(stack));
|
||||
if (ritualList == null)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
|||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -104,6 +105,10 @@ public class SigilLava extends ItemBucket implements ArmourUpgrade, ISigil
|
|||
|
||||
return false;
|
||||
}
|
||||
else if (tile instanceof TESocket)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
if (side == 0)
|
||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.items.sigil;
|
|||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -105,6 +106,10 @@ public class SigilWater extends ItemBucket implements ArmourUpgrade, ISigil
|
|||
|
||||
return false;
|
||||
}
|
||||
else if (tile instanceof TESocket)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
if (side == 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue