Animation
This commit is contained in:
parent
bdc34d673c
commit
2177b72e41
5 changed files with 32 additions and 17 deletions
|
@ -30,7 +30,7 @@ public class BlockAlarm extends BaseTileBlock {
|
|||
public static PropertyBool ACTIVE;
|
||||
|
||||
private static AxisAlignedBB[] GenBoundingBoxes(double depth, double width) {
|
||||
AxisAlignedBB[] bb = {
|
||||
AxisAlignedBB[] dimm = {
|
||||
new AxisAlignedBB(width, 1.0 - depth, width, 1.0 - width, 1.0D, 1.0 - width),
|
||||
new AxisAlignedBB(width, 0.0D, width, 1.0 - width, depth, 1.0 - width),
|
||||
new AxisAlignedBB(width, width, 1.0 - depth, 1.0 - width, 1.0 - width, 1.0D),
|
||||
|
@ -38,16 +38,15 @@ public class BlockAlarm extends BaseTileBlock {
|
|||
new AxisAlignedBB(1.0 - depth, width, width, 1.0D, 1.0 - width, 1.0 - width),
|
||||
new AxisAlignedBB(0.0D, width, width, depth, 1.0 - width, 1.0 - width),
|
||||
};
|
||||
return bb;
|
||||
return dimm;
|
||||
}
|
||||
|
||||
private AxisAlignedBB[] bbs;
|
||||
|
||||
public BlockAlarm() {
|
||||
super(Material.ROCK);
|
||||
setUnlocalizedName("techreborn.alarm");
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, false));
|
||||
this.bbs = GenBoundingBoxes(0.19, 0.81);
|
||||
this.bbs = GenBoundingBoxes(0.19, 0.8);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/lighting"));
|
||||
}
|
||||
|
|
|
@ -3,13 +3,20 @@ package techreborn.tiles;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import techreborn.blocks.BlockAlarm;
|
||||
import techreborn.init.ModSounds;
|
||||
|
||||
public class TileAlarm extends TileEntity implements ITickable{
|
||||
@Override
|
||||
public void update() {
|
||||
if(!world.isRemote && world.getTotalWorldTime() % 25 == 0 && world.isBlockPowered(getPos())){
|
||||
world.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), ModSounds.ALARM, SoundCategory.BLOCKS, 4F, 1F);
|
||||
}
|
||||
}
|
||||
public class TileAlarm extends TileEntity implements ITickable {
|
||||
boolean state = false;
|
||||
int selectedSound;
|
||||
@Override
|
||||
public void update() {
|
||||
if (!world.isRemote && world.getTotalWorldTime() % 25 == 0 && world.isBlockPowered(getPos())) {
|
||||
BlockAlarm.setActive(true, world, pos);
|
||||
state = true;
|
||||
} else if(!world.isRemote && world.getTotalWorldTime() % 25 == 0 ) {
|
||||
BlockAlarm.setActive(false, world, pos);
|
||||
state = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue