Added backwards light and bugfixes

Light in pockets is now reversed
added sound to lock removal
fixed monolith name
fixed other names
This commit is contained in:
StevenRS11
2014-06-26 00:08:20 -04:00
parent eff8379325
commit 9baceb8e3c
8 changed files with 101 additions and 90 deletions

View File

@@ -59,6 +59,7 @@ public class EventHookContainer
@ForgeSubscribe
public void onSoundLoad(SoundLoadEvent event)
{
event.manager.addSound(mod_pocketDim.modid + ":doorLockRemoved.ogg");
event.manager.addSound(mod_pocketDim.modid + ":doorLocked.ogg");
event.manager.addSound(mod_pocketDim.modid + ":keyLock.ogg");
event.manager.addSound(mod_pocketDim.modid + ":keyUnlock.ogg");

View File

@@ -93,7 +93,7 @@ public class BlockDimWall extends Block
public int damageDropped(int metadata)
{
//Return 0 to avoid dropping Ancient Fabric even if the player somehow manages to break it
return metadata == 1 ? 0 : 2;
return metadata == 1 ? 0 : metadata;
}
@Override

View File

@@ -27,7 +27,8 @@ import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
public class ItemDDKey extends Item
{
public static final int TIME_TO_UNLOCK = 50;
public static final int TIME_TO_UNLOCK = 30;
public ItemDDKey(int itemID)
{
super(itemID);
@@ -35,23 +36,23 @@ public class ItemDDKey extends Item
this.setMaxStackSize(1);
}
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
}
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
if(DDLock.hasCreatedLock(par1ItemStack))
{
par3List.add("Bound");
}
else
{
par3List.add("Unbound");
}
}
}
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
if (DDLock.hasCreatedLock(par1ItemStack))
{
par3List.add("Bound");
}
else
{
par3List.add("Unbound");
}
}
@Override
public void registerIcons(IconRegister par1IconRegister)
@@ -66,8 +67,8 @@ public class ItemDDKey extends Item
return !DDLock.hasCreatedLock(par1ItemStack);
}
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9,
float par10)
{
player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack));
@@ -77,41 +78,41 @@ public class ItemDDKey extends Item
public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float playerX, float playerY,
float playerZ)
{
if(world.isRemote)
if (world.isRemote)
{
return false;
}
if(player.getItemInUse() != null)
if (player.getItemInUse() != null)
{
return true;
}
int blockID = world.getBlockId(x, y, z);
//make sure we are dealing with a door
// make sure we are dealing with a door
if (!(Block.blocksList[blockID] instanceof IDimDoor))
{
return false;
}
DimLink link = PocketManager.getLink(x, y, z, world);
//dont do anything to doors without links
// dont do anything to doors without links
if (link == null)
{
return false;
}
//what to do if the door has a lock already
if(link.hasLock())
// what to do if the door has a lock already
if (link.hasLock())
{
if(link.doesKeyUnlock(itemStack))
if (link.doesKeyUnlock(itemStack))
{
if(link.getLockState())
if (link.getLockState())
{
world.playSoundAtEntity(player, mod_pocketDim.modid + ":keyUnlock", 1F, 1F);
world.playSoundAtEntity(player, mod_pocketDim.modid + ":keyUnlock", 1F, 1F);
}
else
{
world.playSoundAtEntity(player, mod_pocketDim.modid + ":keyLock", 1F, 1F);
world.playSoundAtEntity(player, mod_pocketDim.modid + ":keyLock", 1F, 1F);
}
PocketManager.getDimensionData(world).lock(link, !link.getLockState());
PocketManager.getLinkWatcher().update(new ClientLinkData(link));
@@ -119,64 +120,66 @@ public class ItemDDKey extends Item
}
else
{
world.playSoundAtEntity(player, mod_pocketDim.modid + ":doorLocked", 1F, 1F);
world.playSoundAtEntity(player, mod_pocketDim.modid + ":doorLocked", 1F, 1F);
}
}
else
{
if(!DDLock.hasCreatedLock(itemStack))
if (!DDLock.hasCreatedLock(itemStack))
{
world.playSoundAtEntity(player, mod_pocketDim.modid + ":keyLock", 1F, 1F);
world.playSoundAtEntity(player, mod_pocketDim.modid + ":keyLock", 1F, 1F);
PocketManager.getDimensionData(world).createLock(link, itemStack, world.rand.nextInt(Integer.MAX_VALUE));
PocketManager.getLinkWatcher().update(new ClientLinkData(link));
}
}
return false;
}
/**
* Handle removal of locks here
*/
@Override
public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer player, int heldTime)
{
int j = this.getMaxItemUseDuration(itemStack) - heldTime;
if(j>= TIME_TO_UNLOCK)
{
MovingObjectPosition pos = getMovingObjectPositionFromPlayer(player.worldObj, player, true);
if(pos!=null&&pos.typeOfHit == EnumMovingObjectType.TILE)
public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer player, int heldTime)
{
int j = this.getMaxItemUseDuration(itemStack) - heldTime;
if (j >= TIME_TO_UNLOCK)
{
//Raytrace to make sure we are still looking at a door
MovingObjectPosition pos = getMovingObjectPositionFromPlayer(player.worldObj, player, true);
if (pos != null && pos.typeOfHit == EnumMovingObjectType.TILE)
{
//make sure we have a link and it has a lock
DimLink link = PocketManager.getLink(pos.blockX, pos.blockY, pos.blockZ, player.worldObj);
if (link != null && link.hasLock())
{
DimLink link = PocketManager.getLink(pos.blockX, pos.blockY, pos.blockZ, player.worldObj);
if(link!=null && link.hasLock())
//make sure the given key is able to access the lock
if (link.doesKeyUnlock(itemStack) && !world.isRemote)
{
if (link.doesKeyUnlock(itemStack)&& !world.isRemote)
{
PocketManager.getDimensionData(world).removeLock(link, itemStack);
world.playSoundAtEntity(player, mod_pocketDim.modid + ":keyUnlock", 1F, 1F);
PocketManager.getDimensionData(world).removeLock(link, itemStack);
world.playSoundAtEntity(player, mod_pocketDim.modid + ":doorLockRemoved", 1F, 1F);
}
}
}
}
player.clearItemInUse();
}
}
player.clearItemInUse();
}
}
/**
* Raytrace to make sure we are still looking at the right block
*/
@Override
public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
{
//no need to check every tick
if(count%10 == 0)
/**
* Raytrace to make sure we are still looking at the right block while preparing to remove the lock
*/
@Override
public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
{
// no need to check every tick, twice a second instead
if (count % 10 == 0)
{
MovingObjectPosition pos = getMovingObjectPositionFromPlayer(player.worldObj, player, true);
if(pos!=null&&pos.typeOfHit == EnumMovingObjectType.TILE)
if (pos != null && pos.typeOfHit == EnumMovingObjectType.TILE)
{
DimLink link = PocketManager.getLink(pos.blockX, pos.blockY, pos.blockZ, player.worldObj);
if(link!=null && link.hasLock())
if (link != null && link.hasLock())
{
if (link.doesKeyUnlock(stack))
{
@@ -184,29 +187,27 @@ public class ItemDDKey extends Item
}
}
}
player.clearItemInUse();
}
}
}
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.bow;
}
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.bow;
}
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
}
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
}
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 72000;
}
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 72000;
}
public String getItemStackDisplayName(ItemStack par1ItemStack)
{
return StatCollector.translateToLocal(this.getUnlocalizedName(par1ItemStack) + ".name");
return StatCollector.translateToLocal(this.getUnlocalizedName(par1ItemStack));
}
}

View File

@@ -264,7 +264,7 @@ public class mod_pocketDim
if (!DimensionManager.registerProviderType(properties.LimboProviderID, LimboProvider.class, false))
throw new IllegalStateException("There is a provider ID conflict between LimboProvider from Dimensional Doors and another provider type. Fix your configuration!");
if (!DimensionManager.registerProviderType(properties.PersonalPocketProviderID, PersonalPocketProvider.class, false))
throw new IllegalStateException("There is a provider ID conflict between LimboProvider from Dimensional Doors and another provider type. Fix your configuration!");
throw new IllegalStateException("There is a provider ID conflict between PersonalPocketProvider from Dimensional Doors and another provider type. Fix your configuration!");
DimensionManager.registerDimension(properties.LimboDimensionID, properties.LimboProviderID);
@@ -292,12 +292,16 @@ public class mod_pocketDim
LanguageRegistry.addName(itemRiftBlade, "Rift Blade");
LanguageRegistry.addName(itemWorldThread, "World Thread");
LanguageRegistry.addName(itemDDKey, "Rift Key");
LanguageRegistry.addName(itemQuartzDoor, "Quartz Door");
LanguageRegistry.addName(itemPersonalDoor, "Personal Dimensional Door");
/**
* Add names for multiblock inventory item
*/
LanguageRegistry.addName(new ItemStack(blockDimWall, 1, 0), "Fabric of Reality");
LanguageRegistry.addName(new ItemStack(blockDimWall, 1, 1), "Ancient Fabric");
LanguageRegistry.addName(new ItemStack(blockDimWall, 1, 2), "Altered Fabric");
LanguageRegistry.instance().addStringLocalization("itemGroup.dimDoorsCustomTab", "en_US", "Dimensional Doors Items");
@@ -309,7 +313,7 @@ public class mod_pocketDim
EntityRegistry.registerModEntity(MobMonolith.class, "Monolith", properties.MonolithEntityID, this, 70, 1, true);
EntityList.IDtoClassMapping.put(properties.MonolithEntityID, MobMonolith.class);
EntityList.entityEggs.put(properties.MonolithEntityID, new EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff));
LanguageRegistry.instance().addStringLocalization("entity.DimDoors.Obelisk.name", "Monolith");
LanguageRegistry.instance().addStringLocalization("entity.dimdoors.Monolith.name", "Monolith");
CraftingManager.registerRecipes(properties);
GameRegistry.registerCraftingHandler(new CraftingManager());

View File

@@ -81,6 +81,11 @@ public class PocketProvider extends WorldProvider
return false;
}
public float calculateCelestialAngle(long par1, float par3)
{
return .5F;
}
@Override
protected void generateLightBrightnessTable()
{
@@ -89,8 +94,8 @@ public class PocketProvider extends WorldProvider
for (int steps = 0; steps <= 15; ++steps)
{
float var3 = 1.0F - steps / 15.0F;
this.lightBrightnessTable[steps] = 10;
// System.out.println( this.lightBrightnessTable[steps]+"light");
this.lightBrightnessTable[steps] = var3;
System.out.println( this.lightBrightnessTable[steps]+"light");
}
}
@Override

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB