This commit is contained in:
Gig 2015-04-24 14:20:09 +01:00
parent 6e0ec1d861
commit 4ac26ac086
137 changed files with 10339 additions and 7322 deletions

View file

@ -10,38 +10,54 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import uk.co.qmunity.lib.ref.Names;
public class ModPartItem extends Item {
ModPart modPart;
public ModPartItem(ModPart part) {
public ModPartItem(ModPart part)
{
modPart = part;
setUnlocalizedName(Names.Unlocalized.Items.MULTIPART);
}
@Override
public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int face, float x_, float y_, float z_) {
if(ModPartRegistry.masterProvider != null){
try {
if (ModPartRegistry.masterProvider.placePart(item, player, world, x, y, z, face, x_, y_, z_, modPart.getClass().newInstance())) {
public boolean onItemUse(ItemStack item, EntityPlayer player, World world,
int x, int y, int z, int face, float x_, float y_, float z_)
{
if (ModPartRegistry.masterProvider != null)
{
try
{
if (ModPartRegistry.masterProvider.placePart(item, player,
world, x, y, z, face, x_, y_, z_, modPart.getClass()
.newInstance()))
{
return true;
}
} catch (InstantiationException e) {
} catch (InstantiationException e)
{
e.printStackTrace();
} catch (IllegalAccessException e) {
} catch (IllegalAccessException e)
{
e.printStackTrace();
}
return false;
}else {
for (IPartProvider partProvider : ModPartRegistry.providers) {
try {
if (partProvider.placePart(item, player, world, x, y, z, face, x_, y_, z_, modPart.getClass().newInstance())) {
} else
{
for (IPartProvider partProvider : ModPartRegistry.providers)
{
try
{
if (partProvider.placePart(item, player, world, x, y, z,
face, x_, y_, z_, modPart.getClass().newInstance()))
{
return true;
}
} catch (InstantiationException e) {
} catch (InstantiationException e)
{
e.printStackTrace();
} catch (IllegalAccessException e) {
} catch (IllegalAccessException e)
{
e.printStackTrace();
}
}
@ -50,11 +66,13 @@ public class ModPartItem extends Item {
}
@Override
public String getUnlocalizedName(ItemStack stack) {
public String getUnlocalizedName(ItemStack stack)
{
return modPart.getName();
}
public ModPart getModPart() {
public ModPart getModPart()
{
return modPart;
}
}