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 @ForgeSubscribe
public void onSoundLoad(SoundLoadEvent event) 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 + ":doorLocked.ogg");
event.manager.addSound(mod_pocketDim.modid + ":keyLock.ogg"); event.manager.addSound(mod_pocketDim.modid + ":keyLock.ogg");
event.manager.addSound(mod_pocketDim.modid + ":keyUnlock.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) public int damageDropped(int metadata)
{ {
//Return 0 to avoid dropping Ancient Fabric even if the player somehow manages to break it //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 @Override

View File

@@ -27,7 +27,8 @@ import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
public class ItemDDKey extends Item 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) public ItemDDKey(int itemID)
{ {
super(itemID); super(itemID);
@@ -35,23 +36,23 @@ public class ItemDDKey extends Item
this.setMaxStackSize(1); 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 @Override
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
@@ -66,8 +67,8 @@ public class ItemDDKey extends Item
return !DDLock.hasCreatedLock(par1ItemStack); 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,
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) float par10)
{ {
player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack)); 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, 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)
{ {
if(world.isRemote) if (world.isRemote)
{ {
return false; return false;
} }
if(player.getItemInUse() != null) if (player.getItemInUse() != null)
{ {
return true; return true;
} }
int blockID = world.getBlockId(x, y, z); 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)) if (!(Block.blocksList[blockID] instanceof IDimDoor))
{ {
return false; return false;
} }
DimLink link = PocketManager.getLink(x, y, z, world); 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) if (link == null)
{ {
return false; return false;
} }
//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.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 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.getDimensionData(world).lock(link, !link.getLockState());
PocketManager.getLinkWatcher().update(new ClientLinkData(link)); PocketManager.getLinkWatcher().update(new ClientLinkData(link));
@@ -119,64 +120,66 @@ public class ItemDDKey extends Item
} }
else else
{ {
world.playSoundAtEntity(player, mod_pocketDim.modid + ":doorLocked", 1F, 1F); world.playSoundAtEntity(player, mod_pocketDim.modid + ":doorLocked", 1F, 1F);
} }
} }
else 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.getDimensionData(world).createLock(link, itemStack, world.rand.nextInt(Integer.MAX_VALUE));
PocketManager.getLinkWatcher().update(new ClientLinkData(link)); PocketManager.getLinkWatcher().update(new ClientLinkData(link));
} }
} }
return false; return false;
} }
/** /**
* Handle removal of locks here * Handle removal of locks here
*/ */
@Override @Override
public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer player, int heldTime) public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer player, int heldTime)
{ {
int j = this.getMaxItemUseDuration(itemStack) - heldTime; int j = this.getMaxItemUseDuration(itemStack) - heldTime;
if(j>= TIME_TO_UNLOCK) if (j >= TIME_TO_UNLOCK)
{ {
MovingObjectPosition pos = getMovingObjectPositionFromPlayer(player.worldObj, player, true); //Raytrace to make sure we are still looking at a door
if(pos!=null&&pos.typeOfHit == EnumMovingObjectType.TILE) 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); //make sure the given key is able to access the lock
if(link!=null && link.hasLock()) if (link.doesKeyUnlock(itemStack) && !world.isRemote)
{ {
if (link.doesKeyUnlock(itemStack)&& !world.isRemote) PocketManager.getDimensionData(world).removeLock(link, itemStack);
{ world.playSoundAtEntity(player, mod_pocketDim.modid + ":doorLockRemoved", 1F, 1F);
PocketManager.getDimensionData(world).removeLock(link, itemStack);
world.playSoundAtEntity(player, mod_pocketDim.modid + ":keyUnlock", 1F, 1F);
}
} }
} }
} }
player.clearItemInUse(); }
player.clearItemInUse();
}
} /**
* Raytrace to make sure we are still looking at the right block while preparing to remove the lock
/** */
* Raytrace to make sure we are still looking at the right block @Override
*/ public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
@Override {
public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count) // no need to check every tick, twice a second instead
{ if (count % 10 == 0)
//no need to check every tick
if(count%10 == 0)
{ {
MovingObjectPosition pos = getMovingObjectPositionFromPlayer(player.worldObj, player, true); 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); 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)) if (link.doesKeyUnlock(stack))
{ {
@@ -184,29 +187,27 @@ public class ItemDDKey extends Item
} }
} }
} }
player.clearItemInUse(); player.clearItemInUse();
} }
} }
public EnumAction getItemUseAction(ItemStack par1ItemStack) public EnumAction getItemUseAction(ItemStack par1ItemStack)
{ {
return EnumAction.bow; return EnumAction.bow;
} }
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{ {
return par1ItemStack; return par1ItemStack;
} }
public int getMaxItemUseDuration(ItemStack par1ItemStack)
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
{ return 72000;
return 72000; }
}
public String getItemStackDisplayName(ItemStack par1ItemStack) 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)) 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!"); 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)) 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); DimensionManager.registerDimension(properties.LimboDimensionID, properties.LimboProviderID);
@@ -292,12 +292,16 @@ public class mod_pocketDim
LanguageRegistry.addName(itemRiftBlade, "Rift Blade"); LanguageRegistry.addName(itemRiftBlade, "Rift Blade");
LanguageRegistry.addName(itemWorldThread, "World Thread"); LanguageRegistry.addName(itemWorldThread, "World Thread");
LanguageRegistry.addName(itemDDKey, "Rift Key"); LanguageRegistry.addName(itemDDKey, "Rift Key");
LanguageRegistry.addName(itemQuartzDoor, "Quartz Door");
LanguageRegistry.addName(itemPersonalDoor, "Personal Dimensional Door");
/** /**
* Add names for multiblock inventory item * Add names for multiblock inventory item
*/ */
LanguageRegistry.addName(new ItemStack(blockDimWall, 1, 0), "Fabric of Reality"); 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, 1), "Ancient Fabric");
LanguageRegistry.addName(new ItemStack(blockDimWall, 1, 2), "Altered Fabric");
LanguageRegistry.instance().addStringLocalization("itemGroup.dimDoorsCustomTab", "en_US", "Dimensional Doors Items"); 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); EntityRegistry.registerModEntity(MobMonolith.class, "Monolith", properties.MonolithEntityID, this, 70, 1, true);
EntityList.IDtoClassMapping.put(properties.MonolithEntityID, MobMonolith.class); EntityList.IDtoClassMapping.put(properties.MonolithEntityID, MobMonolith.class);
EntityList.entityEggs.put(properties.MonolithEntityID, new EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff)); 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); CraftingManager.registerRecipes(properties);
GameRegistry.registerCraftingHandler(new CraftingManager()); GameRegistry.registerCraftingHandler(new CraftingManager());

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB