last tweaks done

This commit is contained in:
StevenRS11
2014-05-22 01:03:17 -04:00
parent 3fcc55b5e1
commit 3f6e32dcbf
4 changed files with 35 additions and 5 deletions

View File

@@ -66,7 +66,7 @@ public class CraftingManager implements ICraftingHandler
if (properties.CraftingRiftSignatureAllowed) if (properties.CraftingRiftSignatureAllowed)
{ {
GameRegistry.addRecipe(new ItemStack(itemRiftSignature, 1), GameRegistry.addRecipe(new ItemStack(itemRiftSignature, 1),
" y ", "yxy", " y ", 'x', mod_pocketDim.itemStableFabric, 'y', Item.ingotIron); " y ", "yxy", " y ", 'x', Item.enderPearl, 'y', Item.ingotIron);
} }
if (properties.CraftingRiftRemoverAllowed) if (properties.CraftingRiftRemoverAllowed)
{ {
@@ -96,7 +96,7 @@ public class CraftingManager implements ICraftingHandler
if (properties.CraftingDDKeysAllowed) if (properties.CraftingDDKeysAllowed)
{ {
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemDDKey, 1), GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemDDKey, 1),
" x ", " x ", "yzy", 'y', Item.ingotGold, 'x', Item.ingotIron, 'z', mod_pocketDim.itemStableFabric); " z", " y ", "y ", 'y', Item.ingotGold, 'z', Item.enderPearl);
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemDDKey, 1), GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemDDKey, 1),
"z", "z", 'z', mod_pocketDim.itemDDKey); "z", "z", 'z', mod_pocketDim.itemDDKey);
} }

View File

@@ -10,6 +10,7 @@ import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
@@ -74,6 +75,12 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{ {
ItemStack stack = player.inventory.getCurrentItem();
if (stack != null && stack.getItem() instanceof ItemDDKey)
{
return false;
}
if(!checkCanOpen(world, x, y, z, player)) if(!checkCanOpen(world, x, y, z, player))
{ {
return false; return false;

View File

@@ -129,6 +129,15 @@ public abstract class DimLink
return lock.open(item); return lock.open(item);
} }
/**
* Tries to open this lock. Returns true if the lock is open or if the key can open it
* @return
*/
public boolean canOpen(ItemStack item)
{
return lock.canOpen(item);
}
/** /**
* test if there is a lock, regardless if it is locked or not. * test if there is a lock, regardless if it is locked or not.
* @return * @return
@@ -154,6 +163,7 @@ public abstract class DimLink
*/ */
public void setLock(DDLock lock) public void setLock(DDLock lock)
{ {
PocketManager.getDimensionData(this.source().getDimension()).flagModified();
this.lock = lock; this.lock = lock;
} }

View File

@@ -31,6 +31,10 @@ public class ItemDDKey extends Item
this.setMaxStackSize(1); this.setMaxStackSize(1);
} }
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
}
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{ {
@@ -58,6 +62,12 @@ public class ItemDDKey extends Item
return !DDLock.hasCreatedLock(par1ItemStack); return !DDLock.hasCreatedLock(par1ItemStack);
} }
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
return false;
}
public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float playerX, float playerY, public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float playerX, float playerY,
float playerZ) float playerZ)
{ {
@@ -82,7 +92,7 @@ public class ItemDDKey extends Item
//what to do if the door has a lock already //what to do if the door has a lock already
if(link.hasLock()) if(link.hasLock())
{ {
if(link.getLock().canOpen(itemStack)) if(link.canOpen(itemStack))
{ {
if(link.isLocked()) if(link.isLocked())
{ {
@@ -95,7 +105,10 @@ public class ItemDDKey extends Item
link.getLock().lock(!link.isLocked()); link.getLock().lock(!link.isLocked());
PocketManager.getLinkWatcher().update(new ClientLinkData(link.source(),link.getLock())); PocketManager.getLinkWatcher().update(new ClientLinkData(link.source(),link.getLock()));
} }
else
{
world.playSoundAtEntity(player, mod_pocketDim.modid + ":doorLocked", 1F, 1F);
}
} }
else else
{ {