Naming improvements
Clarified naming in DDLock and associated methods. Still not quite done.
This commit is contained in:
parent
e8fa928c50
commit
dccb12116d
10 changed files with 49 additions and 72 deletions
|
@ -474,7 +474,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
|||
if(link!=null&&link.hasLock())
|
||||
{
|
||||
status++;
|
||||
if(link.isLocked())
|
||||
if(link.getLockState())
|
||||
{
|
||||
status++;
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
|||
{
|
||||
return link==null;
|
||||
}
|
||||
if(!link.isLocked())
|
||||
if(!link.getLockState())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
|||
{
|
||||
if(item.getItem() instanceof ItemDDKey)
|
||||
{
|
||||
if(link.open(item))
|
||||
if(link.tryToOpen(item))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
|
|||
{
|
||||
return link==null;
|
||||
}
|
||||
if(!link.isLocked())
|
||||
if(!link.getLockState())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
|
|||
{
|
||||
if(item.getItem() instanceof ItemDDKey)
|
||||
{
|
||||
if(link.open(item))
|
||||
if(link.tryToOpen(item))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -12,13 +12,13 @@ import net.minecraft.nbt.NBTTagList;
|
|||
|
||||
public class DDLock
|
||||
{
|
||||
private boolean isLocked;
|
||||
private boolean lockState;
|
||||
private final int lockKey;
|
||||
|
||||
|
||||
public DDLock(boolean isLocked, int lockKey)
|
||||
{
|
||||
this.isLocked = isLocked;
|
||||
this.lockState = isLocked;
|
||||
this.lockKey = lockKey;
|
||||
}
|
||||
|
||||
|
@ -30,9 +30,9 @@ public class DDLock
|
|||
* See if the lock is currently locked. False if there is no lock.
|
||||
* @return
|
||||
*/
|
||||
public boolean isLocked()
|
||||
public boolean getLockState()
|
||||
{
|
||||
return this.isLocked;
|
||||
return this.lockState;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,9 +40,9 @@ public class DDLock
|
|||
* otherwise returns true
|
||||
* @param flag
|
||||
*/
|
||||
protected void lock(boolean flag)
|
||||
protected void setLockState(boolean flag)
|
||||
{
|
||||
this.isLocked = flag;
|
||||
this.lockState = flag;
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class DDLock
|
|||
* @param itemStack
|
||||
* @return
|
||||
*/
|
||||
public boolean canOpen(ItemStack itemStack)
|
||||
public boolean doesKeyUnlock(ItemStack itemStack)
|
||||
{
|
||||
for(int key :getKeys(itemStack))
|
||||
{
|
||||
|
@ -69,9 +69,9 @@ public class DDLock
|
|||
* @param item
|
||||
* @return
|
||||
*/
|
||||
public boolean open(ItemStack itemStack)
|
||||
public boolean tryToOpen(ItemStack itemStack)
|
||||
{
|
||||
return (!this.isLocked)||this.canOpen(itemStack);
|
||||
return (!this.lockState)||this.doesKeyUnlock(itemStack);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -139,7 +139,7 @@ public class DDLock
|
|||
|
||||
public static boolean hasCreatedLock(ItemStack key)
|
||||
{
|
||||
if(isKey(key))
|
||||
if(isItemKey(key))
|
||||
{
|
||||
if(key.hasTagCompound())
|
||||
{
|
||||
|
@ -150,14 +150,14 @@ public class DDLock
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean isKey(ItemStack key)
|
||||
public static boolean isItemKey(ItemStack key)
|
||||
{
|
||||
return key.getItem() instanceof ItemDDKey;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected static DDLock createLock(ItemStack itemStack, int lockKey2)
|
||||
protected static DDLock generateLockKeyPair(ItemStack itemStack, int lockKey2)
|
||||
{
|
||||
itemStack.getTagCompound().setBoolean("HasCreatedLock", true);
|
||||
DDLock.setKeys(itemStack, new int[]{lockKey2});
|
||||
|
|
|
@ -124,18 +124,18 @@ public abstract class DimLink
|
|||
* Tries to open this lock. Returns true if the lock is open or if the key can open it
|
||||
* @return
|
||||
*/
|
||||
public boolean open(ItemStack item)
|
||||
public boolean tryToOpen(ItemStack item)
|
||||
{
|
||||
return lock.open(item);
|
||||
return lock.tryToOpen(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to open this lock. Returns true if the lock is open or if the key can open it
|
||||
* Tests if the given key item fits this lock
|
||||
* @return
|
||||
*/
|
||||
public boolean canOpen(ItemStack item)
|
||||
public boolean doesKeyUnlock(ItemStack item)
|
||||
{
|
||||
return lock.canOpen(item);
|
||||
return lock.doesKeyUnlock(item);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,11 +147,19 @@ public abstract class DimLink
|
|||
return this.lock!=null;
|
||||
}
|
||||
|
||||
public boolean isLocked()
|
||||
/**
|
||||
* Tests if the lock is open or not
|
||||
*
|
||||
*/
|
||||
public boolean getLockState()
|
||||
{
|
||||
return this.hasLock()&&this.lock.isLocked();
|
||||
return this.hasLock()&&this.lock.getLockState();
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the actual lock object
|
||||
* @return
|
||||
*/
|
||||
public DDLock getLock()
|
||||
{
|
||||
return this.lock;
|
||||
|
|
|
@ -120,7 +120,7 @@ public abstract class NewDimData implements IPackable<PackedDimData>
|
|||
{
|
||||
return false;
|
||||
}
|
||||
this.lock = DDLock.createLock(itemStack, lockKey);
|
||||
this.lock = DDLock.generateLockKeyPair(itemStack, lockKey);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -591,7 +591,7 @@ public abstract class NewDimData implements IPackable<PackedDimData>
|
|||
public void lock(DimLink link, boolean locked)
|
||||
{
|
||||
InnerDimLink innerLink = (InnerDimLink)link;
|
||||
innerLink.lock.lock(locked);
|
||||
innerLink.lock.setLockState(locked);
|
||||
modified = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,9 +92,9 @@ public class ItemDDKey extends Item
|
|||
//what to do if the door has a lock already
|
||||
if(link.hasLock())
|
||||
{
|
||||
if(link.canOpen(itemStack))
|
||||
if(link.doesKeyUnlock(itemStack))
|
||||
{
|
||||
if(link.isLocked())
|
||||
if(link.getLockState())
|
||||
{
|
||||
world.playSoundAtEntity(player, mod_pocketDim.modid + ":keyUnlock", 1F, 1F);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public class ItemDDKey extends Item
|
|||
{
|
||||
world.playSoundAtEntity(player, mod_pocketDim.modid + ":keyLock", 1F, 1F);
|
||||
}
|
||||
PocketManager.getDimensionData(world).lock(link, !link.isLocked());
|
||||
PocketManager.getDimensionData(world).lock(link, !link.getLockState());
|
||||
PocketManager.getLinkWatcher().update(new ClientLinkData(link.source(),link.getLock()));
|
||||
}
|
||||
else
|
||||
|
|
|
@ -212,7 +212,7 @@ public class mod_pocketDim
|
|||
personalDimDoor = new PersonalDimDoor(properties.PersonalDimDoorID, Material.rock,properties).setHardness(0.1F).setUnlocalizedName("dimDoorPersonal");
|
||||
|
||||
goldenDoor = new BlockDoorGold(properties.GoldenDoorID, Material.iron).setHardness(0.1F).setUnlocalizedName("doorGold");
|
||||
blockDimWall = new BlockDimWall(properties.FabricBlockID, 0, Material.iron).setLightValue(1.0F).setHardness(0.1F).setUnlocalizedName("blockDimWall");
|
||||
blockDimWall = new BlockDimWall(properties.FabricBlockID, 0, Material.iron).setLightValue(1.5F).setHardness(0.1F).setUnlocalizedName("blockDimWall");
|
||||
blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setUnlocalizedName("blockDimWallPerm");
|
||||
warpDoor = new WarpDoor(properties.WarpDoorID, Material.wood, properties).setHardness(1.0F) .setUnlocalizedName("dimDoorWarp");
|
||||
blockRift = (BlockRift) (new BlockRift(properties.RiftBlockID, 0, Material.air, properties).setHardness(1.0F) .setUnlocalizedName("rift"));
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ClientLinkData
|
|||
|
||||
if (hasLock)
|
||||
{
|
||||
output.writeBoolean(lock.isLocked());
|
||||
output.writeBoolean(lock.getLockState());
|
||||
output.writeInt(lock.getLockKey());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class PersonalPocketProvider extends PocketProvider
|
|||
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
|
||||
{
|
||||
setCloudRenderer( new CloudRenderBlank());
|
||||
return this.worldObj.getWorldVec3Pool().getVecFromPool(.89, .89, .89);
|
||||
return this.worldObj.getWorldVec3Pool().getVecFromPool(1,1,1);
|
||||
}
|
||||
|
||||
public boolean isSurfaceWorld()
|
||||
|
@ -61,7 +61,7 @@ public class PersonalPocketProvider extends PocketProvider
|
|||
@Override
|
||||
public Vec3 getFogColor(float par1, float par2)
|
||||
{
|
||||
return this.worldObj.getWorldVec3Pool().getVecFromPool(.89, .89, .89);
|
||||
return this.worldObj.getWorldVec3Pool().getVecFromPool(1,1,1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,60 +28,32 @@ public class PrivatePocketRender implements ISimpleBlockRenderingHandler
|
|||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
float par5 = .5F;
|
||||
float par6 = .5F;
|
||||
float par7 = .5F;
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
boolean flag = false;
|
||||
float f3 = 0.5F;
|
||||
float f4 = 1.0F;
|
||||
float f5 = 0.8F;
|
||||
float f6 = 0.6F;
|
||||
float f7 = f4 * par5;
|
||||
float f8 = f4 * par6;
|
||||
float f9 = f4 * par7;
|
||||
float f10 = f3;
|
||||
float f11 = f5;
|
||||
float f12 = f6;
|
||||
float f13 = f3;
|
||||
float f14 = f5;
|
||||
float f15 = f6;
|
||||
float f16 = f3;
|
||||
float f17 = f5;
|
||||
float f18 = f6;
|
||||
|
||||
if (block != Block.grass)
|
||||
{
|
||||
f10 = f3 * par5;
|
||||
f11 = f5 * par5;
|
||||
f12 = f6 * par5;
|
||||
f13 = f3 * par6;
|
||||
f14 = f5 * par6;
|
||||
f15 = f6 * par6;
|
||||
f16 = f3 * par7;
|
||||
f17 = f5 * par7;
|
||||
f18 = f6 * par7;
|
||||
}
|
||||
Icon icon = renderer.getBlockIcon(block, world, x, y, z, 2);
|
||||
|
||||
|
||||
tessellator.setColorOpaque_F(.89F, .89F, .89F);
|
||||
|
||||
tessellator.setColorOpaque_F(1F, 1F, 1F);
|
||||
|
||||
if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y - 1, z, 0))
|
||||
{
|
||||
renderer.renderFaceYNeg(block, (double)x, (double)y, (double)z, renderer.getBlockIcon(block, world, x, y, z, 0));
|
||||
renderer.renderFaceYNeg(block, (double)x, (double)y, (double)z, icon);
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y + 1, z, 1))
|
||||
{
|
||||
renderer.renderFaceYPos(block, (double)x, (double)y, (double)z, renderer.getBlockIcon(block, world, x, y, z, 1));
|
||||
renderer.renderFaceYPos(block, (double)x, (double)y, (double)z, icon);
|
||||
flag = true;
|
||||
}
|
||||
|
||||
Icon icon;
|
||||
|
||||
|
||||
if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y, z - 1, 2))
|
||||
{
|
||||
icon = renderer.getBlockIcon(block, world, x, y, z, 2);
|
||||
renderer.renderFaceZNeg(block, (double)x, (double)y, (double)z, icon);
|
||||
|
||||
|
||||
|
@ -90,7 +62,6 @@ public class PrivatePocketRender implements ISimpleBlockRenderingHandler
|
|||
|
||||
if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y, z + 1, 3))
|
||||
{
|
||||
icon = renderer.getBlockIcon(block, world, x, y, z, 3);
|
||||
renderer.renderFaceZPos(block, (double)x, (double)y, (double)z, icon);
|
||||
|
||||
|
||||
|
@ -100,7 +71,6 @@ public class PrivatePocketRender implements ISimpleBlockRenderingHandler
|
|||
|
||||
if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x - 1, y, z, 4))
|
||||
{
|
||||
icon = renderer.getBlockIcon(block, world, x, y, z, 4);
|
||||
renderer.renderFaceXNeg(block, (double)x, (double)y, (double)z, icon);
|
||||
|
||||
|
||||
|
@ -110,7 +80,6 @@ public class PrivatePocketRender implements ISimpleBlockRenderingHandler
|
|||
|
||||
if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x + 1, y, z, 5))
|
||||
{
|
||||
icon = renderer.getBlockIcon(block, world, x, y, z, 5);
|
||||
renderer.renderFaceXPos(block, (double)x, (double)y, (double)z, icon);
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue