mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Sounds & Logic for the filing cabinet
This commit is contained in:
parent
8654cfd92d
commit
0f18a54073
@ -2792,7 +2792,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(brick_dungeon_tile, brick_dungeon_tile.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(brick_dungeon_circle, brick_dungeon_circle.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(brick_forgotten, brick_forgotten.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_computer, ItemBlockMeta.class, deco_computer.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_computer, ItemBlockNamedMeta.class, deco_computer.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(filing_cabinet, filing_cabinet.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(tape_recorder, tape_recorder.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(steel_poles, steel_poles.getUnlocalizedName());
|
||||
|
||||
@ -42,7 +42,7 @@ public class BlockDecoModel extends Block {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
for(byte i = 0; i < subTypes; i++) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
list.add(new ItemStack(item, 1, i << 2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ public class BlockDecoModel extends Block {
|
||||
|
||||
//Assumes meta is using the third and fourth bits.
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
int meta;
|
||||
@ -102,7 +102,7 @@ public class BlockDecoModel extends Block {
|
||||
meta = 3; //For East(b01>b11), just set to 3
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta | stack.getItemDamage(), 2);
|
||||
}
|
||||
|
||||
//These are separate because they have to be constant
|
||||
|
||||
@ -41,8 +41,6 @@ public class TileEntityFileCabinet extends TileEntityCrateBase implements IGUIPr
|
||||
@Override
|
||||
public void openInventory() {
|
||||
if(!worldObj.isRemote) this.playersUsing++;
|
||||
//somehow guarentee that playersUsing is synced up when this method is called, to allow for sounds upon *actually* opening/closing?
|
||||
//this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -69,21 +67,40 @@ public class TileEntityFileCabinet extends TileEntityCrateBase implements IGUIPr
|
||||
} else {
|
||||
this.prevLowerExtent = lowerExtent;
|
||||
this.prevUpperExtent = upperExtent;
|
||||
float openSpeed = 1F / 25F;
|
||||
|
||||
if(this.playersUsing > 0) {
|
||||
this.lowerExtent += openSpeed;
|
||||
}
|
||||
|
||||
float openSpeed = playersUsing > 0 ? 1F / 16F : 1F / 25F;
|
||||
float maxExtent = 0.8F;
|
||||
|
||||
if(this.playersUsing > 0) {
|
||||
if(lowerExtent == 0F && upperExtent == 0F)
|
||||
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 0.8F, 1.0F);
|
||||
else {
|
||||
if(upperExtent + openSpeed >= maxExtent && lowerExtent < maxExtent)
|
||||
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.7F);
|
||||
|
||||
if(timer >= 10)
|
||||
this.upperExtent += openSpeed;
|
||||
} else {
|
||||
this.lowerExtent -= openSpeed;
|
||||
this.upperExtent -= openSpeed;
|
||||
if(lowerExtent + openSpeed >= maxExtent && lowerExtent < maxExtent)
|
||||
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.7F);
|
||||
}
|
||||
|
||||
this.lowerExtent = MathHelper.clamp_float(lowerExtent, 0F, 0.8F);
|
||||
this.upperExtent = MathHelper.clamp_float(upperExtent, 0F, 0.8F);
|
||||
this.lowerExtent += openSpeed;
|
||||
|
||||
if(timer >= 10)
|
||||
this.upperExtent += openSpeed;
|
||||
|
||||
} else if(lowerExtent > 0) {
|
||||
if(upperExtent - openSpeed < maxExtent / 2 && upperExtent >= maxExtent / 2 && upperExtent != lowerExtent)
|
||||
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateClose", 0.8F, 1.0F);
|
||||
|
||||
if(lowerExtent - openSpeed < maxExtent / 2 && lowerExtent >= maxExtent / 2)
|
||||
this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateClose", 0.8F, 1.0F);
|
||||
|
||||
this.upperExtent -= openSpeed;
|
||||
this.lowerExtent -= openSpeed;
|
||||
}
|
||||
|
||||
this.lowerExtent = MathHelper.clamp_float(lowerExtent, 0F, maxExtent);
|
||||
this.upperExtent = MathHelper.clamp_float(upperExtent, 0F, maxExtent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user